Created
April 26, 2015 08:53
-
-
Save mishin/5a7e7b9b3cbfe5a210eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Modern::Perl; | |
| use Git::Repository; | |
| use File::Slurp qw( :edit ); | |
| my $url = 'https://github.com/mishin/perldoc-ru.git'; | |
| my $dir = '/home/mishin/github/test_repo'; | |
| #Git::Repository->run( clone => $url => $dir ); | |
| my $r = Git::Repository->new( work_tree => $dir ); | |
| use DateTime; | |
| use DateTime::Format::Strptime; | |
| my $dt = DateTime->new( | |
| year => 2015, | |
| month => 02, | |
| day => 07, | |
| hour => 16, | |
| minute => 12, | |
| second => 47, | |
| nanosecond => 500000000, | |
| time_zone => 'Europe/Moscow', | |
| ); | |
| #'Fri Jul 26 19:34:15 2013 +0200'; | |
| my $formatter = | |
| DateTime::Format::Strptime->new( pattern => '%a %b %d %H:%M %Y %z' ); | |
| $dt->set_formatter($formatter); | |
| my $n = 1; | |
| for ( 1 .. 50 ) { | |
| #inplace edit | |
| edit_file { s/__NUMBER\d+__/__NUMBER${n}__/ } | |
| $dir . '/pod2-ru/POD2-RU/scripts/get_pod_one_liners.md'; | |
| say "iteration №${n}"; | |
| say 'edit ok'; | |
| $r->run( add => '.' ); | |
| say 'add ok'; | |
| my $date = $dt->_stringify(); | |
| $r->run( commit => '-m', "my $n commit message", "--date=$date" ); | |
| say 'commit ok'; | |
| $dt->add( days => 1 ); | |
| $n++; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment