diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-07-26 21:00:11 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-07-26 21:00:11 -0400 |
commit | c83fd4a32868d46765a88f6903dd807f18c9ae84 (patch) | |
tree | 8caffbf1eee77601014d4e58833e74e5cc55891c /IkiWiki | |
parent | 4604fadf0acb92ec3e64092bcd9e76eae93b93b2 (diff) |
wrapper setup reorg
Flattened the wrapper setup, as this lets it be handled better by the
setup generation code.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Rcs/bzr.pm | 28 | ||||
-rw-r--r-- | IkiWiki/Rcs/git.pm | 29 | ||||
-rw-r--r-- | IkiWiki/Rcs/mercurial.pm | 28 | ||||
-rw-r--r-- | IkiWiki/Rcs/monotone.pm | 27 | ||||
-rw-r--r-- | IkiWiki/Rcs/svn.pm | 28 | ||||
-rw-r--r-- | IkiWiki/Rcs/tla.pm | 28 | ||||
-rw-r--r-- | IkiWiki/Setup.pm | 16 |
7 files changed, 164 insertions, 20 deletions
diff --git a/IkiWiki/Rcs/bzr.pm b/IkiWiki/Rcs/bzr.pm index 30fa4482e..136f2d20f 100644 --- a/IkiWiki/Rcs/bzr.pm +++ b/IkiWiki/Rcs/bzr.pm @@ -8,11 +8,36 @@ use IkiWiki; use Encode; use open qw{:utf8 :std}; +hook(type => "checkconfig", id => "bzr", call => sub { #{{{ + if (! defined $config{diffurl}) { + $config{diffurl}=""; + } + if (exists $config{bzr_wrapper}) { + push @{$config{wrappers}}, { + wrapper => $config{bzr_wrapper}, + wrappermode => (defined $config{bzr_wrappermode} ? $config{bzr_wrappermode} : "06755"), + }; + } +}); #}}} + hook(type => "getsetup", id => "bzr", call => sub { #{{{ return + bzr_wrapper => { + type => "string", + #example => "", # FIXME add example + description => "bzr post-commit executable to generate", + safe => 0, # file + rebuild => 0, + }, + bzr_wrappermode => { + type => "string", + example => '06755', + description => "mode for bzr_wrapper (can safely be made suid)", + safe => 0, + rebuild => 0, + }, historyurl => { type => "string", - default => "", #example => "", # FIXME add example description => "url to show file history, using loggerhead ([[file]] substituted)", safe => 1, @@ -20,7 +45,6 @@ hook(type => "getsetup", id => "bzr", call => sub { #{{{ }, diffurl => { type => "string", - default => "", example => "http://example.com/revision?start_revid=[[r2]]#[[file]]-s", description => "url to view a diff, using loggerhead ([[file]] and [[r2]] substituted)", safe => 1, diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm index 7f4bd0a08..f8614e4a1 100644 --- a/IkiWiki/Rcs/git.pm +++ b/IkiWiki/Rcs/git.pm @@ -12,19 +12,41 @@ my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes hook(type => "checkconfig", id => "git", call => sub { #{{{ + if (! defined $config{diffurl}) { + $config{diffurl}=""; + } if (! defined $config{gitorigin_branch}) { $config{gitorigin_branch}="origin"; } if (! defined $config{gitmaster_branch}) { $config{gitmaster_branch}="master"; } + if (exists $config{git_wrapper}) { + push @{$config{wrappers}}, { + wrapper => $config{git_wrapper}, + wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"), + }; + } }); #}}} hook(type => "getsetup", id => "git", call => sub { #{{{ return + git_wrapper => { + type => "string", + example => "/git/wiki.git/hooks/post-update", + description => "git post-update executable to generate", + safe => 0, # file + rebuild => 0, + }, + git_wrappermode => { + type => "string", + example => '06755', + description => "mode for git_wrapper (can safely be made suid)", + safe => 0, + rebuild => 0, + }, historyurl => { type => "string", - default => "", example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=history;f=[[file]]", description => "gitweb url to show file history ([[file]] substituted)", safe => 1, @@ -32,7 +54,6 @@ hook(type => "getsetup", id => "git", call => sub { #{{{ }, diffurl => { type => "string", - default => "", example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=blobdiff;h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_parent]];f=[[file]]", description => "gitweb url to show a diff ([[sha1_to]], [[sha1_from]], [[sha1_parent]], and [[file]] substituted)", safe => 1, @@ -40,14 +61,14 @@ hook(type => "getsetup", id => "git", call => sub { #{{{ }, gitorigin_branch => { type => "string", - default => "origin", + example => "origin", description => "where to pull and push changes (set to empty string to disable)", safe => 0, # paranoia rebuild => 0, }, gitmaster_branch => { type => "string", - default => "master", + example => "master", description => "branch that the wiki is stored in", safe => 0, # paranoia rebuild => 0, diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm index 6452a0805..0cc1e291d 100644 --- a/IkiWiki/Rcs/mercurial.pm +++ b/IkiWiki/Rcs/mercurial.pm @@ -8,11 +8,36 @@ use IkiWiki; use Encode; use open qw{:utf8 :std}; +hook(type => "checkconfig", id => "mercurial", call => sub { #{{{ + if (! defined $config{diffurl}) { + $config{diffurl}=""; + } + if (exists $config{mercurial_wrapper}) { + push @{$config{wrappers}}, { + wrapper => $config{mercurial_wrapper}, + wrappermode => (defined $config{mercurial_wrappermode} ? $config{mercurial_wrappermode} : "06755"), + }; + } +}); #}}} + hook(type => "getsetup", id => "mercurial", call => sub { #{{{ return + mercurial_wrapper => { + type => "string", + #example => # FIXME add example + description => "mercurial post-commit executable to generate", + safe => 0, # file + rebuild => 0, + }, + mercurial_wrappermode => { + type => "string", + example => '06755', + description => "mode for mercurial_wrapper (can safely be made suid)", + safe => 0, + rebuild => 0, + }, historyurl => { type => "string", - default => "", example => "http://example.com:8000/log/tip/[[file]]", description => "url to hg serve'd repository, to show file history ([[file]] substituted)", safe => 1, @@ -20,7 +45,6 @@ hook(type => "getsetup", id => "mercurial", call => sub { #{{{ }, diffurl => { type => "string", - default => "", example => "http://localhost:8000/?fd=[[r2]];file=[[file]]", description => "url to hg serve'd repository, to show diff ([[file]] and [[r2]] substituted)", safe => 1, diff --git a/IkiWiki/Rcs/monotone.pm b/IkiWiki/Rcs/monotone.pm index 3b3cd5008..5e8579b2f 100644 --- a/IkiWiki/Rcs/monotone.pm +++ b/IkiWiki/Rcs/monotone.pm @@ -40,13 +40,33 @@ hook(type => "checkconfig", id => "monotone", call => sub { #{{{ if ($version < 0.38) { error("Monotone version too old, is $version but required 0.38"); } + + if (exists $config{mtn_wrapper}) { + push @{$config{wrappers}}, { + wrapper => $config{mtn_wrapper}, + wrappermode => (defined $config{mtn_wrappermode} ? $config{mtn_wrappermode} : "06755"), + }; + } }); #}}} hook(type => "getsetup", id => "monotone", call => sub { #{{{ return + mtn_wrapper => { + type => "string", + example => "/srv/mtn/wiki/_MTN/ikiwiki-netsync-hook", + description => "monotone netsync hook executable to generate", + safe => 0, # file + rebuild => 0, + }, + mtn_wrappermode => { + type => "string", + example => '06755', + description => "mode for mtn_wrapper (can safely be made suid)", + safe => 0, + rebuild => 0, + }, mtnkey => { type => "string", - default => "", example => 'web@example.com', description => "your monotone key", safe => 1, @@ -54,7 +74,6 @@ hook(type => "getsetup", id => "monotone", call => sub { #{{{ }, historyurl => { type => "string", - default => "", example => "http://viewmtn.example.com/branch/head/filechanges/com.example.branch/[[file]]", description => "viewmtn url to show file history ([[file]] substituted)", safe => 1, @@ -62,7 +81,6 @@ hook(type => "getsetup", id => "monotone", call => sub { #{{{ }, diffurl => { type => "string", - default => "", example => "http://viewmtn.example.com/revision/diff/[[r1]]/with/[[r2]]/[[file]]", description => "viewmtn url to show a diff ([[r1]], [[r2]], and [[file]] substituted)", safe => 1, @@ -70,14 +88,13 @@ hook(type => "getsetup", id => "monotone", call => sub { #{{{ }, mtnsync => { type => "boolean", - default => 0, + example => 0, description => "sync on update and commit?", safe => 0, # paranoia rebuild => 0, }, mtnrootdir => { type => "string", - default => "", description => "path to your workspace (defaults to the srcdir; specify if the srcdir is a subdirectory of the workspace)", safe => 0, # path rebuild => 0, diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm index 9b8d4be13..e34d8fe3e 100644 --- a/IkiWiki/Rcs/svn.pm +++ b/IkiWiki/Rcs/svn.pm @@ -8,6 +8,9 @@ use IkiWiki; use POSIX qw(setlocale LC_CTYPE); hook(type => "checkconfig", id => "svn", call => sub { #{{{ + if (! defined $config{diffurl}) { + $config{diffurl}=""; + } if (! defined $config{svnpath}) { $config{svnpath}="trunk"; } @@ -17,13 +20,18 @@ hook(type => "checkconfig", id => "svn", call => sub { #{{{ $config{svnpath}=~s/\/$//; $config{svnpath}=~s/^\///; } + if (exists $config{svn_wrapper}) { + push @{$config{wrappers}}, { + wrapper => $config{svn_wrapper}, + wrappermode => (defined $config{svn_wrappermode} ? $config{svn_wrappermode} : "04755"), + }; + } }); #}}} hook(type => "getsetup", id => "svn", call => sub { #{{{ return svnrepo => { type => "string", - default => "", example => "/svn/wiki", description => "subversion repository location", safe => 0, # path @@ -31,14 +39,27 @@ hook(type => "getsetup", id => "svn", call => sub { #{{{ }, svnpath => { type => "string", - default => "trunk", + example => "trunk", description => "path inside repository where the wiki is located", safe => 0, # paranoia rebuild => 0, }, + svn_wrapper => { + type => "string", + example => "/svn/wikirepo/hooks/post-commit", + description => "svn post-commit executable to generate", + safe => 0, # file + rebuild => 0, + }, + svn_wrappermode => { + type => "string", + example => '04755', + description => "mode for svn_wrapper (can safely be made suid)", + safe => 0, + rebuild => 0, + }, historyurl => { type => "string", - default => "", example => "http://svn.example.org/trunk/[[file]]", description => "viewvc url to show file history ([[file]] substituted)", safe => 1, @@ -46,7 +67,6 @@ hook(type => "getsetup", id => "svn", call => sub { #{{{ }, diffurl => { type => "string", - default => "", example => "http://svn.example.org/trunk/[[file]]?root=wiki&r1=[[r1]]&r2=[[r2]]", description => "viewvc url to show a diff ([[file]], [[r1]], and [[r2]] substituted)", safe => 1, diff --git a/IkiWiki/Rcs/tla.pm b/IkiWiki/Rcs/tla.pm index 549e9f52d..53c198032 100644 --- a/IkiWiki/Rcs/tla.pm +++ b/IkiWiki/Rcs/tla.pm @@ -6,11 +6,36 @@ use warnings; use strict; use IkiWiki; +hook(type => "checkconfig", id => "tla", call => sub { #{{{ + if (! defined $config{diffurl}) { + $config{diffurl}=""; + } + if (exists $config{tla_wrapper}) { + push @{$config{wrappers}}, { + wrapper => $config{tla_wrapper}, + wrappermode => (defined $config{tla_wrappermode} ? $config{tla_wrappermode} : "06755"), + }; + } +}); #}}} + hook(type => "getsetup", id => "tla", call => sub { #{{{ return + tla_wrapper => { + type => "string", + #example => "", # TODO example + description => "tla post-commit executable to generate", + safe => 0, # file + rebuild => 0, + }, + tla_wrappermode => { + type => "string", + example => '06755', + description => "mode for tla_wrapper (can safely be made suid)", + safe => 0, + rebuild => 0, + }, historyurl => { type => "string", - default => "", #example => "", # TODO example description => "url to show file history ([[file]] substituted)", safe => 1, @@ -18,7 +43,6 @@ hook(type => "getsetup", id => "tla", call => sub { #{{{ }, diffurl => { type => "string", - default => "", #example => "", # TODO example description => "url to show a diff ([[file]] and [[rev]] substituted)", safe => 1, diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 262d49479..92f1eadb5 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -48,7 +48,13 @@ sub load ($) { # {{{ $config{$c}=IkiWiki::possibly_foolish_untaint($setup{$c}); } elsif (ref $setup{$c} eq 'ARRAY') { - $config{$c}=[map { IkiWiki::possibly_foolish_untaint($_) } @{$setup{$c}}] + if ($c eq 'wrappers') { + # backwards compatability code + $config{$c}=$setup{$c}; + } + else { + $config{$c}=[map { IkiWiki::possibly_foolish_untaint($_) } @{$setup{$c}}] + } } elsif (ref $setup{$c} eq 'HASH') { foreach my $key (keys %{$setup{$c}}) { @@ -60,6 +66,14 @@ sub load ($) { # {{{ $config{$c}=undef; } } + + if (exists $config{cgi_wrapper}) { + push @{$config{wrappers}}, { + cgi => 1, + wrapper => $config{cgi_wrapper}, + wrappermode => (defined $config{cgi_wrappermode} ? $config{cgi_wrappermode} : "06755"), + }; + } } #}}} sub dump ($) { #{{{ |