capistrano-scm-bamboo 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module Scm
3
3
  module Bamboo
4
- VERSION = "1.3.2"
4
+ VERSION = "1.4.0"
5
5
  end
6
6
  end
7
7
  end
@@ -41,15 +41,27 @@ module Capistrano
41
41
  end
42
42
 
43
43
  artifactUrl = artifact[0]["link"]["href"]
44
-
45
44
  build_actual = result["number"]
45
+
46
+ # now do clever hackiness to detect whether this is a directory to be synced, or a single inline file/attachment
47
+ artifact_headers = Typhoeus::Request.head(artifactUrl).headers_hash
48
+ # if there's a content disposition of attachment, downolad the file directly. if inline, then ?. if no content disposition, then wget the whole directory.
49
+ artifact_content_disposition = artifact_headers["Content-Disposition"]
50
+ if (artifact_content_disposition.empty?)
51
+ %Q{TMPDIR=`mktemp -d` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} && mv artifact/#{plan_key}/shared/build-#{build_actual}/#{variable(:artifact)}/ "#{destination}" && rm -rf "$TMPDIR"}
52
+ else
53
+ # get the filename
54
+ f = artifact_content_disposition.match(/filename="(.*?)"/)[1]
55
+ %Q{TMPDIR=`mktemp -d` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} -O #{f} && mkdir #{destination} && mv #{f} "#{destination}/" && rm -rf "$TMPDIR"}
56
+ end
46
57
 
47
- %Q{TMPDIR=`mktemp -d` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} && mv artifact/#{plan_key}/shared/build-#{build_actual}/#{variable(:artifact)}/ "#{destination}" && rm -rf "$TMPDIR"}
58
+ ## previous artifact copy when things were only directories. for posterity only.
59
+ # %Q{TMPDIR=`mktemp -d` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} && mv artifact/#{plan_key}/shared/build-#{build_actual}/#{variable(:artifact)}/ "#{destination}" && rm -rf "$TMPDIR"}
48
60
  rescue ArgumentError => e
49
61
  logger.log(Logger::IMPORTANT, e.message)
50
62
  exit
51
63
  end
52
-
64
+
53
65
  def plan_key
54
66
  if (variable(:plan_key))
55
67
  variable(:plan_key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-scm-bamboo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70097708581460 !ruby/object:Gem::Requirement
16
+ requirement: &70101407957540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70097708581460
24
+ version_requirements: *70101407957540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70097695945920 !ruby/object:Gem::Requirement
27
+ requirement: &70101410059920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70097695945920
35
+ version_requirements: *70101410059920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: typhoeus
38
- requirement: &70097695945500 !ruby/object:Gem::Requirement
38
+ requirement: &70101410059500 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70097695945500
46
+ version_requirements: *70101410059500
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70097695945080 !ruby/object:Gem::Requirement
49
+ requirement: &70101410059080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70097695945080
57
+ version_requirements: *70101410059080
58
58
  description: ! "\nWith this plugin, you can use Bamboo build artifacts as a repository,
59
59
  and\ndeploy your build artifact with Capistrano.\n "
60
60
  email: