capistrano-exts 1.13.1 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.todo CHANGED
@@ -1,13 +1,16 @@
1
1
  <?xml version="1.0"?>
2
2
  <todo version="0.1.20">
3
- <note priority="veryhigh" time="1316597225" done="1316600338">
3
+ <note priority="veryhigh" time="1316597225" done="1316681063">
4
4
  Rename deploy:folders to deploy:setup:folders
5
5
  <comment>
6
6
  Can't be done, setup is a task
7
7
  </comment>
8
8
  </note>
9
- <note priority="high" time="1316510985">
9
+ <note priority="high" time="1316510985" done="1316681073">
10
10
  Add skip_table_on_sync configuration, if defined, we should not replace these tables on the target's database.
11
+ <comment>
12
+ Done in f2f0d1e4b53a6597c848de61df99470bd9a5f0b6
13
+ </comment>
11
14
  </note>
12
15
  <note priority="medium" time="1316510717">
13
16
  Add a postgresql receipt (The postgresql receipt should have the same tasks defined in mysql)
@@ -21,4 +24,7 @@
21
24
  <note priority="medium" time="1316594507">
22
25
  In the nginx template file, we need to define the error pages dynamically and not in a hardcoded way.
23
26
  </note>
27
+ <note priority="medium" time="1316681020">
28
+ Unicorn and God should have the roles dynamic, for instance it's common sence that it should be ran on the :web role, however my server requires it on the :app and not the :web.
29
+ </note>
24
30
  </todo>
data/README.md CHANGED
@@ -18,7 +18,7 @@ gem install capistrano-exts
18
18
  or add it to your Gemfile
19
19
 
20
20
  ```ruby
21
- gem 'capistrano-exts', '>=1.13.1', :require => false
21
+ gem 'capistrano-exts', '>=1.13.2', :require => false
22
22
  ```
23
23
 
24
24
  # Setup
data/TODO CHANGED
@@ -1,6 +1,3 @@
1
- - Add skip_table_on_sync configuration, if defined, we should not replace these tables on the target's database.
2
- (added Tue Sep 20 11:29:45 2011, incomplete, priority high)
3
-
4
1
  - Add a postgresql receipt (The postgresql receipt should have the same tasks defined in mysql)
5
2
  (added Tue Sep 20 11:25:17 2011, incomplete, priority medium)
6
3
 
@@ -12,3 +9,6 @@
12
9
 
13
10
  - In the nginx template file, we need to define the error pages dynamically and not in a hardcoded way.
14
11
  (added Wed Sep 21 10:41:47 2011, incomplete, priority medium)
12
+
13
+ - Unicorn and God should have the roles dynamic, for instance it's common sence that it should be ran on the :web role, however my server requires it on the :app and not the :web.
14
+ (added Thu Sep 22 10:43:40 2011, incomplete, priority medium)
@@ -295,7 +295,7 @@ set :rvm_ruby_string, "1.9.2"
295
295
 
296
296
  # where's god config ?
297
297
  # Default: "#{fetch :current_path}/config/god.rb"
298
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
298
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
299
299
 
300
300
  #
301
301
  #
@@ -294,7 +294,7 @@ set :rvm_ruby_string, "1.9.2"
294
294
 
295
295
  # where's god config ?
296
296
  # Default: "#{fetch :current_path}/config/god.rb"
297
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
297
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
298
298
 
299
299
  #
300
300
  #
@@ -294,7 +294,7 @@ set :rvm_ruby_string, "1.9.2"
294
294
 
295
295
  # where's god config ?
296
296
  # Default: "#{fetch :current_path}/config/god.rb"
297
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
297
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
298
298
 
299
299
  #
300
300
  #
@@ -295,7 +295,7 @@ set :rvm_ruby_string, "1.9.2"
295
295
 
296
296
  # where's god config ?
297
297
  # Default: "#{fetch :current_path}/config/god.rb"
298
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
298
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
299
299
 
300
300
  #
301
301
  #
@@ -295,7 +295,7 @@ set :rvm_ruby_string, "1.9.2"
295
295
 
296
296
  # where's god config ?
297
297
  # Default: "#{fetch :current_path}/config/god.rb"
298
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
298
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
299
299
 
300
300
  #
301
301
  #
@@ -295,7 +295,7 @@ set :rvm_ruby_string, "1.9.2"
295
295
 
296
296
  # where's god config ?
297
297
  # Default: "#{fetch :current_path}/config/god.rb"
298
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
298
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
299
299
 
300
300
  #
301
301
  #
@@ -295,7 +295,7 @@ set :rvm_ruby_string, "1.9.2"
295
295
 
296
296
  # where's god config ?
297
297
  # Default: "#{fetch :current_path}/config/god.rb"
298
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
298
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
299
299
 
300
300
  #
301
301
  #
@@ -308,7 +308,7 @@ set :rvm_ruby_string, "1.9.2"
308
308
 
309
309
  # where's god config ?
310
310
  # Default: "#{fetch :current_path}/config/god.rb"
311
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
311
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
312
312
 
313
313
  #
314
314
  #
@@ -308,7 +308,7 @@ set :rvm_ruby_string, "1.9.2"
308
308
 
309
309
  # where's god config ?
310
310
  # Default: "#{fetch :current_path}/config/god.rb"
311
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
311
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
312
312
 
313
313
  #
314
314
  #
@@ -36,7 +36,9 @@ Capistrano::Configuration.instance(:must_exist).load do
36
36
  #{try_sudo} mkdir -p #{fetch :deploy_to} &&
37
37
  #{try_sudo} mkdir -p #{backup_path} &&
38
38
  #{try_sudo} mkdir -p #{fetch :shared_path}/items &&
39
- #{try_sudo} mkdir -p #{shared_path}/__system__
39
+ #{try_sudo} mkdir -p #{fetch :shared_path}/__system__ &&
40
+ #{try_sudo} mkdir -p #{fetch :shared_path}/config &&
41
+ #{try_sudo} mkdir -p #{fetch :shared_path}/items
40
42
  CMD
41
43
 
42
44
  if exists? :logs_path
@@ -145,4 +145,10 @@ password: #{credentials[:pass]}
145
145
  end
146
146
  end
147
147
  end
148
+
149
+ # Tries bundle exec
150
+ # TODO: Do some real work here
151
+ def try_bundle_exec
152
+ "bundle exec"
153
+ end
148
154
  end
@@ -6,25 +6,25 @@ end
6
6
  Capistrano::Configuration.instance(:must_exist).load do
7
7
  namespace :god do
8
8
  desc "start god, this starts up unicorn server"
9
- task :start, :roles => :web, :except => {:no_release => true} do
9
+ task :start, :roles => :app, :except => {:no_release => true} do
10
10
  logs_path = fetch(:logs_path)
11
- god_config = fetch(:god_config, "#{fetch :current_path}/config/unicorn.rb")
11
+ god_config = fetch(:god_config, "#{fetch :current_path}/config/god.rb")
12
12
  god_binary = fetch(:god_binary, 'god')
13
- run "cd #{current_path} && #{god_binary} -c #{god_config} --log #{logs_path}/god.log --no-syslog --log-level warn"
13
+ run "cd #{current_path} && #{try_bundle_exec} #{god_binary} -c #{god_config} --log #{logs_path}/god.log --no-syslog --log-level warn"
14
14
  end
15
15
 
16
16
  desc "stop god, this shutdowns unicorn server"
17
- task :stop, :roles => :web, :except => {:no_release => true} do
18
- run "cd #{current_path} && #{god_binary} terminate"
17
+ task :stop, :roles => :app, :except => {:no_release => true} do
18
+ run "cd #{current_path} && #{try_bundle_exec} #{god_binary} terminate"
19
19
  end
20
20
 
21
21
  desc "restart god, this restarts the unicorn server"
22
- task :restart, :roles => :web, :except => {:no_release => true} do
23
- run "cd #{current_path} && #{god_binary} restart"
22
+ task :restart, :roles => :app, :except => {:no_release => true} do
23
+ run "cd #{current_path} && #{try_bundle_exec} #{god_binary} restart"
24
24
  end
25
25
 
26
26
  desc "check if god is already running"
27
- task :check_if_running, :roles => :web, :except => {:no_release => true} do
27
+ task :check_if_running, :roles => :app, :except => {:no_release => true} do
28
28
  'true' == capture("if #{god_binary} status; then echo 'true'; fi").strip
29
29
  end
30
30
  end
@@ -44,7 +44,7 @@ Capistrano::Configuration.instance(:must_exist).load do
44
44
  end
45
45
 
46
46
  # Database.yml file
47
- after "files:config_files", "rails:write_database_yml"
47
+ after "deploy:folders", "rails:write_database_yml"
48
48
  before "rails:write_database_yml", "mysql:credentials"
49
49
 
50
50
  # Restart the server
@@ -50,13 +50,19 @@ Capistrano::Configuration.instance(:must_exist).load do
50
50
  task :install_shell_wrapper do
51
51
  if exists?(:enable_rvm) && fetch(:enable_rvm) == true
52
52
  shell_contents = <<-EOS
53
- #!/bin/sh
54
- if test -d "#{fetch :rvm_path}"
55
- then
56
- #{fetch :rvm_shell} "$@"
57
- else
58
- exec bash "$@"
59
- fi
53
+ #!/bin/sh
54
+
55
+ if test -f /etc/profile
56
+ then
57
+ . /etc/profile
58
+ fi
59
+
60
+ if test -d "#{fetch :rvm_path}"
61
+ then
62
+ #{fetch :rvm_shell} "$@"
63
+ else
64
+ exec bash "$@"
65
+ fi
60
66
  EOS
61
67
 
62
68
  rvm_shell_wrapper_path = "/tmp/rvm_shell_wrapper.sh"
@@ -6,7 +6,7 @@ end
6
6
  Capistrano::Configuration.instance(:must_exist).load do
7
7
  namespace :unicorn do
8
8
  desc "[internal] Setup unicorn"
9
- task :setup, :roles => :web, :except => {:no_release => true} do
9
+ task :setup, :roles => :app, :except => {:no_release => true} do
10
10
  unicorn_pid = fetch(:unicorn_pid, "#{fetch :shared_path}/pids/unicorn.pid")
11
11
 
12
12
  # Create the pids folder
@@ -16,31 +16,33 @@ Capistrano::Configuration.instance(:must_exist).load do
16
16
  end
17
17
 
18
18
  desc "start unicorn"
19
- task :start, :roles => :web, :except => {:no_release => true} do
19
+ task :start, :roles => :app, :except => {:no_release => true} do
20
20
  unicorn_binary = fetch(:unicorn_binary, 'unicorn_rails')
21
21
  unicorn_config = fetch(:unicorn_config, "#{fetch :current_path}/config/unicorn.rb")
22
22
  rails_env = fetch(:rails_env, 'production')
23
- run "cd #{fetch :current_path} && #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
23
+ run "cd #{fetch :current_path} && #{try_bundle_exec} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
24
24
  end
25
25
 
26
26
  desc "stop unicorn"
27
- task :stop, :roles => :web, :except => {:no_release => true} do
28
- unicorn_pid = fetch(:unicorn_pid, )
27
+ task :stop, :roles => :app, :except => {:no_release => true} do
28
+ unicorn_pid = fetch(:unicorn_pid, "#{fetch :shared_path}/pids/unicorn.pid")
29
29
  run "#{try_sudo} kill `cat #{unicorn_pid}`"
30
30
  end
31
31
 
32
32
  desc "unicorn reload"
33
- task :reload, :roles => :web, :except => {:no_release => true} do
33
+ task :reload, :roles => :app, :except => {:no_release => true} do
34
+ unicorn_pid = fetch(:unicorn_pid, "#{fetch :shared_path}/pids/unicorn.pid")
34
35
  run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
35
36
  end
36
37
 
37
38
  desc "graceful stop unicorn"
38
- task :graceful_stop, :roles => :web, :except => {:no_release => true} do
39
+ task :graceful_stop, :roles => :app, :except => {:no_release => true} do
40
+ unicorn_pid = fetch(:unicorn_pid, "#{fetch :shared_path}/pids/unicorn.pid")
39
41
  run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
40
42
  end
41
43
 
42
44
  desc "restart unicorn"
43
- task :restart, :roles => :web, :except => {:no_release => true} do
45
+ task :restart, :roles => :app, :except => {:no_release => true} do
44
46
  stop
45
47
  start
46
48
  end
@@ -290,7 +290,7 @@ set :rvm_ruby_string, "1.9.2"
290
290
 
291
291
  # where's god config ?
292
292
  # Default: "#{fetch :current_path}/config/god.rb"
293
- # set :god_config, -> { "#{fetch :current_path}/config/unicorn.rb" }
293
+ # set :god_config, -> { "#{fetch :current_path}/config/god.rb" }
294
294
 
295
295
  #
296
296
  #
@@ -35,11 +35,11 @@ server {
35
35
  return 503;
36
36
  }
37
37
 
38
- # Catch the 503 error and send it to the @503 location
39
- error_page 503 @503;
38
+ # Catch the 503 error and send it to the @maintenance location
39
+ error_page 503 @maintenance;
40
40
 
