Skip to content

Commit 185e6bb

Browse files
committed
move to sshkit prefixes to fix compatibility with capistrano-bundler, update rvm#7
1 parent 7741dd0 commit 185e6bb

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ It will automatically:
2828
- detect Gemfile and use `bundle exec`
2929
- create the gemset if not existing already
3030

31-
**Warning**, `capistrano-bundler` was reported to break this gem,
32-
it is not needed, use this instead:
33-
34-
before 'deploy:updated', 'rvm:install:gems'
35-
3631
## Install RVM 1.x
3732

3833
This task will install stable version of rvm in `$HOME/.rvm`:
@@ -65,7 +60,9 @@ it's not recommended to involve this option unless you really understand implica
6560

6661
## Install Gems
6762

68-
This task will install gems from the project `Gemfile`:
63+
This task replaces `capistrano-bundler` gem use only one at time
64+
65+
This will install gems from the project `Gemfile`:
6966
```bash
7067
cap rvm1:install:gems
7168
```
@@ -80,6 +77,10 @@ Right now all gems in Gemfile will be installed into gemset.
8077
Support for `Gemfile` installation in Rubygems is still young,
8178
we will improve it with new RG releases.
8279

80+
- RG 2.0-2.1 - support for gem + version in `Gemfile`
81+
- RG 2.2 - limited support for `Gemfile.lock` - work still in progress,
82+
test with `rvm rubygems head`
83+
8384
## Configuration
8485

8586
Well if you really need to there are available ways:

lib/rvm1/tasks/capistrano3.rake

+13-23
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
SSHKit.config.command_map = Hash.new do |hash, key|
2-
if fetch(:rvm1_map_bins).include?(key.to_s)
3-
hash[key] = "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh #{fetch(:rvm1_ruby_version)} #{key}"
4-
elsif key.to_s == "rvm"
5-
hash[key] = "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh #{key}"
6-
else
7-
hash[key] = key
8-
end
9-
end
10-
111
namespace :rvm1 do
122
desc "Runs the RVM1 hook - use it before any custom tasks if necessary"
133
task :hook do
14-
unless fetch(:rvm1_hooked)
15-
invoke :'rvm1:init'
16-
set :rvm1_hooked, true
4+
on roles(:all) do
5+
execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
6+
upload! File.expand_path("../../../../script/rvm-auto.sh", __FILE__), "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh"
7+
execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh"
8+
end
9+
10+
SSHKit.config.command_map[:rvm] = "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh"
11+
12+
rvm_prefix = "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh #{fetch(:rvm1_ruby_version)}"
13+
fetch(:rvm1_map_bins).each do |command|
14+
SSHKit.config.command_map.prefix[command.to_sym].unshift(rvm_prefix)
1715
end
1816
end
1917

@@ -31,14 +29,6 @@ namespace :rvm1 do
3129
before :check, "deploy:updating"
3230
before :check, 'rvm1:hook'
3331

34-
task :init do
35-
on roles(:all) do
36-
execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
37-
upload! File.expand_path("../../../../script/rvm-auto.sh", __FILE__), "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh"
38-
execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/rvm-auto.sh"
39-
end
40-
end
41-
4232
end
4333

4434
namespace :load do
@@ -48,6 +38,6 @@ namespace :load do
4838
end
4939
end
5040

51-
namespace :deploy do
52-
after :starting, 'rvm1:hook'
41+
Capistrano::DSL.stages.each do |stage|
42+
after stage, 'rvm1:hook'
5343
end

rvm1-capistrano3.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
1515
spec.license = 'Apache 2'
1616

1717
spec.add_dependency 'capistrano', '~>3.0'
18+
spec.add_dependency 'sshkit', '>=1.2'
1819
spec.add_development_dependency 'tf', '~>0.4.3'
1920

2021
spec.files = Dir.glob('{lib,script}/**/*.{rb,rake,sh}')

0 commit comments

Comments
 (0)