James Moger
2014-04-11 aa89bef3a9e06404afb268426cbab1ef20c3857c
src/site/setup_plugins.mkd
@@ -67,34 +67,50 @@
```java
import com.gitblit.extensions.ReceiveHook;
import java.util.Collection;
import org.eclipse.jgit.transport.ReceiveCommand;
import ro.fortsoft.pf4j.Extension;
@Extension
public class MyHook extends ReceiveHook {
public class MyReceiveHook extends ReceiveHook {
    @Override
    public void onPreReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) {
        RepositoryModel repository = receivePack.getRepositoryModel();
        UserModel user = receivePack.getUserModel();
        receivePack.sendInfo("Hi {0}, I see {1} commands for {2} onPreReceive",
                        user.getDisplayName(),
                        commands.size(),
                        repository.name);
    }
    @Override
    public void onPostReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) {
        RepositoryModel repository = receivePack.getRepositoryModel();
        UserModel user = receivePack.getUserModel();
        receivePack.sendInfo("Hi {0}, I see {1} commands for {2} onPostReceive",
                        user.getDisplayName(),
                        commands.size(),
                        repository.name);
    }
}
```
### Extension Point: Patchset Hook
You can provide your own custom patchset hook by extending the *PatchsetHook* class.
```java
import com.gitblit.extensions.PatchsetHook;
import com.gitblit.models.TicketModel;
import ro.fortsoft.pf4j.Extension;
@Extension
public class MyPatchsetHook extends PatchsetHook {
    @Override
    public void onNewPatchset(TicketModel ticket) {
    }
    @Override
    public void onUpdatePatchset(TicketModel ticket) {
    }
    @Override
    public void onMergePatchset(TicketModel ticket) {
    }
}
```
### Mac OSX Fonts
Gitblit's core SSH commands and those in the *powertools* plugin rely on use of ANSI border characters to provide a pretty presentation of data.  Unfortunately, the fonts provided by Apple - while very nice - don't work well with ANSI border characters.  The following public domain fixed-width, fixed-point, bitmapped fonts work very nicely.  I find the 6x12 font with a line spacing of ~0.8 to be quite acceptable.