capistrano-scm-jenkins 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04edc4112c4c07cb04de8d2464b3035f5d74a9c4
4
- data.tar.gz: 3604822a8ee58b02d3d1e2ba179ed416845c92f2
3
+ metadata.gz: 330c9690618bd67702215220bd3405cca27dc320
4
+ data.tar.gz: 321660d2fc8ced158e36f833d3706358a3fab91d
5
5
  SHA512:
6
- metadata.gz: e485c60bc446f0ad1ab649eba89316cb554d016d49a8476fa21f91c47f54406d0ab4a15b2ce1ce9891520435001bceef544de1186b3c0d4979a755b7bccba6b6
7
- data.tar.gz: f892d06dc57bd330c3fb02badcae65c06606d3d727202d6e72cbd820d6d3a43b2379630654eca66b5cbeb82c8ed4012059e66490e43d2182b4439adaa965cf3e
6
+ metadata.gz: 33b8df5ecd0997e78c1518a954172889c5179b83fc2afbd20f160b628c1d7cbeb5adcabbfe5ec2b6a4d3ce012c0cc00a3944964b76275043f73b9faa8441a761
7
+ data.tar.gz: 678b9004ac4fa0b71b5dd066f0ae3a3daeb75c1e6e7b389dcf0fe27603e3ab7de3cd61a74e523f0dcfbbaa089c3398dad24709bccad818390cd3017fc98a8cac
@@ -1,12 +1,12 @@
1
1
  language: ruby
2
2
  branches:
3
- only:
4
- - master
3
+ only:
4
+ - master
5
5
  rvm:
6
- - 1.9.2
7
- - 1.9.3
8
- - 2.0.0
9
- - 2.1.0
10
- - jruby-19mode
11
- - rbx
12
- - ree
6
+ - 1.9.2
7
+ - 1.9.3
8
+ - 2.0.0
9
+ - 2.1.0
10
+ - jruby-19mode
11
+ - rbx-2
12
+ - ree
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-scm-jenkins (0.3.3)
4
+ capistrano-scm-jenkins (0.4.0)
5
5
  capistrano (~> 3.2.1)
6
6
 
7
7
  GEM
@@ -11,8 +11,9 @@ GEM
11
11
  i18n
12
12
  rake (>= 10.0.0)
13
13
  sshkit (~> 1.3)
14
+ colorize (0.7.3)
14
15
  diff-lcs (1.2.5)
15
- i18n (0.6.9)
16
+ i18n (0.6.11)
16
17
  metaclass (0.0.4)
17
18
  mocha (1.1.0)
18
19
  metaclass (~> 0.0.1)
@@ -20,21 +21,22 @@ GEM
20
21
  net-ssh (>= 2.6.5)
21
22
  net-ssh (2.9.1)
22
23
  rake (10.3.2)
23
- rspec (2.14.1)
24
- rspec-core (~> 2.14.0)
25
- rspec-expectations (~> 2.14.0)
26
- rspec-mocks (~> 2.14.0)
27
- rspec-core (2.14.8)
28
- rspec-expectations (2.14.5)
29
- diff-lcs (>= 1.1.3, < 2.0)
30
- rspec-mocks (2.14.6)
31
- sshkit (1.4.0)
24
+ rspec (3.1.0)
25
+ rspec-core (~> 3.1.0)
26
+ rspec-expectations (~> 3.1.0)
27
+ rspec-mocks (~> 3.1.0)
28
+ rspec-core (3.1.7)
29
+ rspec-support (~> 3.1.0)
30
+ rspec-expectations (3.1.2)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.1.0)
33
+ rspec-mocks (3.1.3)
34
+ rspec-support (~> 3.1.0)
35
+ rspec-support (3.1.2)
36
+ sshkit (1.5.1)
37
+ colorize
32
38
  net-scp (>= 1.1.2)
33
39
  net-ssh (>= 2.8.0)
34
- term-ansicolor
35
- term-ansicolor (1.3.0)
36
- tins (~> 1.0)
37
- tins (1.3.0)
38
40
 
39
41
  PLATFORMS
40
42
  ruby
