Skip to content

Commit d17b878

Browse files
committed
Usability updates to enterprise-cutter script
Before I forget.
1 parent a9a6bf3 commit d17b878

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

script/enterprise-cutter

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,32 @@ require 'fileutils'
44
require 'tmpdir'
55
require '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
1418
date = ARGV[0].dup # yyyy-mm-dd, like, 2014-07-08
1519
version = 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+
1728
temp_dir = Dir.mktmpdir
1829
begin
1930
%x(git checkout `git rev-list -n 1 --before="#{date}" gh-pages`)
2031
%x(cp -r * #{temp_dir})
21-
%x(git checkout add-backfilled-versions)
32+
%x(git checkout #{BRANCH_NAME})
2233
version.sub!(/enterprise-/, '')
2334
FileUtils.mkdir_p("enterprise/#{version}")
2435
%x(cp -r #{temp_dir}/* enterprise/#{version})

0 commit comments

Comments
 (0)