lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.0.3 vs lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.0.4
- old
+ new
@@ -20,10 +20,11 @@
def remote_file_exists?(full_path)
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
end
Capistrano::Configuration.instance(:must_exist).load do |configuration|
+ before "deploy", "deploy:create_release_dir"
before "deploy", "node:create_upstart_config"
after "deploy:symlink", "node:install_packages"
after "deploy:symlink", "node:restart"
package_json = MultiJson.load(File.open("package.json").read) rescue {}
@@ -67,8 +68,16 @@
end
desc "Restart the node application"
task :restart do
sudo "restart #{application} || sudo start #{application}"
+ end
+ end
+
+ namespace :deploy do
+ task :create_release_dir, :except => {:no_release => true} do
+ mkdir_releases = "mkdir -p #{fetch :releases_path}"
+ mkdir_commands = ["log", "pids"].map {|dir| "mkdir -p #{shared_path}/#{dir}"}
+ run mkdir_commands.unshift(mkdir_releases).join(" && ")
end
end
end
\ No newline at end of file