capistrano-jdk-installer 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -36,14 +36,14 @@ To enable this recipe, add following in your `config/deploy.rb`.
36
36
 
37
37
  Following options are available to manage your JDK installation.
38
38
 
39
- * `:java_version_name` - preferred JDK version. this value must be defined in JSON response from `:java_installer_uri`.
39
+ * `:java_version_name` - preferred JDK version. this value must be defined in JSON response from `:java_installer_json_uri`.
40
40
  * `:java_oracle_username` - your credential to be used to download JDK archive from oracle.com.
41
41
  * `:java_oracle_password` - your credential to be used to download JDK archive from oracle.com.
42
42
  * `:java_license_title` - the license title of JDK which you will accept.
43
43
  * `:java_accept_license` - specify whether you accept the JDK license. `false` by default.
44
44
  * `:java_setup_locally` - specify whether you want to setup JDK on local machine. `false` by default.
45
45
  * `:java_setup_remotely` - specify whether you want to setup JDK on remote machines. `true` by default.
46
- * `:java_installer_uri` - `http://updates.jenkins-ci.org/updates/hudson.tools.JDKInstaller.json` by default.
46
+ * `:java_installer_json_uri` - `http://updates.jenkins-ci.org/updates/hudson.tools.JDKInstaller.json` by default.
47
47
  * `:java_installer_json_cache` - the cache file path of "hudson.tools.JDKINstaller.json".
48
48
  * `:java_installer_json_expires` - the cache TTL. cache `86400` seconds by default.
49
49
  * `:java_home` - the path to the `JAVA_HOME` on remote machines.
@@ -45,7 +45,7 @@ module Capistrano
45
45
  logger.debug "transfering: #{[:up, from, to, targets, options.merge(:logger => logger).inspect ] * ', '}"
46
46
  else
47
47
  stat = File.stat(from)
48
- chdcksum_cmd = fetch(:java_checksum_cmd, 'md5sum')
48
+ checksum_cmd = fetch(:java_checksum_cmd, 'md5sum')
49
49
  checksum = run_locally("( cd #{File.dirname(from)} && #{checksum_cmd} #{File.basename(from)} )").strip
50
50
  targets = targets.reject { |ssh|
51
51
  begin
@@ -240,12 +240,15 @@ module Capistrano
240
240
  agent.user_agent = 'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)'
241
241
  agent.cookie_jar.add!(Mechanize::Cookie.new('gpw_e24', '.', :domain => 'oracle.com', :path => '/', :secure => false, :for_domain => true))
242
242
  }
243
- agent.ssl_version = :TLSv1
243
+ agent.ssl_version = :TLSv1 # we have to declare TLS version explicitly to avoid problems on LP:965371
244
244
  agent
245
245
  }
246
- _cset(:java_installer_uri, "http://updates.jenkins-ci.org/updates/hudson.tools.JDKInstaller.json")
246
+ _cset(:java_installer_json_uri) {
247
+ # fetch :java_installer_uri first for backward compatibility
248
+ fetch(:java_installer_uri, "http://updates.jenkins-ci.org/updates/hudson.tools.JDKInstaller.json")
249
+ }
247
250
  _cset(:java_installer_json_cache) {
248
- File.join(java_tools_path_local, File.basename(URI.parse(java_installer_uri).path))
251
+ File.join(java_tools_path_local, File.basename(URI.parse(java_installer_json_uri).path))
249
252
  }
250
253
  _cset(:java_installer_json_expires, 86400)
251
254
  _cset(:java_installer_json) {
@@ -258,7 +261,7 @@ module Capistrano
258
261
  execute = []
259
262
  execute << "mkdir -p #{File.dirname(java_installer_json_cache)}"
260
263
  execute << "rm -f #{java_installer_json_cache}"
261
- execute << "wget --no-verbose -O #{java_installer_json_cache} #{java_installer_uri}"
264
+ execute << "wget --no-verbose -O #{java_installer_json_cache} #{java_installer_json_uri}"
262
265
  if dry_run
263
266
  logger.debug(execute.join(' && '))
264
267
  else
@@ -310,7 +313,7 @@ module Capistrano
310
313
  ## settings for remote machines
311
314
  _cset(:java_deployee_platform) { java_platform(capture('uname -s').strip, capture('uname -m').strip) }
312
315
  _cset(:java_deployee_archive_uri) {
313
- regex = Regexp.new(Regexp.quote(java_depoyee_platform), Regexp::IGNORECASE)
316
+ regex = Regexp.new(Regexp.quote(java_deployee_platform), Regexp::IGNORECASE)
314
317
  data = java_platform_data(regex)
315
318
  data['filepath']
316
319
  }
@@ -344,10 +347,11 @@ module Capistrano
344
347
  }
345
348
 
346
349
  task(:install_locally, :except => { :no_release => true}) {
347
- command = (<<-EOS).gsub(/\s+/, ' ')
350
+ command = (<<-EOS).gsub(/\s+/, ' ').strip
348
351
  if ! test -d #{java_home_local}; then
349
352
  #{extract_archive(java_deployer_archive_local, java_home_local)} &&
350
- #{java_cmd_local} -version;
353
+ ( #{java_cmd_local} -version || rm -rf #{java_home_local} ) &&
354
+ test -d #{java_home_local};
351
355
  fi;
352
356
  EOS
353
357
  if dry_run
@@ -374,10 +378,11 @@ module Capistrano
374
378
  }
375
379
 
376
380
  task(:install, :roles => :app, :except => { :no_release => true }) {
377
- command = (<<-EOS).gsub(/\s+/, ' ')
381
+ command = (<<-EOS).gsub(/\s+/, ' ').strip
378
382
  if ! test -d #{java_home}; then
379
383
  #{extract_archive(java_deployee_archive, java_home)} &&
380
- #{java_cmd} -version;
384
+ ( #{java_cmd} -version || rm -rf #{java_home} ) &&
385
+ test -d #{java_home};
381
386
  fi;
382
387
  EOS
383
388
  run(command)
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module JDKInstaller
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-jdk-installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: