lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.2.0 vs lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.2.1
- old
+ new
@@ -12,11 +12,11 @@
respawn
respawn limit 99 5
script
- exec sudo -u {{node_user}} NODE_ENV={{node_env}} {{app_environment}} {{node_binary}} {{current_path}}/{{app_command}} 2>> {{shared_path}}/{{node_env}}.err.log 1>> {{shared_path}}/{{node_env}}.out.log
+ cd {{current_path}} && exec sudo -u {{node_user}} NODE_ENV={{node_env}} {{app_environment}} {{node_binary}} {{current_path}}/{{app_command}} 2>> {{shared_path}}/{{node_env}}.err.log 1>> {{shared_path}}/{{node_env}}.out.log
end script
EOD
def remote_file_exists?(full_path)
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
@@ -57,10 +57,10 @@
namespace :node do
desc "Check required packages and install if packages are not installed"
task :install_packages do
run "mkdir -p #{shared_path}/node_modules"
run "cp #{release_path}/package.json #{shared_path}"
- run "cd #{shared_path} && npm install"
+ run "cd #{shared_path} && npm install #{(node_env == 'production') ? '--production' : ''}"
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, generate_upstart_config)
\ No newline at end of file