Skip to content

Commit

Permalink
set description for repos on git server
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jun 7, 2012
1 parent aff97d3 commit c27eb13
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion grgit.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Carp;
use LWP::Simple qw{get};
use YAML;
use Sys::Hostname;
#use Data::Dumper;

Readonly my $GIT_SERVER => 'git.greptilian.com';
Expand All @@ -19,6 +20,9 @@
Readonly my $DESCRIPTIONS => "http://$GIT_SERVER/?p=wiki.git;a=blob_plain;f=greptilian.com/git/repos.mdwn;hb=HEAD";
Readonly my $GIT_CMD => $ARGV[0] || 'pull';

my $hostname = hostname;
my $on_server = $hostname eq 'server1.greptilian.com' ? 1 : 0;

chdir($LOCAL_GIT_DIR) or croak "Couldn't cd to $LOCAL_GIT_DIR";

my $project_list = get($PROJECT_INDEX);
Expand All @@ -43,7 +47,19 @@
}

for my $project_bare (sort @projects) {
carp "No description for $project_bare at $DESCRIPTIONS" unless ${$proj_descriptions}{$project_bare};
my $desc_wiki = ${$proj_descriptions}{$project_bare};
if ($desc_wiki) {
if ($on_server) {
my $desc_local = "$PROJECT_DIR/$project_bare/description";
open(my $fh, ">", "$desc_local") or die "cannot open $desc_local: $!";
print $fh $desc_wiki;
close($fh) || warn "close failed: $!";

}
}
else {
carp "No description for $project_bare at $DESCRIPTIONS"
}
my ($project_local) = $project_bare =~ /^(.*?)[.]git/;
if ( chdir($project_local) ) {
printf( '%-30s', "$project_local... " );
Expand Down

0 comments on commit c27eb13

Please sign in to comment.