mina-version_managers 0.1.0

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
+ SHA256:
3
+ metadata.gz: c1e575b8dbd7c89c568d7236f813bf24e1e0dddd112cfe8214e8bdd0d9192648
4
+ data.tar.gz: 0b502eb6fb827b03c775a6f4484c656b2e3fa5a4e0c82955675ed3657b6df239
5
+ SHA512:
6
+ metadata.gz: 43bb73c4d61f8a6e6f82db0ba8dff52da0165c98322dcebc4cce129be297f139ae28fd68ef9aa5c3a3ae5b955b32d98aca8045024829f9c9eac49488abd4afa0
7
+ data.tar.gz: 7b9ddf4f0b31c5868709ae0ad000169d3b7a311342d70ab4e3565faafcdd83cc37ddb40e342edb3009f48d5f926959c470585c1ba98a2d44a454dfc5388037c8
@@ -0,0 +1,22 @@
1
+ name: Test
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+ name: Ruby ${{ matrix.ruby }} (${{ matrix.os }})
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ os: [ubuntu-20.04]
12
+ ruby: [2.5, 2.6, 2.7, 3.0]
13
+ runs-on: ${{ matrix.os }}
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ bundler-cache: true
21
+ - run: bundle exec rubocop
22
+ - run: bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,32 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+ Exclude:
6
+ - vendor/bundle/**/*
7
+ TargetRubyVersion: 2.5
8
+
9
+ Layout/MultilineMethodCallIndentation:
10
+ Exclude:
11
+ - 'spec/**/*.rb'
12
+
13
+ Metrics/BlockLength:
14
+ Enabled: false
15
+
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ Style/ParallelAssignment:
20
+ Enabled: false
21
+
22
+ Style/WordArray:
23
+ EnforcedStyle: brackets
24
+
25
+ RSpec/DescribeClass:
26
+ Enabled: false
27
+
28
+ RSpec/LeadingSubject:
29
+ Enabled: false
30
+
31
+ Layout/LineLength:
32
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-01-12
4
+
5
+ - Added support for chruby, rbenv, rvm, and ry
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at lovro.bikic@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mina-version_managers (0.1.0)
5
+ mina (>= 1.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.5.0)
13
+ docile (1.4.0)
14
+ method_source (1.0.0)
15
+ mina (1.2.4)
16
+ open4 (~> 1.3.4)
17
+ rake
18
+ open4 (1.3.4)
19
+ parallel (1.21.0)
20
+ parser (3.1.0.0)
21
+ ast (~> 2.4.1)
22
+ pry (0.14.1)
23
+ coderay (~> 1.1)
24
+ method_source (~> 1.0)
25
+ rainbow (3.0.0)
26
+ rake (13.0.6)
27
+ regexp_parser (2.2.0)
28
+ rexml (3.2.5)
29
+ rspec (3.10.0)
30
+ rspec-core (~> 3.10.0)
31
+ rspec-expectations (~> 3.10.0)
32
+ rspec-mocks (~> 3.10.0)
33
+ rspec-core (3.10.1)
34
+ rspec-support (~> 3.10.0)
35
+ rspec-expectations (3.10.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.10.0)
38
+ rspec-mocks (3.10.2)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.10.0)
41
+ rspec-support (3.10.3)
42
+ rubocop (1.24.1)
43
+ parallel (~> 1.10)
44
+ parser (>= 3.0.0.0)
45
+ rainbow (>= 2.2.2, < 4.0)
46
+ regexp_parser (>= 1.8, < 3.0)
47
+ rexml
48
+ rubocop-ast (>= 1.15.1, < 2.0)
49
+ ruby-progressbar (~> 1.7)
50
+ unicode-display_width (>= 1.4.0, < 3.0)
51
+ rubocop-ast (1.15.1)
52
+ parser (>= 3.0.1.1)
53
+ rubocop-rspec (2.7.0)
54
+ rubocop (~> 1.19)
55
+ ruby-progressbar (1.11.0)
56
+ simplecov (0.21.2)
57
+ docile (~> 1.1)
58
+ simplecov-html (~> 0.11)
59
+ simplecov_json_formatter (~> 0.1)
60
+ simplecov-html (0.12.3)
61
+ simplecov_json_formatter (0.1.3)
62
+ unicode-display_width (2.1.0)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ mina-version_managers!
69
+ pry
70
+ rspec
71
+ rubocop
72
+ rubocop-rspec
73
+ simplecov
74
+
75
+ BUNDLED WITH
76
+ 2.2.16
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Infinum
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,239 @@
1
+ # Mina::VersionManagers
2
+
3
+ [Mina](https://github.com/mina-deploy/mina) plugin with tasks for version managers, including [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), [rvm](https://github.com/rvm/rvm), and [ry](https://github.com/jneen/ry).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'mina-version_managers'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mina-version_managers
20
+
21
+ ## Usage
22
+
23
+ The following sections explain how to use tasks for each version manager.
24
+
25
+ ### chruby
26
+
27
+ Require chruby tasks:
28
+ ```ruby
29
+ # config/deploy.rb
30
+ require 'mina/version_managers/chruby'
31
+ ```
32
+
33
+ This will load three tasks: `chruby:load`, `chruby:set`, and `chruby`.
34
+
35
+ #### chruby:load
36
+
37
+ Loads the chruby environment from the given path (default path is `/etc/profile.d/chruby.sh`). You can also override it:
38
+ ```ruby
39
+ # config/deploy.rb
40
+ set :chruby_path, 'mypath/chruby.sh'
41
+ ```
42
+ See [chruby docs](https://github.com/postmodern/chruby#configuration) for path details.
43
+
44
+ Example usage:
45
+ ```ruby
46
+ # config/deploy.rb
47
+ task :deploy do
48
+ deploy do
49
+ invoke :'chruby:load'
50
+ end
51
+ end
52
+ ```
53
+
54
+ #### chruby:set
55
+
56
+ Sets current Ruby version, which must be provided as an argument.
57
+
58
+ Example usage:
59
+ ```ruby
60
+ # config/deploy.rb
61
+ task :deploy do
62
+ deploy do
63
+ invoke :'chruby:set', '3.0.0' # sets current Ruby version to 3.0.0
64
+ end
65
+ end
66
+ ```
67
+
68
+ #### chruby
69
+
70
+ Convenience task which invokes `chruby:load` and `chruby:set`. Ruby version must be provided as an argument.
71
+
72
+ Example usage:
73
+ ```ruby
74
+ # config/deploy.rb
75
+ task :deploy do
76
+ deploy do
77
+ invoke :chruby, '3.0.0' # loads chruby environment and sets current Ruby version to 3.0.0
78
+ end
79
+ end
80
+ ```
81
+
82
+ ### rbenv
83
+
84
+ Require rbenv task:
85
+ ```ruby
86
+ # config/deploy.rb
87
+ require 'mina/version_managers/rbenv'
88
+ ```
89
+
90
+ This will load a single task: `rbenv:load`.
91
+
92
+ #### rbenv:load
93
+
94
+ Adds rbenv root path to the `PATH` environment variable, and executes `rbenv init`. Default rbenv root path is `$HOME/.rbenv`, but you can override it:
95
+ ```ruby
96
+ # config/deploy.rb
97
+ set :rbenv_path, 'mypath/.rbenv'
98
+ ```
99
+
100
+ Example usage:
101
+ ```ruby
102
+ # config/deploy.rb
103
+ task :deploy do
104
+ deploy do
105
+ invoke :'rbenv:load'
106
+ end
107
+ end
108
+ ```
109
+
110
+ ### RVM
111
+
112
+ Require RVM tasks:
113
+ ```ruby
114
+ # config/deploy.rb
115
+ require 'mina/version_managers/rvm'
116
+ ```
117
+
118
+ This will load three tasks: `rvm:load`, `rvm:use`, and `rvm:wrapper`.
119
+
120
+ #### rvm:load
121
+
122
+ Loads RVM from the given path. Default path is `$HOME/.rvm/scripts/rvm`, but it can be overriden:
123
+ ```ruby
124
+ # config/deploy.rb
125
+ set :rvm_use_path, 'mypath'
126
+ ```
127
+
128
+ Example usage:
129
+ ```ruby
130
+ # config/deploy.rb
131
+ task :deploy do
132
+ deploy do
133
+ invoke :'rvm:load'
134
+ end
135
+ end
136
+ ```
137
+
138
+ #### rvm:use
139
+
140
+ Loads RVM (by invoking `rvm:load`) and sets current Ruby version, which should be provided as an argument.
141
+
142
+ Example usage:
143
+ ```ruby
144
+ # config/deploy.rb
145
+ task :deploy do
146
+ deploy do
147
+ invoke :'rvm:use', '3.0.0' # loads RVM and changes current Ruby version to 3.0.0
148
+ end
149
+ end
150
+ ```
151
+
152
+ #### rvm:wrapper
153
+
154
+ Creates an RVM wrapper for the given environment and binary which will be wrapped.
155
+
156
+ Example usage:
157
+ ```ruby
158
+ # config/deploy.rb
159
+ task :deploy do
160
+ deploy do
161
+ # creates a wrapper called `myapp` for the binary `unicorn_rails` in the environment `3.0.0`
162
+ invoke :'rvm:wrapper', '3.0.0', 'myapp', 'unicorn_rails'
163
+ end
164
+ end
165
+ ```
166
+
167
+ ### ry
168
+
169
+ Require ry tasks:
170
+ ```ruby
171
+ # config/deploy.rb
172
+ require 'mina/version_managers/ry'
173
+ ```
174
+
175
+ This will load three tasks: `ry:load`, `ry:use` and `ry`.
176
+
177
+ #### ry:load
178
+
179
+ Adds ry path to the `PATH` environment variable, and executes `ry setup`. Default ry path is `$HOME/.local`, but you can override it:
180
+ ```ruby
181
+ # config/deploy.rb
182
+ set :ry_path, 'mypath/.local'
183
+ ```
184
+
185
+ Example usage:
186
+ ```ruby
187
+ # config/deploy.rb
188
+ task :deploy do
189
+ deploy do
190
+ invoke :'ry:load'
191
+ end
192
+ end
193
+ ```
194
+
195
+ #### ry:use
196
+
197
+ Sets current Ruby version, which can be provided as an argument. If you don't provide a version, the default Ruby version will be used.
198
+
199
+ Example usage:
200
+ ```ruby
201
+ # config/deploy.rb
202
+ task :deploy do
203
+ deploy do
204
+ invoke :'ry:use', '3.0.0' # or don't set a param if you want to use the default version
205
+ end
206
+ end
207
+ ```
208
+
209
+ #### ry
210
+
211
+ Convenience task which invokes `ry:load` and `ry:use`. Ruby version can be provided as an argument or left blank to use the default version (same as `ry:use`).
212
+
213
+ Example usage:
214
+ ```ruby
215
+ # config/deploy.rb
216
+ task :deploy do
217
+ deploy do
218
+ invoke :ry, '3.0.0'
219
+ end
220
+ end
221
+ ```
222
+
223
+ ## Development
224
+
225
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests.
226
+
227
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
228
+
229
+ ## Contributing
230
+
231
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mina-deploy/mina-version_managers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/mina-version_managers/blob/main/CODE_OF_CONDUCT.md).
232
+
233
+ ## License
234
+
235
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
236
+
237
+ ## Code of Conduct
238
+
239
+ Everyone interacting in the Mina::VersionManagers project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/mina-version_managers/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'mina/version_managers'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mina
4
+ module VersionManagers
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mina'
4
+
5
+ require_relative 'version_managers/version'
6
+
7
+ Rake::TaskManager.record_task_metadata = true
8
+
9
+ module Mina
10
+ module VersionManagers
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/mina/version_managers/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'mina-version_managers'
7
+ spec.version = Mina::VersionManagers::VERSION
8
+ spec.authors = ['Lovro Bikić']
9
+ spec.email = ['lovro.bikic@gmail.com']
10
+
11
+ spec.summary = 'Mina plugin for version managers'
12
+ spec.homepage = 'https://github.com/mina-deploy/mina-version_managers'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/mina-deploy/mina-version_managers'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/mina-deploy/mina-version_managers/blob/master/CHANGELOG.md'
19
+ spec.metadata['rubygems_mfa_required'] = 'true'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
+ end
26
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib', 'tasks']
28
+
29
+ spec.add_dependency 'mina', '>= 1.0.0'
30
+
31
+ spec.add_development_dependency 'pry'
32
+ spec.add_development_dependency 'rspec'
33
+ spec.add_development_dependency 'rubocop'
34
+ spec.add_development_dependency 'rubocop-rspec'
35
+ spec.add_development_dependency 'simplecov'
36
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ set :chruby_path, '/etc/profile.d/chruby.sh'
4
+
5
+ namespace :chruby do
6
+ desc 'Load chruby environment'
7
+ task :load do
8
+ ensure!(:chruby_path, message: "chruby path hasn't been set (check :chruby_path variable)")
9
+
10
+ comment 'Loading chruby environment'
11
+ command %(
12
+ if [[ ! -s "#{fetch(:chruby_path)}" ]]; then
13
+ echo "! chruby.sh init file not found"
14
+ exit 1
15
+ fi
16
+ )
17
+ command %(source #{fetch(:chruby_path)})
18
+ end
19
+
20
+ desc 'Set current Ruby version'
21
+ task :set, :ruby_version do |_, args|
22
+ unless args[:ruby_version]
23
+ puts "Task 'chruby:set' needs a Ruby version as an argument."
24
+ puts "Example: invoke :'chruby:set', 'ruby-2.4'"
25
+ exit 1
26
+ end
27
+
28
+ comment %(Setting Ruby version to: \\"#{args[:ruby_version]}\\")
29
+ command %(chruby "#{args[:ruby_version]}" || exit 1)
30
+ end
31
+ end
32
+
33
+ desc 'Load chruby environment and set current Ruby version'
34
+ task :chruby, :ruby_version do |_, args|
35
+ unless args[:ruby_version]
36
+ puts "Task 'chruby' needs a Ruby version as an argument."
37
+ puts "Example: invoke :chruby, 'ruby-2.4'"
38
+ exit 1
39
+ end
40
+
41
+ invoke :'chruby:load'
42
+ invoke :'chruby:set', args[:ruby_version]
43
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ set :rbenv_path, '$HOME/.rbenv'
4
+
5
+ namespace :rbenv do
6
+ desc 'Load rbenv environment'
7
+ task :load do
8
+ ensure!(:rbenv_path, message: "rbenv path hasn't been set (check :rbenv_path variable)")
9
+
10
+ comment %(Loading rbenv environment)
11
+ command %(export RBENV_ROOT="#{fetch(:rbenv_path)}")
12
+ command %(export PATH="#{fetch(:rbenv_path)}/bin:$PATH")
13
+ command %(
14
+ if ! which rbenv >/dev/null; then
15
+ echo "! rbenv not found"
16
+ echo "! If rbenv is installed, check your :rbenv_path variable."
17
+ exit 1
18
+ fi
19
+ )
20
+ command %{eval "$(rbenv init -)"}
21
+ end
22
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ set :rvm_use_path, '$HOME/.rvm/scripts/rvm'
4
+
5
+ namespace :rvm do
6
+ desc 'Load RVM environment'
7
+ task :load do
8
+ ensure!(:rvm_use_path, message: "RVM path hasn't been set (check :rvm_use_path variable)")
9
+
10
+ comment 'Loading RVM environment'
11
+ command %(
12
+ if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
13
+ echo "! Ruby Version Manager not found"
14
+ echo "! If RVM is installed, check your :rvm_use_path variable."
15
+ exit 1
16
+ fi
17
+ )
18
+ command %(source #{fetch(:rvm_use_path)})
19
+ end
20
+
21
+ desc 'Load RVM environment and set current Ruby version'
22
+ task :use, :env do |_, args|
23
+ unless args[:env]
24
+ puts "Task 'rvm:use' needs an RVM environment name as an argument."
25
+ puts "Example: invoke :'rvm:use', 'ruby-1.9.2@default'"
26
+ exit 1
27
+ end
28
+
29
+ invoke :'rvm:load'
30
+
31
+ comment %(Using RVM environment \\\"#{args[:env]}\\\")
32
+ command %(rvm use "#{args[:env]}" --create)
33
+ end
34
+
35
+ desc 'Load RVM environment and create an RVM wrapper'
36
+ task :wrapper, :env, :name, :bin do |_, args|
37
+ unless args[:env] && args[:name] && args[:bin]
38
+ puts "Task 'rvm:wrapper' needs an RVM environment name, a wrapper name and the binary name as arguments"
39
+ puts "Example: invoke :'rvm:wrapper', 'ruby-1.9.2@myapp', 'myapp', 'unicorn_rails'"
40
+ exit 1
41
+ end
42
+
43
+ invoke :'rvm:load'
44
+
45
+ comment "Creating RVM wrapper \"#{args[:name]}_#{args[:bin]}\" using \\\"#{args[:env]}\\\""
46
+ command "rvm wrapper #{args[:env]} #{args[:name]} #{args[:bin]} || exit 1"
47
+ end
48
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ set :ry_path, '$HOME/.local'
4
+
5
+ namespace :ry do
6
+ desc 'Load ry environment'
7
+ task :load do
8
+ ensure!(:ry_path, message: "ry path hasn't been set (check :ry_path variable)")
9
+
10
+ comment %(Loading ry environment)
11
+ command %(
12
+ if [[ ! -e "#{fetch(:ry_path)}/bin" ]]; then
13
+ echo "! ry not found"
14
+ echo "! If ry is installed, check your :ry_path variable."
15
+ exit 1
16
+ fi
17
+ )
18
+ command %(export PATH="#{fetch(:ry_path)}/bin:$PATH")
19
+ command %{eval "$(ry setup)"}
20
+ end
21
+
22
+ desc 'Set current ruby version'
23
+ task :use, :ruby_version do |_, args|
24
+ puts "Task 'ry:use' without an argument will use default Ruby version." unless args[:ruby_version]
25
+
26
+ comment %(Setting Ruby version to: \\"#{args[:ruby_version] || '**not specified**'}\\")
27
+ command %(RY_RUBY="#{args[:ruby_version]}")
28
+ command %(
29
+ if [ -n "$RY_RUBY" ]; then
30
+ #{echo_cmd 'ry use $RY_RUBY'} || exit 1
31
+ fi
32
+ )
33
+ end
34
+ end
35
+
36
+ desc 'Load ry environment and set current Ruby version'
37
+ task :ry, :env do |_, args|
38
+ invoke :'ry:load'
39
+ invoke :'ry:use', args[:env]
40
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-version_managers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Lovro Bikić
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-01-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mina
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - lovro.bikic@gmail.com
100
+ executables:
101
+ - console
102
+ - setup
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".github/workflows/test.yml"
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".rubocop.yml"
110
+ - CHANGELOG.md
111
+ - CODE_OF_CONDUCT.md
112
+ - Gemfile
113
+ - Gemfile.lock
114
+ - LICENSE
115
+ - README.md
116
+ - Rakefile
117
+ - bin/console
118
+ - bin/setup
119
+ - lib/mina/version_managers.rb
120
+ - lib/mina/version_managers/version.rb
121
+ - mina-version_managers.gemspec
122
+ - tasks/mina/version_managers/chruby.rb
123
+ - tasks/mina/version_managers/rbenv.rb
124
+ - tasks/mina/version_managers/rvm.rb
125
+ - tasks/mina/version_managers/ry.rb
126
+ homepage: https://github.com/mina-deploy/mina-version_managers
127
+ licenses:
128
+ - MIT
129
+ metadata:
130
+ homepage_uri: https://github.com/mina-deploy/mina-version_managers
131
+ source_code_uri: https://github.com/mina-deploy/mina-version_managers
132
+ changelog_uri: https://github.com/mina-deploy/mina-version_managers/blob/master/CHANGELOG.md
133
+ rubygems_mfa_required: 'true'
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ - tasks
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 2.5.0
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubygems_version: 3.2.3
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: Mina plugin for version managers
154
+ test_files: []