[前][次][番号順一覧][スレッド一覧]

ruby-changes:43263

From: nobu <ko1@a...>
Date: Thu, 9 Jun 2016 15:31:57 +0900 (JST)
Subject: [ruby-changes:43263] nobu:r55337 (trunk): ifchange: make target directory

nobu	2016-06-09 15:31:54 +0900 (Thu, 09 Jun 2016)

  New Revision: 55337

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55337

  Log:
    ifchange: make target directory
    
    * tool/ifchange: make target directory if it does not exist with
      its parent directories.

  Modified files:
    trunk/ChangeLog
    trunk/tool/ifchange
Index: tool/ifchange
===================================================================
--- tool/ifchange	(revision 55336)
+++ tool/ifchange	(revision 55337)
@@ -61,25 +61,25 @@ if [ "$color" = always -o \( "$color" = https://github.com/ruby/ruby/blob/trunk/tool/ifchange#L61
     unset msg_begin
 fi
 
+targetdir=
+case "$target" in */*) targetdir=`dirname "$target"`;; esac
 if [ -f "$target" -a ! -${empty:+f}${empty:-s} "$temp" ] || cmp "$target" "$temp" >/dev/null 2>&1; then
     echo "$target ${msg_unchanged}unchanged${msg_reset}"
     rm -f "$temp"
 else
     echo "$target ${msg_updated}updated${msg_reset}"
-    [ x"${keepsuffix}" = x ] || mv -f "$target" "${target}${keepsuffix}"
+    [ x"${targetdir}" = x -o -d "${targetdir}" ] || mkdir -p "${targetdir}"
+    [ x"${keepsuffix}" != x -a -f "$target" ] && mv -f "$target" "${target}${keepsuffix}"
     mv -f "$temp" "$target"
 fi
 
 if [ -n "${timestamp}" ]; then
     if [ x"${timestamp}" = x. ]; then
-	case "$target" in
-	    */*)
-		timestamp=`dirname "$target"`/.time.`basename "$target"`
-		;;
-	    *)
-		timestamp=.time."$target"
-		;;
-	esac
+	if [ x"$targetdir" = x. ]; then
+	    timestamp=.time."$target"
+	else
+	    timestamp="$targetdir"/.time.`basename "$target"`
+	fi
     fi
     : > "$timestamp"
 fi
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55336)
+++ ChangeLog	(revision 55337)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Thu Jun  9 15:31:09 2016  Nobuyoshi Nakada  <nobu@r...>
+Thu Jun  9 15:31:52 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* tool/ifchange: make target directory if it does not exist with
+	  its parent directories.
 
 	* win32/ifchange.bat: drop support for command.com used on old
 	  systems.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]