Skip to content

Commit

Permalink
allow for multiple node paths
Browse files Browse the repository at this point in the history
fixes #7
  • Loading branch information
koenpunt committed Oct 25, 2015
1 parent a4839c6 commit f7f37da
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/capistrano/tasks/nvm.cap
Expand Up @@ -7,8 +7,11 @@ namespace :nvm do
exit 1
end

unless test "[ -d #{fetch(:nvm_node_path)} ]"
error "nvm: #{nvm_node} is not installed or not found in #{fetch(:nvm_node_path)}"
nvm_node_path = fetch(:nvm_node_path)
nvm_node_path = [nvm_node_path] unless nvm_node_path.is_a?(Array)

unless test(nvm_node_path.map {|p| "[ -d #{p} ]" }.join(" || "))
error "nvm: #{nvm_node} is not installed or not found in any of #{nvm_node_path.join(" ")}"
exit 1
end
end
Expand Down Expand Up @@ -49,7 +52,7 @@ namespace :load do
}

set :nvm_roles, fetch(:nvm_roles, :all)
set :nvm_node_path, -> { "#{fetch(:nvm_path)}/#{fetch(:nvm_node)}" }
set :nvm_node_path, -> { ["#{fetch(:nvm_path)}/#{fetch(:nvm_node)}", "#{fetch(:nvm_path)}/versions/node/#{fetch(:nvm_node)}"] }
set :nvm_map_bins, %w{node npm}
end
end

0 comments on commit f7f37da

Please sign in to comment.