From: PHO Date: Sun, 7 Dec 2008 12:27:13 +0000 (+0900) Subject: Auto commit by The Sugar System. X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=sugar.git;a=commitdiff_plain;h=c478cc19985f964d464143253914ee067c3758c4 Auto commit by The Sugar System. --- diff --git a/GNUmakefile b/GNUmakefile index d79d0fa..ca56c88 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -13,5 +13,9 @@ commit: git add -A git commit -m 'Auto commit by The Sugar System.' git push + git log --stat --unified -1 --color -.PHONY: lint \ No newline at end of file +install: lint + perl ./tools/list-files.pl | perl ./tools/install.pl + +.PHONY: lint update commit install diff --git a/tools/find-changed.pl b/tools/find-changed.pl index 7f9e084..2183f5c 100644 --- a/tools/find-changed.pl +++ b/tools/find-changed.pl @@ -8,6 +8,8 @@ use File::Spec; use File::Compare; sub main { + my $found_updated; + while (defined(my $rel = <>)) { chomp $rel; my $saved = rel2saved($rel); @@ -23,6 +25,10 @@ sub main { print "M $rel\n"; } } + + if ($found_updated) { + exit 1; + } } main(); diff --git a/tools/install.pl b/tools/install.pl new file mode 100644 index 0000000..a515f4e --- /dev/null +++ b/tools/install.pl @@ -0,0 +1,31 @@ +use strict; +use warnings; +use Smart::Comments; +use lib 'tools'; +require 'utils.pl'; +use File::stat; +use File::Spec; +use File::Compare; +use File::Copy; + +sub main { + while (defined(my $rel = <>)) { + chomp $rel; + my $saved = rel2saved($rel); + next if !-e $saved; + + my $abs = File::Spec->rel2abs($rel, $ENV{HOME}); + + my $current_st = stat($abs); + my $saved_st = stat($saved); + + if ($current_st->mtime < $saved_st->mtime && + compare($abs, $saved) != 0) { + print "Copying $saved to $abs...\n"; + unlink $abs or die $!; + copy($saved, $abs) or die $!; + } + } +} + +main();