summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2010-08-01 20:08:20 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2010-08-01 20:08:20 -0700
commitfa904279c38a28fd95af00012b4ebfa354b9e34e (patch)
tree761c056bbcad8559909f5c448fb4925bd5ec9a91 /usr
parent20c9aff1b372231e86d0f5c8b3e43e8d813bebbf (diff)
downloadpiny-code-fa904279c38a28fd95af00012b4ebfa354b9e34e.tar.gz
piny-code-fa904279c38a28fd95af00012b4ebfa354b9e34e.zip
Supporting per-repo config stuff.
Diffstat (limited to 'usr')
-rw-r--r--usr/src/libpiny/debian/changelog7
-rw-r--r--usr/src/libpiny/debian/control2
-rw-r--r--usr/src/libpiny/lib/Piny/Repo.pm44
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;