capistrano-opscomplete 0.4.0 → 0.5.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
- SHA1:
3
- metadata.gz: 0743d3bbb02bac9362a1729bf5821a4d4a0bd59e
4
- data.tar.gz: b045d4e90dd46e866c4b4647ebefff9a74e69d35
2
+ SHA256:
3
+ metadata.gz: a111086da8ada5ac2feb628dde0145658192aab86de0c3ff4ce18645b49ded6e
4
+ data.tar.gz: 9d264bca1f519365f7fd16cfab80e1351ef39f26e5ed1b8fac146fb648580b06
5
5
  SHA512:
6
- metadata.gz: 287c4b000c0de702f2055bd29cf94a37d4578ea730cf2676c8f2f42b12dd77be6edcee232b33b0a0fc2f5716c36e3b4393199d444ea49898f2b526db91e7f93b
7
- data.tar.gz: 823a06e3d2f3f533e3a9d70f1ee84eea7719d10a8eb90dcd89fa86156776dee71d265809ae50ac15ab8b97645d6c281966c8b2dc03373cd0155e0465eca5ea70
6
+ metadata.gz: 6255e9bfb88b90ee0a24d22b08c77ff186dcb83f6d7b782e1c2f92c6c75fc829fb2cc1be84bcd5786eb39452f6a0be2b8bb0b5321b6dfafc01c0b87f60805f51
7
+ data.tar.gz: 260cbaaa98160b36fbb89b58ff86db5d5a386ad0a8aab72306b660c98d23bebe0cdefec7f5d8fc8185e485dcd872ccebef3d017b7ea66e5cf556018d2e317ab2
@@ -1,3 +1,10 @@
1
+ ## Unreleased
2
+
3
+ ## [0.5.0] - 2019-12-09
4
+ ### Changed
5
+ - Install the bundler version that was used to create the `Gemfile.lock` (`BUNDLED WITH`) if it is present. Can be overwritten by `set :bundler_version`.
6
+ - Reword some info output
7
+
1
8
  ## [0.4.0] - 2019-09-23
2
9
  ### Added
3
10
  - ruby-build now honors the :tmp_dir setting
@@ -35,6 +42,7 @@
35
42
  ### Added
36
43
  - Initial release.
37
44
 
