|
Revision 20640, 1.0 kB
(checked in by dann, 5 years ago)
|
|
we need Makefile.PL
|
| Line | |
|---|
| 1 | package Module::Setup::Plugin::VC::Git; |
|---|
| 2 | use strict; |
|---|
| 3 | use warnings; |
|---|
| 4 | use base 'Module::Setup::Plugin'; |
|---|
| 5 | |
|---|
| 6 | use Path::Class; |
|---|
| 7 | |
|---|
| 8 | sub 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 | |
|---|
| 14 | sub 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 | |
|---|
| 29 | 1; |
|---|
| 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 |
|---|