diff options
author | James Moger <james.moger@gitblit.com> | 2014-04-11 17:55:53 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-04-12 11:31:03 -0400 |
commit | 819efdc8c5ea633e9be1e744ade8b197d21a1962 (patch) | |
tree | fa178791fd466a50537a9d2046d114b8f855032f /src/site | |
parent | a57d0c36910a96391b79511224eeb2989f52f6e3 (diff) | |
download | gitblit-819efdc8c5ea633e9be1e744ade8b197d21a1962.tar.gz gitblit-819efdc8c5ea633e9be1e744ade8b197d21a1962.zip |
Allow ReceiveHook extensions
Diffstat (limited to 'src/site')
-rw-r--r-- | src/site/setup_plugins.mkd | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/site/setup_plugins.mkd b/src/site/setup_plugins.mkd index b609a683..b956cc15 100644 --- a/src/site/setup_plugins.mkd +++ b/src/site/setup_plugins.mkd @@ -54,13 +54,47 @@ Gitblit also supports loading multiple plugin registries. Just place another ** ### 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.
|