James Moger
2014-04-11 819efdc8c5ea633e9be1e744ade8b197d21a1962
src/site/setup_plugins.mkd
@@ -54,13 +54,47 @@
### Extension Point: SSH DispatchCommand
You can provide your own custom SSH commands by extending the DispatchCommand.
You can provide your own custom SSH commands by extending the *DispatchCommand* class.
For some examples of how to do this, please see:
[gitblit-cookbook-plugin (Maven project)](https://dev.gitblit.com/summary/gitblit-cookbook-plugin.git)
[gitblit-powertools-plugin (Ant/Moxie project)](https://dev.gitblit.com/summary/gitblit-powertools-plugin.git)
### Extension Point: Pre- and Post- Receive Hook
You can provide your own custom pre and/or post receive hooks by extending the *ReceiveHook* class.
```java
import com.gitblit.extensions.ReceiveHook;
import ro.fortsoft.pf4j.Extension;
@Extension
public class MyHook 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);
    }
}
```
### 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.