45
+ [0.5.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.4.0...v0.5.0
38
46
  [0.4.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.3.0...v0.4.0
39
47
  [0.3.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.2.0...v0.3.0
40
48
  [0.2.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.1.0...v0.2.0
data/README.md CHANGED
@@ -75,7 +75,8 @@ More specifically this task will:
75
75
  3) A file in the current working directory of your local checkout (e.g. `/home/user/code/myapp/.ruby-version`)
76
76
  - If the desired version is not installed, it checks if it can be installed using `ruby-build` and installs it.
77
77
  - Check if `rbenv global` version is set according to application's `.ruby-version` file. Change it if required.
78
- - Install the `bundler` and `geordi` gem if required.
78
+ - Install `bundler`. It is tried to determine the version that was used to create the `Gemfile.lock` (`BUNDLED WITH`) if it is present.
79
+ - Install `geordi` gem if required.
79
80
  - Run `rbenv rehash` if required.
80
81
 
81
82
  **Note:** If, for any reason, no `.ruby-version` file can be found in your release or current working directory, you may set the following option in `deploy.rb`:
@@ -92,12 +93,18 @@ set :rbenv_roles, :web
92
93
  set :rbenv_roles, [:web, :worker]
93
94
  ```
94
95
 
95
- **Optional:** If you want a specific bundler version available for your release, set it in your `deploy.rb`, e.g '~>2' if you need bundler version 2.x:
96
+ **Optional:** If you want a specific bundler version other than the one that is set in `Gemfile.lock` available for your release, set it in your `deploy.rb`:
96
97
 
97
98
  ```ruby
98
99
  set :bundler_version, '<VERSION>'
99
100
  ```
100
101
 
102
+ e.g. if you need bundler version 2.x:
103
+
104
+ ```ruby
105
+ set :bundler_version, '~>2'
106
+ ```
107
+
101
108
  **Optional:** By default, the rubygems version defined by the ruby-build manifest will be installed. If you want a specific rubygems version available for your release, set it in your `deploy.rb`:
102
109
 
103
110
  ```ruby
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Makandra Operations']
9
9
  spec.email = ['ops@makandra.de']
10
10
 
11
- spec.summary = %q(Capistrano tasks for easy deployment to a makandra opscomplete environment.)
11
+ spec.summary = 'Capistrano tasks for easy deployment to a makandra opscomplete environment.'
12
12
  spec.homepage = 'https://opscomplete.com/ruby'
13
13
 
14
14
  spec.license = 'MIT'
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.required_rubygems_version = '>=2.0.1'
33
33
 
34
- spec.add_development_dependency 'makandra-rubocop', '~> 0'
34
+ spec.add_development_dependency 'makandra-rubocop', '~> 4'
35
35
  spec.add_development_dependency 'bundler', '~> 1.16'
36
36
  spec.add_development_dependency 'rake', '~> 10.0'
37
37
 
@@ -42,6 +42,28 @@ module Capistrano
42
42
  end
43
43
  end
44
44
 
45
+ def app_gemfile_bundled_with_version
46
+ release_gemfile_lock_file_path = release_path.join('Gemfile.lock').to_s
47
+
48
+ if test("[ -f #{release_gemfile_lock_file_path} ]")
49
+ debug('found release_dir/Gemfile.lock')
50
+
51
+ grep_command = [:grep, '-A', '1', '"BUNDLED WITH"', release_gemfile_lock_file_path]
52
+
53
+ if test(*grep_command)
54
+ bundled_with_lines = capture(*grep_command)
55
+ version = bundled_with_lines.split.last
56
+ debug("Using version #{version.inspect} from server's release_dir/Gemfile.lock file.")
57
+ version
58
+ else
59
+ # old bundler versions did not write "BUNDLED WITH"
60
+ debug('Gemfile.lock was found but did not contain "BUNDLED WITH"-section')
61
+ end
62
+ else
63
+ debug('There was no Gemfile.lock to parse the bundler version')
64
+ end
65
+ end
66
+
45
67
  def rbenv_installable_rubies
46
68
  rbenv_installable_rubies = capture(:rbenv, :install, '--list').split("\n")
47
69
  rbenv_installable_rubies.map!(&:strip)
@@ -16,15 +16,15 @@ namespace :opscomplete do
16
16
  end
17
17
  end
18
18
 
19
- desc 'Check if rbenv global ruby is set according to application\'s .ruby-version.'
19
+ desc 'Check if rbenv global Ruby version is set according to application\'s .ruby-version.'
20
20
  task :check do
21
21
  on roles fetch(:rbenv_roles, :all) do |host|
22
- warn("#{host}: Managed ruby environment! Won't do any changes to ruby version.") if managed_ruby?
22
+ warn("#{host}: Managed Ruby environment! Won't do any changes to ruby version.") if managed_ruby?
23
23
  unless capture(:rbenv, :global) == app_ruby_version
24
24
  raise Capistrano::ValidationError,
25
25
  "#{host}: Ruby version is not set according to application\'s .ruby-version file. Use cap opscomplete:ruby:ensure."
26
26
  end
27
- info("#{host}: Required ruby version '#{app_ruby_version}' is installed.")
27
+ info("#{host}: Ruby #{app_ruby_version} is installed.")
28
28
  end
29
29
  end
30
30
 
@@ -52,9 +52,12 @@ namespace :opscomplete do
52
52
  # desc 'Install bundler gem'
53
53
  task :install_bundler do
54
54
  on roles fetch(:rbenv_roles, :all) do
55
- if fetch(:bundler_version, false)
55
+ # manually specified version will take precedence
56
+ specific_bundler_version = fetch(:bundler_version, app_gemfile_bundled_with_version)
57
+
58
+ if specific_bundler_version
56
59
  # We have to set force = true to overwrite the binary
57
- gem_install('bundler', fetch(:bundler_version), true) unless gem_installed?('bundler', fetch(:bundler_version))
60
+ gem_install('bundler', specific_bundler_version, true) unless gem_installed?('bundler', specific_bundler_version)
58
61
  else
59
62
  gem_install('bundler') unless gem_installed?('bundler')
60
63
  end
@@ -89,19 +92,19 @@ namespace :opscomplete do
89
92
  invoke('opscomplete:ruby:update_ruby_build')
90
93
  on roles fetch(:rbenv_roles, :all) do |host|
91
94
  if managed_ruby?
92
- raise Capistrano::ValidationError, "#{host}: Managed ruby environment! Won't do any changes to ruby version."
95
+ raise Capistrano::ValidationError, "#{host}: Managed Ruby environment! Won't do any changes to Ruby version."
93
96
  end
94
97
  if rbenv_installed_rubies.include?(app_ruby_version)
95
- info("#{host}: Required ruby version '#{app_ruby_version}' is installed.")
98
+ info("#{host}: Ruby #{app_ruby_version} is installed.")
96
99
  elsif rbenv_installable_rubies.include?(app_ruby_version)
97
- info("#{host}: Required ruby version is not installed, but available for installation.")
100
+ info("#{host}: Configured Ruby version is not installed, but available for installation.")
98
101
  with tmpdir: fetch(:tmp_dir) do
99
102
  execute(:rbenv, :install, "'#{app_ruby_version}'")
100
103
  end
101
104
  set :rbenv_needs_rehash, true
102
105
  else
103
106
  raise Capistrano::ValidationError,
104
- "#{host}: Ruby version required by application is neither installed nor installable using ruby-install."
107
+ "#{host}: Configured Ruby version is neither installed nor installable using ruby-install."
105
108
  end
106
109
  execute(:rbenv, :global, "'#{app_ruby_version}'") unless capture(:rbenv, :global) == app_ruby_version
107
110
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Opscomplete
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-opscomplete
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makandra Operations
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: makandra-rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -112,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: 2.0.1
114
114
  requirements: []
115
- rubyforge_project:
116
- rubygems_version: 2.6.13
115
+ rubygems_version: 3.0.6
117
116
  signing_key:
118
117
  specification_version: 4
119
118
  summary: Capistrano tasks for easy deployment to a makandra opscomplete environment.