capistrano-scm-jenkins 0.0.4 → 0.0.5

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.
data/Gemfile.lock CHANGED
@@ -1,43 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-scm-jenkins (0.0.4)
4
+ capistrano-scm-jenkins (0.0.5)
5
5
  capistrano
6
6
  net-netrc
7
+ rubyzip
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
12
  Platform (0.4.0)
12
- capistrano (2.12.0)
13
+ capistrano (2.14.1)
13
14
  highline
14
15
  net-scp (>= 1.0.0)
15
16
  net-sftp (>= 2.0.0)
16
17
  net-ssh (>= 2.0.14)
17
18
  net-ssh-gateway (>= 1.1.0)
18
19
  diff-lcs (1.1.3)
19
- highline (1.6.13)
20
+ highline (1.6.15)
20
21
  net-netrc (0.2.2)
21
22
  Platform (>= 0.3.0)
22
23
  net-scp (1.0.4)
23
24
  net-ssh (>= 1.99.1)
24
25
  net-sftp (2.0.5)
25
26
  net-ssh (>= 2.0.9)
26
- net-ssh (2.5.2)
27
+ net-ssh (2.6.3)
27
28
  net-ssh-gateway (1.1.0)
28
29
  net-ssh (>= 1.99.1)
29
- rake (0.9.2.2)
30
- rspec (2.10.0)
31
- rspec-core (~> 2.10.0)
32
- rspec-expectations (~> 2.10.0)
33
- rspec-mocks (~> 2.10.0)
34
- rspec-core (2.10.1)
35
- rspec-expectations (2.10.0)
30
+ rake (10.0.3)
31
+ rspec (2.12.0)
32
+ rspec-core (~> 2.12.0)
33
+ rspec-expectations (~> 2.12.0)
34
+ rspec-mocks (~> 2.12.0)
35
+ rspec-core (2.12.2)
36
+ rspec-expectations (2.12.1)
36
37
  diff-lcs (~> 1.1.3)
37
- rspec-mocks (2.10.1)
38
+ rspec-mocks (2.12.2)
39
+ rubyzip (0.9.9)
38
40
 
39
41
  PLATFORMS
40
42
  ruby
43
+ x86-mingw32
41
44
 
42
45
  DEPENDENCIES
43
46
  capistrano-scm-jenkins!
data/NEWS.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.5 (2013-01-31)
2
+
3
+ * works under Windows (thanks @Iristyle)
4
+
1
5
  ## 0.0.4 (2012-06-21)
2
6
 
3
7
  * working with non-English server (thanks cynipe).
@@ -24,6 +24,7 @@ deploy your build artifact with capistrano.
24
24
  # specify any dependencies here; for example:
25
25
  s.add_runtime_dependency "capistrano"
26
26
  s.add_runtime_dependency "net-netrc"
27
+ s.add_runtime_dependency "rubyzip"
27
28
  s.add_development_dependency "rspec"
28
29
  s.add_development_dependency "rake"
29
30
  end
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module Scm
3
3
  module Jenkins
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
@@ -2,8 +2,12 @@ require 'open-uri'
2
2
  require 'tmpdir'
3
3
  require 'rexml/document'
4
4
 
5
+ require 'capistrano/logger'
5
6
  require 'capistrano/recipes/deploy/scm/base'
6
7
  require 'net/netrc'
8
+ require 'fileutils'
9
+ require 'open-uri'
10
+ require 'zip/zip'
7
11
 
8
12
  module Capistrano
9
13
  module Deploy
@@ -19,13 +23,41 @@ module Capistrano
19
23
  end
20
24
 
21
25
  def checkout(revision, destination)
22
- %Q{TMPDIR=`mktemp -d` &&
23
- cd "$TMPDIR" &&
24
- curl #{authentication} -sO '#{artifact_zip_url(revision)}' &&
25
- unzip archive.zip &&
26
- mv archive "#{destination}" &&
27
- rm -rf "$TMPDIR"
26
+ download_url = artifact_zip_url(revision)
27
+ Dir.mktmpdir { |dir|
28
+ if variable(:jenkins_use_netrc)
29
+ zip_path = File.expand_path(File.join(dir, 'archive.zip'))
30
+ `curl #{authentication} -sO '#{download_url}'`
31
+ if $?.exitstatus != 0
32
+ raise "could not execute curl"
33
+ end
34
+ else
35
+ options = {
36
+ "User-Agent" => "capistrano-scm-jenkins@capistrano",
37
+ "Referer" => "https://github.com/lidaobing/capistrano-scm-jenkins"
38
+ }
39
+ if variable(:scm_username) and variable(:scm_password)
40
+ options[:http_basic_authentication] = [variable(:scm_username), variable(:scm_password)]
41
+ end
42
+
43
+ zip_path = open(download_url, options).path
44
+ end
45
+
46
+ logger.info("Extracting #{zip_path} to #{destination}")
47
+ Zip::ZipFile.open(zip_path) do |zipfile|
48
+ zipfile.each { |e|
49
+ fpath = File.join(destination, e.to_s)
50
+ FileUtils.mkdir_p(File.dirname(fpath))
51
+ # true to overwrite existing files
52
+ zipfile.extract(e, fpath){ true }
53
+ }
54
+ end
28
55
  }
56
+
57
+ # HACK: rather than using shell commands to download / extract and
58
+ # move files, use something cross platform, and fake a shell success
59
+ # this does break the benchmarking of the system call, but oh well
60
+ return 'true'
29
61
  end
30
62
 
31
63
  alias_method :export, :checkout
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.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-21 00:00:00.000000000 Z
12
+ date: 2013-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
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'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rspec
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -109,15 +125,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
125
  - - ! '>='
110
126
  - !ruby/object:Gem::Version
111
127
  version: '0'
128
+ segments:
129
+ - 0
130
+ hash: -2250672160818474877
112
131
  required_rubygems_version: !ruby/object:Gem::Requirement
113
132
  none: false
114
133
  requirements:
115
134
  - - ! '>='
116
135
  - !ruby/object:Gem::Version
117
136
  version: '0'
137
+ segments:
138
+ - 0
139
+ hash: -2250672160818474877
118
140
  requirements: []
119
141
  rubyforge_project: capistrano-scm-jenkins
120
- rubygems_version: 1.8.23
142
+ rubygems_version: 1.8.24
121
143
  signing_key:
122
144
  specification_version: 3
123
145
  summary: use jenkins as a capistrano scm