Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to require without hooks #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ Require in Capfile to use the default task:

And you should be good to go!

### Explicitely require hooks

Alternatively, if you want to have control on the execution of nvm tasks

```ruby
# Capfile
require capistrano/rbenv/without_hooks
```

You can then add the hooks on a per deploy script basis

```ruby
# config/deploy/my_stage_with_rvm.rb
Capistrano::DSL.stages.each do |stage|
after stage, 'rvm:hook'
after stage, 'rvm:check'
end
```

## Configuration

Everything *should work* for a basic RVM setup *out of the box*.
Expand Down
4 changes: 4 additions & 0 deletions lib/capistrano/hooks/rvm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Capistrano::DSL.stages.each do |stage|
after stage, 'rvm:hook'
after stage, 'rvm:check'
end
1 change: 1 addition & 0 deletions lib/capistrano/rvm/without_hooks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
load File.expand_path('../../tasks/rvm.rake', __FILE__)
2 changes: 2 additions & 0 deletions lib/capistrano/tasks/deploy_rvm.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
load File.expand_path('../rvm.rake', __FILE__)
load File.expand_path('../../hooks/rvm.rb', __FILE__)
5 changes: 0 additions & 5 deletions lib/capistrano/tasks/rvm.rake
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ namespace :rvm do
end
end

Capistrano::DSL.stages.each do |stage|
after stage, 'rvm:hook'
after stage, 'rvm:check'
end

namespace :load do
task :defaults do
set :rvm_map_bins, %w{gem rake ruby bundle}
Expand Down