lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.2.12 vs lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.2.13
- old
+ new
@@ -36,10 +36,11 @@
set :application, package_json["name"] unless defined? application
set :app_command, package_json["main"] || "index.js" unless defined? app_command
set :app_environment, "" unless defined? app_environment
set :node_binary, "/usr/bin/node" unless defined? node_binary
+ set :npm_binary, "/usr/bin/npm" unless defined? npm_binary
set :node_env, "production" unless defined? node_env
set :node_user, "deploy" unless defined? node_user
set :stdout_log_path, lambda { "#{shared_path}/log/#{node_env}.out.log" }
set :stderr_log_path, lambda { "#{shared_path}/log/#{node_env}.err.log" }
@@ -66,11 +67,14 @@
namespace :node do
desc "Check required packages and install if packages are not installed"
task :install_packages do
- run "cp -r #{previous_release}/node_modules #{release_path}" if previous_release
- run "cd #{release_path} && npm install --loglevel warn"
+ run "mkdir -p #{shared_path}/node_modules"
+ run "cp #{release_path}/package.json #{shared_path}"
+ run "cp #{release_path}/npm-shrinkwrap.json #{shared_path}" if remote_file_exists?("#{release_path}/npm-shrinkwrap.json")
+ run "cd #{shared_path} && #{npm_binary} install --loglevel warn"
+ run "ln -s #{shared_path}/node_modules #{release_path}/node_modules"
end
task :check_upstart_config do
create_upstart_config if remote_file_differs?(upstart_file_path, upstart_file_contents)
end