Changeset 4695 for lang/perl/misc

Show
Ignore:
Timestamp:
01/16/08 16:02:35 (7 years ago)
Author:
tokuhirom
Message:

lang/perl/misc/pmsetup/tokuhirom-pmsetup: copied from yappo-pmsetup

Files:
1 copied

Legend:

Unmodified
Added
Removed
  • lang/perl/misc/pmsetup/tokuhirom-pmsetup

    r3889 r4695  
    99use Template; 
    1010use YAML; 
    11  
    12 my $path   = File::Spec->catfile($ENV{HOME}, "/.pmsetuprc"); 
    13 my $config = eval { YAML::LoadFile($path) } || {}; 
    14  
    15 my $save; 
    16 while (! $config->{author}) { 
    17     $config->{author} = prompt("Your name: ", ''); 
    18     $save++; 
    19 } 
    20  
    21 while (! $config->{email}) { 
    22     $config->{email} = prompt("Your email: ", ''); 
    23     $save++; 
    24 } 
    25  
    26 while (! $config->{scratch_repos}) { 
    27     $config->{scratch_repos} = prompt("Your svk base scratch DEPOTPATH: [//scratch]", ''); 
    28     unless ($config->{scratch_repos} =~ m{^//.}) { 
    29         delete $config->{scratch_repos}; 
    30         next; 
    31     } 
    32     $save++; 
    33 } 
    34  
    35 while (! $config->{mirror_repos}) { 
    36     $config->{mirror_repos} = prompt("Your svk base mirror DEPOTPATH: [//mirror]", ''); 
    37     unless ($config->{mirror_repos} =~ m{^//.}) { 
    38         delete $config->{mirror_repos}; 
    39         next; 
    40     } 
    41     $save++; 
    42 } 
    43  
    44 while (! -e $config->{workdir}) { 
    45     $config->{workdir} = prompt("Your workdir:", "$ENV{HOME}/tmp"); 
    46     mkdir $config->{workdir}, 0777; 
    47     $save++; 
    48 } 
     11use Config::Pit; 
     12 
     13my $config = pit_get('pmsetup', require => { 
     14    author => 'Tokuhiro Matsuno', 
     15    email => 'tokuhirom AAJKLFJEF GMAIL COM', 
     16}); 
    4917 
    5018my $modname = shift @ARGV or die "Usage: $0 module\n"; 
     
    5321write_plugin_files($modname, $config); 
    5422 
    55 END { 
    56     YAML::DumpFile($path, $config) if $save; 
    57 } 
    58  
    5923sub write_plugin_files { 
    6024    my($module, $config) = @_; 
    6125 
    62     my $svk = prompt("import to SVK? [yN] ", 'n'); 
    6326    my $coderepos = prompt("CodeRepos friendly? [Yn] ", 'y'); 
    6427 
     
    7235    mkdir $dist, 0777; 
    7336    chdir $dist; 
    74     if ($svk =~ /[Yy]/ || $coderepos =~ /[Yy]/ ) { 
    75         mkdir $_, 0777 for (qw/ trunk tags branches /); 
    76         chdir 'trunk'; 
    77     } 
     37    mkdir $_, 0777 for (qw/ trunk tags branches /); 
     38    chdir 'trunk'; 
    7839 
    7940    my @template = YAML::Load(join '', <DATA>); 
     
    9960    !system 'make manifest' or die $?; 
    10061    !system 'make distclean' or die $?; 
    101  
    102     return unless $svk =~ /[Yy]/; 
    103     chdir '..'; 
    104     system("svk import -m '$dist import' $config->{scratch_repos}/$dist"); 
    105     chdir '..'; 
    106     rmtree("$dist"); 
    107     system("svk co $config->{scratch_repos}/$dist/trunk $dist"); 
    10862} 
    10963 
     
    14599  all_from 'lib/[% path %]'; 
    146100 
    147   requires $_ for (qw/ /); 
     101  requires $_ for (qw/ 
     102  /); 
    148103 
    149104  build_requires 'Test::More'; 
     
    170125  [% config.author %] 
    171126  [% module %] 
     127  tokuhirom 
     128  AAJKLFJEF 
     129  GMAIL 
     130  COM 
     131  Tatsuhiko 
     132  Miyagawa 
    172133--- 
    173134file: t/98_perlcritic.t