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/src/libpiny/lib/Piny/Repo.pm | |
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/src/libpiny/lib/Piny/Repo.pm')
-rw-r--r-- | usr/src/libpiny/lib/Piny/Repo.pm | 44 |
1 files changed, 40 insertions, 4 deletions
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; |