Posts

Showing posts from March, 2014

How to add pre-receive hook in GitLab

Image
Recently we decided to move our git repo to local git server so we chose GitLab. During weeks use GitLab it was really convenient. Until one day we have a thought about checking code style before push.  Basically Git support 2 kinds of hooks. One is Client side and the other is from Server side http://git-scm.com/book/en/Customizing-Git-Git-Hooks In terms of checking code style we can do both on Client and Server side.  However we want this rules be more STRICT :D, so we decided to make it from Server side . So here is problem! After investigation we found GitLab actually changed quite a lot from Gitorious. Especially Gitlab uses Gitlab-Shell to wrapper the Git commands. So when we found "Hooks" folder what we can get is like this:    ONLY ONE "UPDATE" . If you open it you will found quite simple codes:    So check GitlabUpdate in ../lib/  And if you change the codes to exit with "1", all the push request will be rejected. S

How to write Gradle Plugins with Groovy for Android

Image
Since Android Studio being released,  I could always find that Google announce that Gradle is better than Maven and Ant. Especially it supports Groovy as script language natively. However I could not get chance to try it. Recently our project requires us to implement CI and something else. So I got chance to learn it more. Firstly I need to know how to create a customised Gradle Task using Groovy. I tried building some simple "Hello world " tasks inside of build.gradle file. They all work fine. But once I tried to implement some more complicated ones which needs importing some other libraries, it will complain can not import. So I recheck the doc from Gradle. There is another way to create a standalone plugin library. http://www.gradle.org/docs/current/userguide/custom_tasks.html So I followed the doc to create mine one. 1. Create Gradle project using Intellij 2. Add framework support -> Groovy 3. Create the source structure like this. 4. Change the bui