@@ -4,21 +4,32 @@ require 'fileutils'
44require 'tmpdir'
55require 'nokogiri'
66
7- %x(git checkout gh-pages)
8- %x(git pull origin gh-pages)
7+ ERROR_MESSAGE = "" "
8+ Error: Run the script like this: bundle exec script/enterprise-cutter [DATE] [VERSION]
9+ e.g. bundle exec script/enterprise-cutter 2014-07-8 11.10.340
10+ " ""
911
10- %x(git checkout -b add-backfilled-versions)
12+ if ARGV . length ==0
13+ abort "\n #{ ERROR_MESSAGE } \n \n "
14+ elsif ARGV . length >2
15+ abort "\n #{ ERROR_MESSAGE } \n \n "
16+ end
1117
12- # run the script like this: bundle exec script/enterprise-cutter [DATE] [VERSION]
13- # where [DATE] and [VERSION} are command-line arguments, defined below
1418date = ARGV [ 0 ] . dup # yyyy-mm-dd, like, 2014-07-08
1519version = ARGV [ 1 ] . dup # like, 11.10.340
1620
21+ BRANCH_NAME = "add-#{ version } -docs"
22+
23+ %x(git checkout gh-pages)
24+ %x(git pull origin gh-pages)
25+
26+ %x(git checkout -b#{ BRANCH_NAME } )
27+
1728temp_dir = Dir . mktmpdir
1829begin
1930%x(git checkout `git rev-list -n 1 --before="#{ date } " gh-pages`)
2031%x(cp -r *#{ temp_dir } )
21- %x(git checkoutadd-backfilled-versions )
32+ %x(git checkout#{ BRANCH_NAME } )
2233version . sub! ( /enterprise-/ , '' )
2334FileUtils . mkdir_p ( "enterprise/#{ version } " )
2435%x(cp -r#{ temp_dir } /* enterprise/#{ version } )