Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (32 sloc) 1.212 kb
72c0457 @miyagawa Implemented --list-plugins
authored
1 name 'git_site_perl';
2 description 'Hooks to keep site_perl in git';
3 author 'Tatsuhiko Miyagawa';
185b63b @miyagawa git_site_perl plugin
authored
4
5 use Config;
6 use Cwd;
7
8 my $site_perl = ($ENV{PERL_MM_OPT} =~ /INSTALL_BASE=(\S+)/)[0] || $Config{installsitelib};
9
da5f055 @miyagawa Implemented git init as plugin init hook.
authored
10 hook init => sub {
11 my $args = shift;
12
13 my $git_dir = File::Spec->catfile($site_perl, ".git");
14
15 unless (-e $git_dir && -w $site_perl) {
16 $args->{app}->diag("Initializing git repository for $site_perl\n");
17 my $cwd = Cwd::cwd();
18 if (chdir $site_perl) {
19 $args->{app}->run("git init") &&
20 $args->{app}->run("git add .") &&
4be6cb2 @miyagawa Kills Util:: functions which was the left over from the original
authored
21 $args->{app}->run("git commit -m " . $args->{app}->shell_quote("initial commit"));
da5f055 @miyagawa Implemented git init as plugin init hook.
authored
22 chdir $cwd;
23 }
185b63b @miyagawa git_site_perl plugin
authored
24 }
da5f055 @miyagawa Implemented git init as plugin init hook.
authored
25 };
185b63b @miyagawa git_site_perl plugin
authored
26
27 hook install_success => sub {
28 my $args = shift;
29
30 if (-e $site_perl && -w _) {
31 my $cwd = Cwd::cwd();
32 chdir $site_perl or die $!;
5fd61f6 @miyagawa message module name and versions
authored
33 my $message = "$args->{meta}->{name} $args->{meta}->{version} ($args->{module})";
81c6fbc @miyagawa Changed plugin APIs so the plugin can spcify the order (which falls
authored
34 $args->{app}->diag("Committing updates in $site_perl to git...\n");
185b63b @miyagawa git_site_perl plugin
authored
35 $args->{app}->run("git add .") &&
4be6cb2 @miyagawa Kills Util:: functions which was the left over from the original
authored
36 $args->{app}->run("git commit -m " . $args->{app}->shell_quote($message));
185b63b @miyagawa git_site_perl plugin
authored
37 chdir $cwd;
38 }
39 };
Something went wrong with that request. Please try again.