Skip to content

Commit 1114fee

Browse files
committed
Make the archived content package name configurable
1 parent 0231eaa commit 1114fee

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

libs/basho_rake_deploy.rb

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,59 @@
11
###########################
22
# Deploy rules and helpers
33

4+
$archive_name = "archived_docs.basho.com.tar.bz2"
5+
46
def do_fetch_archived_content()
57
# Fetch and extract the archived content that we want to survive from the
68
# Middleman website.
79
puts("Verifying archived content...")
810
# Verify that the tar.bz2 is present.
9-
if (not File.file?(File.join(Dir.pwd, "archived_docs.basho.com.tar.bz2")))
11+
if (not File.file?(File.join(Dir.pwd, "#{$archive_name}")))
1012
if (`which wget`.empty?)
1113
# If we don't have wget. Error out.
12-
Kernel.abort("ERROR: archived_docs.basho.com.tar.bz2 was not found, "\
13-
"and this system doesn't have access to `wget`.\n"\
14+
Kernel.abort("ERROR: #{$archive_name} was not found, and this system "\
15+
"does not have access to `wget`.\n"\
1416
" Please either install `wget` and re-run this "\
1517
"deploy, or manually download the file from the below "\
1618
"address and place it into this directory.\n"\
17-
" http://s3.amazonaws.com/downloads.basho.com/documentation_content/archived_docs.basho.com.tar.bz2")
19+
" http://s3.amazonaws.com/downloads.basho.com/documentation_content/#{$archive_name}")
1820
else
1921
# We have wget, but not the file. Fetch it.
20-
puts(" Using wget to fetch archived_docs.basho.com.tar.bz2 "\
22+
puts(" Using wget to fetch #{$archive_name} "\
2123
"(this may take some time)...")
22-
successful = system('wget http://s3.amazonaws.com/downloads.basho.com/documentation_content/archived_docs.basho.com.tar.bz2')
24+
successful = system("wget http://s3.amazonaws.com/downloads.basho.com/documentation_content/#{$archive_name}")
25+
2326
if (not successful)
24-
Kernel.abort("ERROR: Failed to get archived_docs.basho.com.tar.bz2\n"\
27+
Kernel.abort("ERROR: Failed to get #{$archive_name}\n"\
2528
" Please download the file from the below "\
2629
"address and copy it into this directory.\n"\
27-
" http://s3.amazonaws.com/downloads.basho.com/documentation_content/archived_docs.basho.com.tar.bz2")
30+
" http://s3.amazonaws.com/downloads.basho.com/documentation_content/#{$archive_name}")
2831
end
2932
end
3033
end
3134

3235
# Verify the file is correct via an md5sum, unless NO_CHECK has been set
3336
if (ENV['NO_CHECK'] == "True")
34-
puts(" Skipping archived_docs.basho.com.tar.bz2 sha1 check. Good luck.")
37+
puts(" Skipping #{$archive_name} sha1 check. Good luck.")
3538
else
3639
if (`which md5sum`.empty?)
3740
# We don't have md5sum, and we want to perform a check. Error out.
3841
Kernel.abort("ERROR: This system does not have `md5sum`, so the "\
39-
"contents of archived_docs.basho.com.tar.bz2 cannot be "\
40-
"verified.\n"\
42+
"contents of #{$archive_name} cannot be verified.\n"\
4143
" Please install the md5sum tool (possibly named "\
4244
"md5sha1sum).\n"\
4345
" You may also re-run this script after running "\
4446
"`export NO_CHECK=\"True\"`, but it is **highly "\
4547
"recommended** that you install `md5sum` instead.")
4648
end
47-
web_md5 = Net::HTTP.get('s3.amazonaws.com', '/downloads.basho.com/documentation_content/archived_docs.basho.com.tar.bz2.md5').split(" ")[0]
48-
loc_md5 = `md5sum archived_docs.basho.com.tar.bz2`.split(" ")[0]
49+
web_md5 = Net::HTTP.get("s3.amazonaws.com", "/downloads.basho.com/documentation_content/#{$archive_name}.md5").split(" ")[0]
50+
loc_md5 = `md5sum #{$archive_name}`.split(" ")[0]
4951
if (web_md5 != loc_md5)
50-
Kernel.abort("ERROR: Fetch archived_docs.basho.com.tar.bz2 does not "\
51-
"match the expected md5sum.\n"\
52-
" Please remove the current "\
53-
"archived_docs.basho.com.tar.bz2, reset the contents of "\
54-
"the static/ directory (`git clean -xdf static; git "\
55-
"checkout -f static`), and re-run this script.")
52+
Kernel.abort("ERROR: Fetched #{$archive_name} does not match the "\
53+
"expected md5sum.\n"\
54+
" Please remove the current #{$archive_name}, reset "\
55+
"the contents of the static/ directory (`git clean -xdf "\
56+
"static; git checkout -f static`), and re-run this script.")
5657
end
5758
end
5859

@@ -71,13 +72,11 @@ def do_fetch_archived_content()
7172
(not File.exist?("static/shared")) )
7273

7374
if (should_extract)
74-
puts("Extracting archived_docs.basho.com.tar.bz2 (this may take a lot "\
75-
"of time)...")
76-
successful = system('tar -xjf archived_docs.basho.com.tar.bz2 -C static')
75+
puts("Extracting #{$archive_name} (this may take a lot of time)...")
76+
successful = system("tar -xjf #{$archive_name} -C static")
7777

7878
if (not successful)
79-
Kernel.abort("ERROR: archived_docs.basho.com.tar.bz2 failed to "\
80-
"extract.\n"\
79+
Kernel.abort("ERROR: #{$archive_name} failed to extract.\n"\
8180
" I... actually don't know why. Not sure how to "\
8281
"extract error messages from this system call.")
8382
end

0 commit comments

Comments
 (0)