capistrano-scm-bamboo 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module Capistrano
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def load_result
|
17
|
-
response = Typhoeus::Request.get("#{repository}/result/#{plan_key}/#{variable(:build_number)}.json?expand=artifacts", :
|
17
|
+
response = Typhoeus::Request.get("#{repository}/result/#{plan_key}/#{variable(:build_number)}.json?expand=artifacts", :userpwd => "#{variable(:scm_username)}:#{variable(:scm_passphrase)}")
|
18
18
|
result = JSON.parse(response.body)
|
19
19
|
end
|
20
20
|
|
@@ -49,12 +49,14 @@ module Capistrano
|
|
49
49
|
|
50
50
|
# now do clever hackiness to detect whether this is a directory to be synced, or a single inline file/attachment
|
51
51
|
artifact_headers = Typhoeus::Request.head(artifactUrl).headers_hash
|
52
|
-
|
53
|
-
|
54
|
-
if (artifact_content_disposition.empty?)
|
52
|
+
|
53
|
+
if (!artifact_headers.include?("Content-Disposition"))
|
55
54
|
@artifact_name = variable(:artifact)
|
56
55
|
%Q{TMPDIR=`mktemp -d -t tmp.XXXXXXXXXX` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} && mv artifact/#{plan_key}/shared/build-#{build_actual}/#{variable(:artifact)}/ "#{destination}" && rm -rf "$TMPDIR"}
|
57
56
|
else
|
57
|
+
# if there's a content disposition of attachment, downolad the file directly. if inline, then ?. if no content disposition, then wget the whole directory.
|
58
|
+
artifact_content_disposition = artifact_headers["Content-Disposition"]
|
59
|
+
|
58
60
|
# get the filename
|
59
61
|
@artifact_name = artifact_content_disposition.match(/filename="(.*?)"/)[1]
|
60
62
|
%Q{TMPDIR=`mktemp -d -t tmp.XXXXXXXXXX` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} -O #{@artifact_name} && mkdir #{destination} && mv #{@artifact_name} "#{destination}/" && rm -rf "$TMPDIR"}
|