capistrano-scm-jenkins 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA512:
3
+ metadata.gz: db7a5920ba131c19e129ae44d4e1937e4f9704b5b2a231b2543df68e7b44f605920d701f9a208c5d63d1d6c31376f51e4a1851fb9824212904948696589586f3
4
+ data.tar.gz: f613bc243dc1eced0ecef8ebb0d8b77c1137c80b8ad6e1039523b83c899580fe750bcdf19a0d2e1710a94411d5b2163e4f0b6165572684937bc4af1a88c9ff32
5
+ SHA1:
6
+ metadata.gz: c4033db8b2078f140f2bb9b3b38e6cf13042fbd5
7
+ data.tar.gz: 9e63243ea9d780c282faeee4ca00340d1cabf1ae
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+ branches:
3
+ only:
4
+ - master
2
5
  rvm:
3
6
  - 1.8.7
4
7
  - 1.9.2
data/Gemfile.lock CHANGED
@@ -1,41 +1,41 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-scm-jenkins (0.0.6)
5
- capistrano
4
+ capistrano-scm-jenkins (0.0.7)
5
+ capistrano (~> 2.0)
6
6
  net-netrc
7
- rubyzip
7
+ rubyzip (~> 0.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  Platform (0.4.0)
13
- capistrano (2.14.2)
13
+ capistrano (2.15.5)
14
14
  highline
15
15
  net-scp (>= 1.0.0)
16
16
  net-sftp (>= 2.0.0)
17
17
  net-ssh (>= 2.0.14)
18
18
  net-ssh-gateway (>= 1.1.0)
19
- diff-lcs (1.2.1)
20
- highline (1.6.16)
19
+ diff-lcs (1.2.4)
20
+ highline (1.6.20)
21
21
  net-netrc (0.2.2)
22
22
  Platform (>= 0.3.0)
23
- net-scp (1.1.0)
23
+ net-scp (1.1.2)
24
24
  net-ssh (>= 2.6.5)
25
- net-sftp (2.1.1)
25
+ net-sftp (2.1.2)
26
26
  net-ssh (>= 2.6.5)
27
- net-ssh (2.6.6)
27
+ net-ssh (2.7.0)
28
28
  net-ssh-gateway (1.2.0)
29
29
  net-ssh (>= 2.6.5)
30
- rake (10.0.3)
31
- rspec (2.13.0)
32
- rspec-core (~> 2.13.0)
33
- rspec-expectations (~> 2.13.0)
34
- rspec-mocks (~> 2.13.0)
35
- rspec-core (2.13.1)
36
- rspec-expectations (2.13.0)
30
+ rake (10.1.0)
31
+ rspec (2.14.1)
32
+ rspec-core (~> 2.14.0)
33
+ rspec-expectations (~> 2.14.0)
34
+ rspec-mocks (~> 2.14.0)
35
+ rspec-core (2.14.6)
36
+ rspec-expectations (2.14.3)
37
37
  diff-lcs (>= 1.1.3, < 2.0)
38
- rspec-mocks (2.13.0)
38
+ rspec-mocks (2.14.4)
39
39
  rubyzip (0.9.9)
40
40
 
41
41
  PLATFORMS
data/NEWS.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 0.0.6 (2013-0319)
1
+ ## 0.0.7 (2013-10-28)
2
+
3
+ * [#9] fix crash on strange title
4
+
5
+ ## 0.0.6 (2013-03-19)
2
6
 
3
7
  * [#1, #7] support https (thanks @lostintime)
4
8
 
data/README.md CHANGED
@@ -13,39 +13,44 @@ deploy your build artifact with capistrano.
13
13
 
14
14
  a sample config/deploy.rb
15
15
 
16
- require 'capistrano-scm-jenkins'
17
-
18
- set :application, "example"
19
- set :repository, "http://jenkins.example.com/job/example/"
20
-
21
- set :scm, :jenkins
22
-
23
- # uncomment following line if you want deploy unstable version
24
- # set :jenkins_use_unstable, true
25
-
26
- # jenkins username and password
27
- # set :scm_username, ENV['JENKINS_USERNAME']
28
- # set :scm_password, ENV['JENKINS_PASSWORD']
29
- # or use the netrc support for curl
30
- # set :jenkins_use_netrc, true
31
- #
32
- # if you use netrc, add the following line in your $HOME/.netrc
33
- # machine jenkins.example.com login USERNAME password secret
34
- #
35
- # bypass ssl verification
36
- # set :jenkins_insecure, true
37
- #
38
- # deploy from artifact subfolder. (ex: mv zipout/#{:jenkins_artifact_path} #{destination})
39
- # set :jenkins_artifact_path, 'archive'
40
-
41
-
42
- set :user, 'lidaobing'
43
- set :use_sudo, false
44
- set :deploy_to, "/home/#{user}/apps/#{application}"
45
-
46
- role :web, "test.example.com" # Your HTTP server, Apache/etc
47
- role :app, "test.example.com" # This may be the same as your `Web` server
48
- role :db, "test.example.com", :primary => true # This is where Rails migrations will run
16
+ ```ruby
17
+ require 'capistrano-scm-jenkins'
18
+
19
+ set :application, "example"
20
+ set :repository, "http://jenkins.example.com/job/example/"
21
+
22
+ set :scm, :jenkins
23
+
24
+ # uncomment following line if you want deploy unstable version
25
+ # set :jenkins_use_unstable, true
26
+
27
+ # jenkins username and password
28
+ # set :scm_username, ENV['JENKINS_USERNAME']
29
+ # set :scm_password, ENV['JENKINS_PASSWORD']
30
+ # or use the netrc support for curl
31
+ # set :jenkins_use_netrc, true
32
+ #
33
+ # if you use netrc, add the following line in your $HOME/.netrc
34
+ # machine jenkins.example.com login USERNAME password secret
35
+ #
36
+ # bypass ssl verification
37
+ # set :jenkins_insecure, true
38
+ #
39
+ # deploy from artifact subfolder. (ex: mv zipout/#{:jenkins_artifact_path} #{destination})
40
+ # set :jenkins_artifact_path, 'archive'
41
+ #
42
+ # deploy a single file.
43
+ # set :jenkins_artifact_file, 'webapp.war'
44
+ #
45
+
46
+ set :user, 'lidaobing'
47
+ set :use_sudo, false
48
+ set :deploy_to, "/home/#{user}/apps/#{application}"
49
+
50
+ role :web, "test.example.com" # Your HTTP server, Apache/etc
51
+ role :app, "test.example.com" # This may be the same as your `Web` server
52
+ role :db, "test.example.com", :primary => true # This is where Rails migrations will run
53
+ ```
49
54
 
50
55
  for more information about capistrano, check https://github.com/capistrano/capistrano
51
56
 
@@ -53,7 +58,9 @@ for more information about capistrano, check https://github.com/capistrano/capis
53
58
 
54
59
  for the maven module, you should include the module name in your repository url. for example:
55
60
 
56
- set :repository, "http://jenkins.example.com/job/example/com.example.helloworld$helloworld/"
61
+ ```ruby
62
+ set :repository, "http://jenkins.example.com/job/example/com.example.helloworld$helloworld/"
63
+ ```
57
64
 
58
65
  ## LICENSE
59
66
 
@@ -22,9 +22,9 @@ deploy your build artifact with capistrano.
22
22
  s.require_paths = ["lib"]
23
23
 
24
24
  # specify any dependencies here; for example:
25
- s.add_runtime_dependency "capistrano"
25
+ s.add_runtime_dependency "capistrano", "~> 2.0"
26
26
  s.add_runtime_dependency "net-netrc"
27
- s.add_runtime_dependency "rubyzip"
27
+ s.add_runtime_dependency "rubyzip", "~> 0.0"
28
28
  s.add_development_dependency "rspec"
29
29
  s.add_development_dependency "rake"
30
30
  end
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module Scm
3
3
  module Jenkins
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.7"
5
5
  end
6
6
  end
7
7
  end
@@ -31,8 +31,11 @@ module Capistrano
31
31
 
32
32
  execute << 'TMPDIR=`mktemp -d`'
33
33
  execute << 'cd $TMPDIR'
34
- execute << "curl #{curl_interface} #{insecure} #{authentication} -sO '#{artifact_zip_url(revision)}'"
35
- if variable(:jenkins_artifact_path)
34
+ execute << "curl #{curl_interface} #{insecure} #{authentication} -sO '#{artifact_url(revision)}'"
35
+ if artifact = variable(:jenkins_artifact_file)
36
+ execute << "mkdir '#{destination}'"
37
+ execute << "mv #{File.basename(artifact)} '#{destination}'"
38
+ elsif variable(:jenkins_artifact_path)
36
39
  execute << 'unzip archive.zip -d \'out/\''
37
40
  execute << "mv out/#{variable(:jenkins_artifact_path)} #{destination}"
38
41
  else
@@ -144,13 +147,24 @@ module Capistrano
144
147
  end
145
148
 
146
149
  def get_build_number_from_rss_all_title(title)
147
- /#(\d+) \([^(]+$/.match(title)[1]
150
+ /#(\d+) /.match(strip_right_parentheses(title))[1]
148
151
  end
149
152
 
150
153
  def get_build_number_from_rss_changelog_title(title)
151
154
  /^#(\d+) /.match(title)[1]
152
155
  end
153
156
 
157
+ def strip_right_parentheses(title)
158
+ return title if title.slice(title.size-1, 1) != ')'
159
+ count = 1
160
+ (title.size-2).downto(0).each do |idx|
161
+ count += 1 if title.slice(idx, 1) == ')'
162
+ count -= 1 if title.slice(idx, 1) == '('
163
+ return title.slice(0, idx) if count == 0
164
+ end
165
+ return ""
166
+ end
167
+
154
168
  def rss_all
155
169
  begin
156
170
  @rss_all ||= open(repository + '/rssAll', accept_language.merge(auth_opts).merge(ssl_opts)).read()
@@ -183,8 +197,12 @@ module Capistrano
183
197
  end
184
198
  end
185
199
 
186
- def artifact_zip_url(revision)
187
- "#{repository}/#{revision}/artifact/*zip*/archive.zip"
200
+ def artifact_url(revision)
201
+ if artifact = variable(:jenkins_artifact_file)
202
+ "#{repository}/#{revision}/artifact/#{artifact}"
203
+ else
204
+ "#{repository}/#{revision}/artifact/*zip*/archive.zip"
205
+ end
188
206
  end
189
207
 
190
208
  def jenkins_username
@@ -28,5 +28,27 @@ module Capistrano::Deploy::SCM
28
28
  @jenkins.send(:last_deploy_build, msg, :use_unstable => true).should == '1450'
29
29
  end
30
30
  end
31
+
32
+ context 'get_build_number_from_rss_all_title' do
33
+ {
34
+ "account #22 (1 more test is failing (total 19))" => 22,
35
+ "account #37 (stable)" => 37
36
+ }.each do |text, build_number|
37
+ it "should convert `#{text}` to `#{build_number}`" do
38
+ @jenkins.send(:get_build_number_from_rss_all_title, text).should == "#{build_number}"
39
+ end
40
+ end
41
+ end
42
+
43
+ context 'strip_right_parentheses' do
44
+ {
45
+ "account #22 (1 more test is failing (total 19))" => "account #22 ",
46
+ "account #37 (stable)" => "account #37 "
47
+ }.each do |from, to|
48
+ it "should convert `#{from}` to `#{to}" do
49
+ @jenkins.send(:strip_right_parentheses, from).should == to
50
+ end
51
+ end
52
+ end
31
53
  end
32
54
  end
metadata CHANGED
@@ -1,104 +1,75 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capistrano-scm-jenkins
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - LI Daobing
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-19 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: capistrano
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
11
+
12
+ date: 2013-10-28 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  type: :runtime
16
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: "2.0"
21
+ name: capistrano
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: net-netrc
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
23
+ requirement: *id001
24
+ - !ruby/object:Gem::Dependency
38
25
  type: :runtime
26
+ version_requirements: &id002 !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - &id004
29
+ - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
32
+ name: net-netrc
39
33
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rubyzip
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
34
+ requirement: *id002
35
+ - !ruby/object:Gem::Dependency
54
36
  type: :runtime
37
+ version_requirements: &id003 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: "0.0"
42
+ name: rubyzip
55
43
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: rspec
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
44
+ requirement: *id003
45
+ - !ruby/object:Gem::Dependency
70
46
  type: :development
47
+ version_requirements: &id005 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - *id004
50
+ name: rspec
71
51
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: rake
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
52
+ requirement: *id005
53
+ - !ruby/object:Gem::Dependency
86
54
  type: :development
55
+ version_requirements: &id006 !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - *id004
58
+ name: rake
87
59
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- description: ! "\nWith this plugin, you can use jenkins build artifact as a repository,
95
- and\ndeploy your build artifact with capistrano.\n "
96
- email:
60
+ requirement: *id006
61
+ description: "\n\
62
+ With this plugin, you can use jenkins build artifact as a repository, and\n\
63
+ deploy your build artifact with capistrano.\n "
64
+ email:
97
65
  - lidaobing@gmail.com
98
66
  executables: []
67
+
99
68
  extensions: []
69
+
100
70
  extra_rdoc_files: []
101
- files:
71
+
72
+ files:
102
73
  - .gitignore
103
74
  - .rspec
104
75
  - .travis.yml
@@ -115,34 +86,27 @@ files:
115
86
  - spec/spec_helper.rb
116
87
  homepage: https://github.com/lidaobing/capistrano-scm-jenkins
117
88
  licenses: []
89
+
90
+ metadata: {}
91
+
118
92
  post_install_message:
119
93
  rdoc_options: []
120
- require_paths:
94
+
95
+ require_paths:
121
96
  - lib
122
- required_ruby_version: !ruby/object:Gem::Requirement
123
- none: false
124
- requirements:
125
- - - ! '>='
126
- - !ruby/object:Gem::Version
127
- version: '0'
128
- segments:
129
- - 0
130
- hash: 1219470571275363423
131
- required_rubygems_version: !ruby/object:Gem::Requirement
132
- none: false
133
- requirements:
134
- - - ! '>='
135
- - !ruby/object:Gem::Version
136
- version: '0'
137
- segments:
138
- - 0
139
- hash: 1219470571275363423
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - *id004
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - *id004
140
103
  requirements: []
104
+
141
105
  rubyforge_project: capistrano-scm-jenkins
142
- rubygems_version: 1.8.25
106
+ rubygems_version: 2.0.13
143
107
  signing_key:
144
- specification_version: 3
108
+ specification_version: 4
145
109
  summary: use jenkins as a capistrano scm
146
- test_files:
110
+ test_files:
147
111
  - spec/capistrano/recipes/deploy/scm/jenkins_spec.rb
148
112
  - spec/spec_helper.rb