root/lang/perl/Module-Setup/trunk/lib/Module/Setup/Plugin/VC/Git.pm @ 20640

Revision 20640, 1.0 kB (checked in by dann, 6 years ago)

we need Makefile.PL

Line 
1package Module::Setup::Plugin::VC::Git;
2use strict;
3use warnings;
4use base 'Module::Setup::Plugin';
5
6use Path::Class;
7
8sub register {
9    my($self, ) = @_;
10    $self->add_trigger( check_skeleton_directory => \&check_skeleton_directory );
11    $self->add_trigger( append_template_file     => sub { $self->append_template_file(@_) } );
12}
13
14sub check_skeleton_directory {
15    my $self = shift;
16    return unless $self->dialog("Git init? [Yn] ", 'y') =~ /[Yy]/;
17
18    !system 'git init' or die $?;
19    !system "git add .gitignore" or die $?;
20
21    my $dir = Path::Class::Dir->new('.');
22    while (my $path = $dir->next) {
23        next if $path eq '.' || $path eq '..' || $path eq '.git' || $path eq '.gitignore';
24        system 'git', 'add', $path;
25    }
26    !system 'git commit -m "initial commit"' or die $?;
27}
28
291;
30
31# original http://gist.github.com/13374 by dann
32
33__DATA__
34
35---
36 file: .gitignore
37 template: |
38  cover_db
39  META.yml
40  Makefile
41  blib
42  inc
43  pm_to_blib
44  MANIFEST
45  Makefile.old
Note: See TracBrowser for help on using the browser.