capistrano-ruby_version 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1d76b886ed9c622b31bb7d67ffcdbf8eae147048
4
+ data.tar.gz: 4727c78d3819c8cca5a58bc57bfcc7f8b917134c
5
+ SHA512:
6
+ metadata.gz: c6598f97f4625261f23b74b08b06173995da4f9c2031f989e4e8ea637180743a0b486cf20223d7cc42664f72505d1ab4aa5653ba9ba719f208e1fde6d66c8637
7
+ data.tar.gz: ccf33c342f7656bccf951330ec22f33fb9bb7244e3a377d4ff6a8959c6c939b836483c08eb10b7c67eb11fd0c150d426399bcd6e8230a495313ad1499a8cfd37
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .ruby-version
11
+ .ruby-gemset
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-ruby_version.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 adjust GmbH, http://www.adjust.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # Capistrano::RubyVersion
2
+
3
+ Enforces that the ruby version on the deployer side is the same
4
+ as the ruby version on the server.
5
+
6
+ ## Installation
7
+
8
+ ```ruby
9
+ gem 'capistrano-ruby_version', require: false
10
+ ```
11
+
12
+ ## Configuration
13
+
14
+ In your `Capfile`:
15
+
16
+ ```ruby
17
+ # Enforce ruby version match
18
+ require 'capistrano/ruby_version'
19
+ ```
20
+
21
+ And in your `deploy.rb`
22
+
23
+ ```ruby
24
+ # Setting it to false will cause cap to _not_ abort if the versions don't match,
25
+ # but merely print a warning instead.
26
+ # Defaults to true.
27
+ # set :force_ruby_version, true
28
+
29
+ after 'deploy:starting', 'deploy:check:ruby'
30
+ ```
31
+
32
+
33
+ ## License
34
+
35
+ [The MIT License (MIT)](http://opensource.org/licenses/MIT)
36
+
37
+ Copyright (c) 2015 adjust GmbH, http://www.adjust.com
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining a copy
40
+ of this software and associated documentation files (the "Software"), to deal
41
+ in the Software without restriction, including without limitation the rights
42
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+ copies of the Software, and to permit persons to whom the Software is
44
+ furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in all
47
+ copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/ruby_version/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'capistrano-ruby_version'
8
+ spec.version = Capistrano::RubyVersion::VERSION
9
+ spec.authors = ['Patrick Heisiph']
10
+ spec.email = ['patrick@adjust.com']
11
+ spec.license = 'MIT'
12
+
13
+ spec.summary = 'Abort deployment if ruby versions mismatch'
14
+ spec.description = 'Abort deployment if ruby versions mismatch'
15
+ spec.homepage = 'https://github.com/adjust/capistrano-ruby_version'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.10'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+
26
+ spec.add_runtime_dependency 'capistrano', '~> 3.1', '>= 3.1.0'
27
+ end
@@ -0,0 +1,3 @@
1
+ require 'capistrano/ruby_version/version'
2
+
3
+ load File.expand_path('../tasks/ruby_version.rake', __FILE__)
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module RubyVersion
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
@@ -0,0 +1,46 @@
1
+ namespace :deploy do
2
+ namespace :check do
3
+ desc 'aborts deployment (or prints a warning) if ruby versions mismatch'
4
+ task :ruby do
5
+ next if dry_run?
6
+
7
+ fail_on_version_mismatch = fetch(:force_ruby_version, true)
8
+ local_ruby = nil
9
+ remote_ruby = nil
10
+
11
+ on roles(:app) do
12
+ within current_path do
13
+ remote_ruby = extract_ruby_version(capture :ruby, '-v')
14
+ end
15
+ end
16
+
17
+ run_locally do
18
+ local_ruby = begin
19
+ IO.read('.ruby-version').chomp
20
+ rescue Errno::ENOENT
21
+ warn 'No Ruby version set in `.ruby-version`! Reading actual Ruby.'
22
+ extract_ruby_version(capture :ruby, '-v')
23
+ end
24
+
25
+ unless local_ruby == remote_ruby
26
+ error "💎 Ruby version mismatch: You are running #{local_ruby}, " \
27
+ "but the server expects #{remote_ruby}! Update your " \
28
+ '`.ruby-version` file to match the server version.'
29
+
30
+ if fail_on_version_mismatch
31
+ invoke 'deploy:failed'
32
+ exit(false)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ def extract_ruby_version(version_string)
40
+ version_string.split('p')[0].gsub('ruby ', '')
41
+ end
42
+
43
+ def dry_run?
44
+ Capistrano::Configuration.fetch(:sshkit_backend) == SSHKit::Backend::Printer
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-ruby_version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Patrick Heisiph
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capistrano
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 3.1.0
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '3.1'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 3.1.0
61
+ description: Abort deployment if ruby versions mismatch
62
+ email:
63
+ - patrick@adjust.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - ".rspec"
70
+ - ".travis.yml"
71
+ - Gemfile
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - capistrano-ruby_version.gemspec
76
+ - lib/capistrano/ruby_version.rb
77
+ - lib/capistrano/ruby_version/version.rb
78
+ - lib/capistrano/tasks/ruby_version.rake
79
+ homepage: https://github.com/adjust/capistrano-ruby_version
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.4.5.1
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Abort deployment if ruby versions mismatch
103
+ test_files: []