data/NEWS.md CHANGED
@@ -1,7 +1,15 @@
1
- ## 0.3.2 (2014-05-23)
1
+ ## 0.4.0 (2014-10-29)
2
+
3
+ * Change default for `:jenkins_artifact_file` to `*zip*/archive.zip` (h/t @lostintime on #22)
4
+
5
+ ## 0.3.3 (2014-05-23)
2
6
 
3
7
  * Fix bypassing of SSL verification using cURL (thanks @xsk)
4
8
 
9
+ ## 0.3.2 (2014-05-21)
10
+
11
+ * Properly bump gem version (same changes as v0.3.1)
12
+
5
13
  ## 0.3.1 (2014-05-21)
6
14
 
7
15
  * Ensure gemspec dependencies are properly set for Cap ~> 3.2.1
data/README.md CHANGED
@@ -49,6 +49,9 @@ set :jenkins_pass, 'pass'
49
49
  # Deploy a single file.
50
50
  # set :jenkins_artifact_file, 'my-api/target/webapp.war'
51
51
  #
52
+ # Deploy a specific build number
53
+ # set(:jenkins_build_number, ENV['REVISION']) if ENV['REVISION']
54
+ #
52
55
  # Bypass SSL verification
53
56
  # set :jenkins_insecure, true
54
57
  ```
@@ -1,3 +1,3 @@
1
1
  module CapistranoScmJenkins
2
- VERSION = '0.3.3'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -63,31 +63,36 @@ class Capistrano::Jenkins < Capistrano::SCM
63
63
  end
64
64
  end
65
65
 
66
+ def artifact_is_zip?
67
+ artifact_ext == ".zip"
68
+ end
69
+
70
+ def artifact_file_opt
71
+ fetch(:jenkins_artifact_file, "*zip*/archive.zip")
72
+ end
73
+
66
74
  def artifact_filename
67
- @artifact_filename = File.basename(fetch(:jenkins_artifact_file))
75
+ @artifact_filename = File.basename(artifact_file_opt)
68
76
  end
69
77
 
70
78
  def artifact_ext
71
79
  @artifact_ext = File.extname(artifact_filename)
72
80
  end
73
81
 
74
- def artifact_url
75
- artifact = fetch(:jenkins_artifact_file)
76
- artifact_url_prefix = "#{repo_url}/lastBuild/artifact"
82
+ def artifact_build_number_opt
83
+ fetch(:jenkins_build_number, 'lastBuild')
84
+ end
77
85
 
78
- if artifact
79
- "#{artifact_url_prefix}/#{artifact}"
80
- else
81
- "#{artifact_url_prefix}/*zip*/archive.zip"
82
- end
86
+ def artifact_build_number
87
+ @artifact_build_number ||= jenkins_api_res['number']
83
88
  end
84
89
 
85
- def last_build_number
86
- @last_build_number = jenkins_api_res['number']
90
+ def artifact_url
91
+ "#{repo_url}/#{artifact_build_number_opt}/artifact/#{artifact_file_opt}"
87
92
  end
88
93
 
89
94
  def jenkins_api_res
90
- jenkins_job_api_url = "#{repo_url}/lastBuild/api/json"
95
+ jenkins_job_api_url = "#{repo_url}/#{artifact_build_number_opt}/api/json"
91
96
 
92
97
  res ||= open(jenkins_job_api_url, auth_opts.merge(ssl_opts)).read
93
98
 
@@ -107,6 +112,12 @@ class Capistrano::Jenkins < Capistrano::SCM
107
112
  build_status = res['result'].downcase
108
113
 
109
114
  if allowed_statuses.include? build_status
115
+ if artifact_is_zip?
116
+ unless test! "hash unzip 2>/dev/null"
117
+ abort 'unzip required, but not found'
118
+ end
119
+ end
120
+
110
121
  true
111
122
  else
112
123
  abort 'Latest build status isn\'t green!'
@@ -128,11 +139,21 @@ class Capistrano::Jenkins < Capistrano::SCM
128
139
  end
129
140
 
130
141
  def release
131
- context.execute :cp, "#{fetch(:application)}#{artifact_ext}", release_path
142
+ downloaded_artifact = "#{fetch(:application)}#{artifact_ext}"
143
+
144
+ if artifact_is_zip?
145
+ # is an archive - unpack and deploy
146
+ context.execute :rm, "-rf \"out/\""
147
+ context.execute :unzip, "\"#{downloaded_artifact}\" -d out/"
148
+ context.execute :mv, "out/#{fetch(:jenkins_artifact_path, "*")} \"#{release_path}\""
149
+ context.execute :rm, "-rf \"out/\""
150
+ else
151
+ context.execute :cp, downloaded_artifact, release_path
152
+ end
132
153
  end
133
154
 
134
155
  def fetch_revision
135
- "build #{last_build_number}"
156
+ "build-#{artifact_build_number}"
136
157
  end
137
158
  end
138
159
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-scm-jenkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LI Daobing
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-23 00:00:00.000000000 Z
12
+ date: 2014-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano