capistrano-node-deploy 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -20,7 +20,7 @@ First install the gem:
20
20
 
21
21
  or add it to your `Gemfile` if you have one:
22
22
 
23
- gem "capistrano-rails-deploy", "~> 1.0.0"
23
+ gem "capistrano-rails-deploy"
24
24
 
25
25
  Now add the following to your `Capfile`
26
26
 
@@ -44,11 +44,20 @@ Full Capfile Example
44
44
  Overriding Default Settings
45
45
  ---------------------------
46
46
 
47
- # Override your node binary path
48
- set :node_binary, "/usr/bin/coffee"
47
+ # Set app command to run (defaults to index.js, or your `main` file from `package.json`)
48
+ set :app_command, "my_server.coffee"
49
49
 
50
- # Override your app command
51
- set :app_command, "index.coffee --environment production"
50
+ # Set node binary to run (defaults to /usr/bin/node)
51
+ set :node_binary, "/usr/bin/coffee"
52
+
53
+ # Set node environment (defaults to production)
54
+ set :node_env, "staging"
55
+
56
+ # Set the user to run node as (defaults to deploy)
57
+ set :node_user, "james"
58
+
59
+ # Set the name of the upstart command (defaults to #{application}-#{node_env})
60
+ set :upstart_job_name, "myserver"
52
61
 
53
62
 
54
63
  Contributing to capistrano-node-deploy
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-node-deploy"
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Smith"]
@@ -14,7 +14,7 @@ respawn
14
14
  respawn limit 99 5
15
15
 
16
16
  script
17
- exec sudo -u {{node_user}} NODE_ENV={{node_env}} {{node_binary}} {{current_path}}/{{app_command}} 2>> {{shared_path}}/{{node_env}}.err.log 1>> {{shared_path}}/{{node_env}}.out.log
17
+ 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
18
18
  end script
19
19
  EOD
20
20
 
@@ -38,29 +38,29 @@ end
38
38
  Capistrano::Configuration.instance(:must_exist).load do |configuration|
39
39
  before "deploy", "deploy:create_release_dir"
40
40
  before "deploy", "node:check_upstart_config"
41
- after "deploy:finalize_update", "node:install_packages"
42
- after "deploy:finalize_update", "node:restart"
41
+ after "deploy:update", "node:install_packages", "node:restart"
43
42
  after "deploy:rollback", "node:restart"
44
43
 
45
44
  package_json = MultiJson.load(File.open("package.json").read) rescue {}
46
45
 
47
46
  set :application, package_json["name"] unless defined? application
48
47
  set :app_command, package_json["main"] || "index.js" unless defined? app_command
48
+ set :app_environment, "" unless defined? app_environment
49
49
 
50
50
  set :node_binary, "/usr/bin/node" unless defined? node_binary
51
51
  set :node_env, "production" unless defined? node_env
52
52
  set :node_user, "deploy" unless defined? node_user
53
53
 
54
- set :upstart_job_name, "#{application}-#{node_env}" unless defined? upstart_job_name
55
- set :upstart_file_path, "/etc/init/#{upstart_job_name}.conf" unless defined? upstart_file_path
54
+ set :upstart_job_name, lambda { "#{application}-#{node_env}" } unless defined? upstart_job_name
55
+ set :upstart_file_path, lambda { "/etc/init/#{upstart_job_name}.conf" } unless defined? upstart_file_path
56
56
 
57
57
  namespace :node do
58
58
  desc "Check required packages and install if packages are not installed"
59
59
  task :install_packages do
60
60
  run "mkdir -p #{shared_path}/node_modules"
61
- run "cp #{current_path}/package.json #{shared_path}"
61
+ run "cp #{release_path}/package.json #{shared_path}"
62
62
  run "cd #{shared_path} && npm install"
63
- run "ln -s #{shared_path}/node_modules #{current_path}/node_modules"
63
+ run "ln -s #{shared_path}/node_modules #{release_path}/node_modules"
64
64
  end
65
65
 
66
66
  task :check_upstart_config do
@@ -91,7 +91,7 @@ Capistrano::Configuration.instance(:must_exist).load do |configuration|
91
91
 
92
92
  desc "Restart the node application"
93
93
  task :restart do
94
- sudo "stop #{upstart_job_name}"
94
+ sudo "stop #{upstart_job_name}; true"
95
95
  sudo "start #{upstart_job_name}"
96
96
  end
97
97
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-node-deploy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith