diff options
author | jrayhawk+piny.be@omgwallhack.org <jrayhawk@piny.svcs.cs.pdx.edu> | 2010-08-07 04:46:06 -0700 |
---|---|---|
committer | jrayhawk+piny.be@omgwallhack.org <jrayhawk@piny.svcs.cs.pdx.edu> | 2010-08-07 04:46:06 -0700 |
commit | 59892ab382d643c294ca7383eec2e1e658fdc783 (patch) | |
tree | 4a899deebc027a4fbd68b9b5b3d7afecd56ef467 /usr | |
parent | 22baf8269191eac1322af38abb9bf42eb5d3a01c (diff) | |
parent | fa904279c38a28fd95af00012b4ebfa354b9e34e (diff) | |
download | piny-code-59892ab382d643c294ca7383eec2e1e658fdc783.tar.gz piny-code-59892ab382d643c294ca7383eec2e1e658fdc783.zip |
Merge branch 'master' of git+ssh://piny.be/srv/git/piny-code
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/libpiny/debian/changelog | 7 | ||||
-rw-r--r-- | usr/src/libpiny/debian/control | 2 | ||||
-rw-r--r-- | usr/src/libpiny/lib/Piny/Repo.pm | 44 |
3 files changed, 48 insertions, 5 deletions
diff --git a/usr/src/libpiny/debian/changelog b/usr/src/libpiny/debian/changelog index 3dcd6c4..859caa4 100644 --- a/usr/src/libpiny/debian/changelog +++ b/usr/src/libpiny/debian/changelog @@ -1,3 +1,10 @@ +libpiny-perl (0.12) unstable; urgency=low + + * Support for per-repo configuration in the git config, section piny. + * Support for per-repo custom http/https base URLs. + + -- Julian Blake Kongslie <jblake@omgwallhack.org> Sun, 01 Aug 2010 20:07:44 -0700 + libpiny-perl (0.11) unstable; urgency=low * Destroying dead repos. diff --git a/usr/src/libpiny/debian/control b/usr/src/libpiny/debian/control index a626cd8..04f501e 100644 --- a/usr/src/libpiny/debian/control +++ b/usr/src/libpiny/debian/control @@ -7,7 +7,7 @@ Standards-version: 3.8.4 Package: libpiny-perl Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, libemail-valid-loose-perl, libmoose-perl, libmoosex-singleton-perl +Depends: ${perl:Depends}, ${misc:Depends}, libconfig-tiny-perl, libemail-valid-loose-perl, libmoose-perl, libmoosex-singleton-perl, libyaml-tiny-perl Description: Perl interface for the piny infrastructure This is a set of modules for accomplishing administrative tasks in the piny.be infrastructure. diff --git a/usr/src/libpiny/lib/Piny/Repo.pm b/usr/src/libpiny/lib/Piny/Repo.pm index 8b2045c..de8501b 100644 --- a/usr/src/libpiny/lib/Piny/Repo.pm +++ b/usr/src/libpiny/lib/Piny/Repo.pm @@ -6,6 +6,7 @@ package Piny::Repo; use Moose; use Moose::Util::TypeConstraints; +use Config::Tiny qw( ); use File::Find qw( find ); use File::Temp qw( ); use IO::Dir qw( ); @@ -162,6 +163,13 @@ has 'apache_config' => , init_arg => undef ); +has 'config' => + ( is => 'ro' + , isa => 'HashRef[Str]' + , lazy_build => 1 + , init_arg => undef + ); + # Public methods sub add_access { @@ -515,13 +523,21 @@ sub _build_ikiwiki_srcdir { sub _build_ikiwiki_url { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_url . $s->name; + if ( defined $s->config->{"http_url"} ) { + return $s->config->{"http_url"} . $s->name; + } else { + return Piny::Config->instance->ikiwiki_url . $s->name; + }; }; sub _build_ikiwiki_cgiurl { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_secure_url . "repos/" . $s->name . "/ikiwiki.cgi"; + if ( defined $s->config->{"https_url"} ) { + return $s->config->{"https_url"} . "repos/" . $s->name . "/ikiwiki.cgi"; + } else { + return Piny::Config->instance->ikiwiki_secure_url . "repos/" . $s->name . "/ikiwiki.cgi"; + }; }; sub _build_secure_path { @@ -539,13 +555,21 @@ sub _build_ikiwiki_cgipath { sub _build_ikiwiki_historyurl { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/log/[[file]]"; + if ( defined $s->config->{"https_url"} ) { + return $s->config->{"https_url"} . "cgit/" . $s->name . "/log/[[file]]"; + } else { + return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/log/[[file]]"; + }; }; sub _build_ikiwiki_diffurl { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/diff/?id=[[sha1_commit]]"; + if ( defined $s->config->{"https_url"} ) { + return $s->config->{"https_url"} . "cgit/" . $s->name . "/diff/?id=[[sha1_commit]]"; + } else { + return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/diff/?id=[[sha1_commit]]"; + }; }; sub _build_apache_config { @@ -554,6 +578,18 @@ sub _build_apache_config { return "<Directory " . $s->secure_path . ">\n AuthPAM_Enabled on\n AuthGROUP_Enabled on\n AuthPAM_FallThrough off\n AuthBasicAuthoritative off\n AuthType Basic\n AuthName \"User access to " . $s->name . " repository needed.\"\n Require group " . $s->group->name . "\n</Directory>\n"; }; +sub _build_config { + my ( $s ) = @_; + + my $c = Config::Tiny->read( $s->path . "/config" ); + + if ( defined $c and defined $c->{"piny"}) { + return $c->{"piny"}; + } else { + return { }; + }; +}; + # Moose boilerplate __PACKAGE__->meta->make_immutable; |