ruby-changes:28703
From: nobu <ko1@a...>
Date: Wed, 15 May 2013 16:52:53 +0900 (JST)
Subject: [ruby-changes:28703] nobu:r40755 (trunk): ifchange: --keep option
nobu 2013-05-15 16:51:32 +0900 (Wed, 15 May 2013) New Revision: 40755 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40755 Log: ifchange: --keep option * tool/ifchange (--keep=suffix): new option for debug. Modified files: trunk/tool/ifchange Index: tool/ifchange =================================================================== --- tool/ifchange (revision 40754) +++ tool/ifchange (revision 40755) @@ -2,6 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ifchange#L2 # usage: ifchange target temporary timestamp= +keepsuffix= until [ "$0" = 0 ]; do case "$1" in --timestamp) @@ -10,6 +11,12 @@ until [ "$0" = 0 ]; do https://github.com/ruby/ruby/blob/trunk/tool/ifchange#L11 --timestamp=*) timestamp=`expr \( "$1" : '[^=]*=\(.*\)' \)` ;; + --keep) + keepsuffix=.old + ;; + --keep=*) + keepsuffix=`expr \( "$1" : '[^=]*=\(.*\)' \)` + ;; *) break ;; @@ -30,6 +37,7 @@ if cmp "$target" "$temp" >/dev/null 2>&1 https://github.com/ruby/ruby/blob/trunk/tool/ifchange#L37 rm -f "$temp" else echo "$target updated" + ${keepsuffix:+ mv -f "$target" "${target}${keepsuffix}" } mv -f "$temp" "$target" fi -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/