瀏覽代碼

improve demo date script, make part of build process

Adam Shaw 9 年之前
父節點
當前提交
bd549bdf8a
共有 2 個文件被更改,包括 27 次插入6 次删除
  1. 7 1
      bin/build-release.sh
  2. 20 5
      bin/update-demo-dates.sh

+ 7 - 1
bin/build-release.sh

@@ -8,13 +8,19 @@ cd "`dirname $0`/.."
 
 
 ./bin/require-clean-working-tree.sh
 ./bin/require-clean-working-tree.sh
 
 
-read -p "Have you already updated the changelog? (y/n): " updated_changelog
+read -p "Have you already updated the changelog? (y/N): " updated_changelog
 if [[ "$updated_changelog" != "y" ]]
 if [[ "$updated_changelog" != "y" ]]
 then
 then
 	echo "Go do that!"
 	echo "Go do that!"
 	exit 1
 	exit 1
 fi
 fi
 
 
+read -p "Would you like to update dates in the demos? (y/N): " update_demos
+if [[ "$update_demos" == "y" ]]
+then
+	./bin/update-demo-dates.sh
+fi
+
 read -p "Enter the new version number with no 'v' (for example '1.0.1'): " version
 read -p "Enter the new version number with no 'v' (for example '1.0.1'): " version
 if [[ ! "$version" ]]
 if [[ ! "$version" ]]
 then
 then

+ 20 - 5
bin/update-demo-dates.sh

@@ -1,15 +1,30 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
+# always immediately exit upon error
+set -e
+
+# start in project root
+cd "`dirname $0`/.."
+
+./bin/require-clean-working-tree.sh demos
+
 read -p "Enter new year (4 digits): " year
 read -p "Enter new year (4 digits): " year
 read -p "Enter new month (2 digits): " month
 read -p "Enter new month (2 digits): " month
-read -p "This will modify files in the demos folder, is that ok? (y/n): " yn
 
 
-if [[ $yn != "y" ]]
+echo "This will modify files in demos/ and commit them to the current branch."
+read -p "Is that ok? (y/N): " yn
+
+if [[ "$yn" != "y" ]]
 then
 then
-	exit
+	echo "Aborting."
+	exit 1
 fi
 fi
 
 
-find "`dirname $0`/../demos" -type f \( -name '*.html' -o -name '*.json' \) -print0 \
+find demos -type f \( -name '*.html' -o -name '*.json' \) -print0 \
 | xargs -0 sed -i '' -e "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]/$year-$month/g"
 | xargs -0 sed -i '' -e "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]/$year-$month/g"
 
 
-echo "DONE"
+# build the commit
+git add demos
+git commit -m "updated demo dates"
+
+echo "DONE"