41
- # The @503 location
42
- location @503 {
41
+ # The @maintenance location
42
+ location @maintenance {
43
43
  # Nginx will refuse POST requests to a static file and will throw a 405 error
44
44
  # So we need to catch that and display again our maintenance page
45
45
  error_page 405 = /__system__/maintenance/index.html;
@@ -3,7 +3,7 @@ module Capistrano
3
3
  module Version #:nodoc:
4
4
  MAJOR = 1
5
5
  MINOR = 13
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  ARRAY = [MAJOR, MINOR, TINY]
9
9
  STRING = ARRAY.join(".")
@@ -7,6 +7,12 @@ $: << ROOT_PATH if File.directory?(ROOT_PATH) and not $:.include?(ROOT_PATH)
7
7
  # Require our core extensions
8
8
  require 'capistrano-exts/core_ext'
9
9
 
10
+ # Require requested receipts
11
+ require 'capistrano-exts/receipts' if defined?(Capistrano::Configuration)
12
+
13
+ # Require all servers
14
+ Dir["#{ROOT_PATH}/capistrano-exts/servers/*.rb"].each { |f| require f }
15
+
10
16
  # require Capistrano colors
11
17
  require 'capistrano_colors'
12
18
  require 'capistrano/logger'
@@ -19,10 +25,4 @@ Capistrano::Logger.add_color_matcher({ :match => /adapter:|hostname:|username:|p
19
25
  Capistrano::Logger.add_color_matcher({ :match => /WARNING:/, :color => :yellow, :level => Capistrano::Logger::INFO, :prio => -20 })
20
26
 
21
27
  # Errors
22
- Capistrano::Logger.add_color_matcher({ :match => /ERROR:/, :color => :red, :level => Capistrano::Logger::IMPORTANT, :prio => -20 })
23
-
24
- # Require requested receipts
25
- require 'capistrano-exts/receipts' if defined?(Capistrano::Configuration)
26
-
27
- # Require all servers
28
- Dir["#{ROOT_PATH}/capistrano-exts/servers/*.rb"].each { |f| require f }
28
+ Capistrano::Logger.add_color_matcher({ :match => /ERROR:/, :color => :red, :level => Capistrano::Logger::IMPORTANT, :prio => -20 })
@@ -18,11 +18,11 @@ server {
18
18
  return 503;
19
19
  }
20
20
 
21
- # Catch the 503 error and send it to the @503 location
22
- error_page 503 @503;
21
+ # Catch the 503 error and send it to the @maintenance location
22
+ error_page 503 @maintenance;
23
23
 
24
- # The @503 location
25
- location @503 {
24
+ # The @maintenance location
25
+ location @maintenance {
26
26
  # Nginx will refuse POST requests to a static file and will throw a 405 error
27
27
  # So we need to catch that and display again our maintenance page
28
28
  error_page 405 = /__system__/maintenance/index.html;
@@ -20,11 +20,11 @@ server {
20
20
  return 503;
21
21
  }
22
22
 
23
- # Catch the 503 error and send it to the @503 location
24
- error_page 503 @503;
23
+ # Catch the 503 error and send it to the @maintenance location
24
+ error_page 503 @maintenance;
25
25
 
26
- # The @503 location
27
- location @503 {
26
+ # The @maintenance location
27
+ location @maintenance {
28
28
  # Nginx will refuse POST requests to a static file and will throw a 405 error
29
29
  # So we need to catch that and display again our maintenance page
30
30
  error_page 405 = /__system__/maintenance/index.html;
@@ -16,11 +16,11 @@ server {
16
16
  return 503;
17
17
  }
18
18
 
19
- # Catch the 503 error and send it to the @503 location
20
- error_page 503 @503;
19
+ # Catch the 503 error and send it to the @maintenance location
20
+ error_page 503 @maintenance;
21
21
 
22
- # The @503 location
23
- location @503 {
22
+ # The @maintenance location
23
+ location @maintenance {
24
24
  # Nginx will refuse POST requests to a static file and will throw a 405 error
25
25
  # So we need to catch that and display again our maintenance page
26
26
  error_page 405 = /__system__/maintenance/index.html;
@@ -16,11 +16,11 @@ server {
16
16
  return 503;
17
17
  }
18
18
 
19
- # Catch the 503 error and send it to the @503 location
20
- error_page 503 @503;
19
+ # Catch the 503 error and send it to the @maintenance location
20
+ error_page 503 @maintenance;
21
21
 
22
- # The @503 location
23
- location @503 {
22
+ # The @maintenance location
23
+ location @maintenance {
24
24
  # Nginx will refuse POST requests to a static file and will throw a 405 error
25
25
  # So we need to catch that and display again our maintenance page
26
26
  error_page 405 = /__system__/maintenance/index.html;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-exts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.13.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-21 00:00:00.000000000 Z
12
+ date: 2011-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2153620640 !ruby/object:Gem::Requirement
16
+ requirement: &2152862420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153620640
24
+ version_requirements: *2152862420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capistrano_colors
27
- requirement: &2153620180 !ruby/object:Gem::Requirement
27
+ requirement: &2152857600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.5.5
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153620180
35
+ version_requirements: *2152857600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &2153619600 !ruby/object:Gem::Requirement
38
+ requirement: &2157929640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.6.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153619600
46
+ version_requirements: *2157929640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &2153619140 !ruby/object:Gem::Requirement
49
+ requirement: &2157929180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153619140
57
+ version_requirements: *2157929180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard
60
- requirement: &2153618660 !ruby/object:Gem::Requirement
60
+ requirement: &2157928720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.6.2
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153618660
68
+ version_requirements: *2157928720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-bundler
71
- requirement: &2153618200 !ruby/object:Gem::Requirement
71
+ requirement: &2157928260 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.1.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153618200
79
+ version_requirements: *2157928260
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-rspec
82
- requirement: &2153617700 !ruby/object:Gem::Requirement
82
+ requirement: &2157927800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.4.3
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153617700
90
+ version_requirements: *2157927800
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec
93
- requirement: &2153617220 !ruby/object:Gem::Requirement
93
+ requirement: &2157927340 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 2.6.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2153617220
101
+ version_requirements: *2157927340
102
102
  description: ! 'Capistrano exts is a set of helper tasks to help with the initial
103
103
  server
104
104