capistrano-scm-bamboo 1.0.1 → 1.0.3
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.
@@ -23,6 +23,7 @@ deploy your build artifact with Capistrano.
|
|
23
23
|
|
24
24
|
# specify any dependencies here; for example:
|
25
25
|
s.add_runtime_dependency "capistrano"
|
26
|
-
s.add_runtime_dependency "
|
26
|
+
s.add_runtime_dependency "json"
|
27
|
+
s.add_runtime_dependency "typhoeus"
|
27
28
|
s.add_development_dependency "rspec"
|
28
29
|
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'typhoeus'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
require 'capistrano/recipes/deploy/scm/base'
|
4
5
|
|
@@ -7,42 +8,32 @@ module Capistrano
|
|
7
8
|
module SCM
|
8
9
|
|
9
10
|
class Bamboo < Base
|
10
|
-
include HTTParty
|
11
|
-
base_uri repository
|
12
|
-
basic_auth scm_username, scm_passphrase
|
13
|
-
|
14
11
|
def head
|
15
|
-
|
12
|
+
"#{variable(:plan_key)}-#{variable(:build_number)}"
|
16
13
|
end
|
17
14
|
|
18
15
|
def query_revision(revision)
|
19
|
-
|
20
|
-
|
16
|
+
revision
|
17
|
+
# return revision if revision =~ /^\d+$/
|
18
|
+
# raise "invalid revision: #{revision}"
|
21
19
|
end
|
22
20
|
|
23
21
|
def checkout(revision, destination)
|
24
|
-
|
25
|
-
|
26
|
-
artifact = artifacts.select { |artifact| artifact["name"] ==
|
27
|
-
|
22
|
+
response = Typhoeus::Request.get("#{repository}/result/#{variable(:plan_key)}/#{variable(:build_number)}.json?expand=artifacts", :username => variable(:scm_username), :password => variable(:scm_passphrase))
|
23
|
+
result = JSON.parse(response.body)
|
24
|
+
artifact = result["artifacts"]["artifact"].select { |artifact| artifact["name"] == variable(:artifact) }
|
28
25
|
artifactUrl = artifact[0]["link"]["href"]
|
29
26
|
|
30
|
-
%Q{TMPDIR=`mktemp -d` &&
|
31
|
-
cd "$TMPDIR" &&
|
32
|
-
wget -m -nH #{artifact_url}' &&
|
33
|
-
unzip archive.zip &&
|
34
|
-
mv archive "#{destination}" &&
|
35
|
-
rm -rf "$TMPDIR"
|
36
|
-
}
|
27
|
+
%Q{TMPDIR=`mktemp -d` && cd $TMPDIR && wget -m -nH -q #{artifactUrl} && mv artifact "#{destination}" && rm -rf "$TMPDIR"}
|
37
28
|
end
|
38
29
|
|
39
30
|
alias_method :export, :checkout
|
40
31
|
|
41
|
-
def log(from, to=nil)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
32
|
+
# def log(from, to=nil)
|
33
|
+
# log_build_message(from, to)
|
34
|
+
# log_scm_message(from, to)
|
35
|
+
# 'true'
|
36
|
+
# end
|
46
37
|
|
47
38
|
def diff(from, to=nil)
|
48
39
|
logger.info 'bamboo does not support diff'
|
@@ -116,26 +107,6 @@ module Capistrano
|
|
116
107
|
# raise 'can not find a build suitable for deploy'
|
117
108
|
# end
|
118
109
|
|
119
|
-
# def get_build_number_from_rss_all_title(title)
|
120
|
-
# /#(\d+) \([^(]+$/.match(title)[1]
|
121
|
-
# end
|
122
|
-
|
123
|
-
# def get_build_number_from_rss_changelog_title(title)
|
124
|
-
# /^#(\d+) /.match(title)[1]
|
125
|
-
# end
|
126
|
-
|
127
|
-
# def rss_all
|
128
|
-
# begin
|
129
|
-
# @rss_all ||= open(repository + '/rssAll', auth_opts).read()
|
130
|
-
# rescue => e
|
131
|
-
# raise Capistrano::Error, "open url #{repository + '/rssAll'} failed: #{e}"
|
132
|
-
# end
|
133
|
-
# end
|
134
|
-
|
135
|
-
# def rss_changelog
|
136
|
-
# @rss_changelog ||= open(repository + '/rssChangelog', auth_opts).read()
|
137
|
-
# end
|
138
|
-
|
139
110
|
# def auth_opts
|
140
111
|
# if jenkins_username and jenkins_password
|
141
112
|
# {:http_basic_authentication => [jenkins_username, jenkins_password]}
|
@@ -175,11 +146,6 @@ module Capistrano
|
|
175
146
|
# end
|
176
147
|
# end
|
177
148
|
# end
|
178
|
-
|
179
|
-
# def jenkins_hostname
|
180
|
-
# @jenkins_hostname ||= URI.parse(repository).host
|
181
|
-
# end
|
182
|
-
|
183
149
|
end
|
184
150
|
end
|
185
151
|
end
|
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.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &70204008772920 !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: *
|
24
|
+
version_requirements: *70204008772920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: json
|
27
|
+
requirement: &70204008771920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,21 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70204008771920
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: typhoeus
|
38
|
+
requirement: &70204008771140 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70204008771140
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: rspec
|
38
|
-
requirement: &
|
49
|
+
requirement: &70204008770700 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,7 +54,7 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70204008770700
|
47
58
|
description: ! "\nWith this plugin, you can use Bamboo build artifacts as a repository,
|
48
59
|
and\ndeploy your build artifact with Capistrano.\n "
|
49
60
|
email:
|