chicken_soup 0.4.1 → 0.5.0

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.
Files changed (26) hide show
  1. data/lib/chicken_soup/capabilities/apache/apache-checks.rb +11 -9
  2. data/lib/chicken_soup/capabilities/bundler/bundler-checks.rb +12 -9
  3. data/lib/chicken_soup/capabilities/bundler/bundler-defaults.rb +2 -0
  4. data/lib/chicken_soup/capabilities/bundler/bundler-tasks.rb +6 -1
  5. data/lib/chicken_soup/capabilities/checks.rb +22 -7
  6. data/lib/chicken_soup/capabilities/heroku/heroku-checks.rb +14 -12
  7. data/lib/chicken_soup/capabilities/nginx/nginx-checks.rb +11 -9
  8. data/lib/chicken_soup/capabilities/passenger/passenger-defaults.rb +10 -0
  9. data/lib/chicken_soup/capabilities/postgres/postgres-checks.rb +8 -6
  10. data/lib/chicken_soup/capabilities/rvm/rvm-checks.rb +29 -11
  11. data/lib/chicken_soup/capabilities/rvm/rvm-defaults.rb +15 -3
  12. data/lib/chicken_soup/capabilities/rvm/rvm-tasks.rb +27 -0
  13. data/lib/chicken_soup/capabilities/shared/db-checks.rb +26 -9
  14. data/lib/chicken_soup/capabilities/shared/db-defaults.rb +1 -0
  15. data/lib/chicken_soup/capabilities/shared/db-tasks.rb +26 -8
  16. data/lib/chicken_soup/capabilities/shared/web_server-tasks.rb +10 -4
  17. data/lib/chicken_soup/capabilities/unix/unix-checks.rb +25 -23
  18. data/lib/chicken_soup/deploy.rb +1 -4
  19. data/lib/chicken_soup/environment/checks.rb +24 -11
  20. data/lib/chicken_soup/environment.rb +1 -1
  21. data/lib/chicken_soup/global.rb +11 -0
  22. data/lib/chicken_soup/notifiers/checks.rb +22 -7
  23. data/lib/chicken_soup/notifiers/email/email-checks.rb +17 -15
  24. data/lib/chicken_soup/notifiers/tasks.rb +9 -0
  25. data/lib/chicken_soup/version.rb +1 -1
  26. metadata +59 -54
@@ -3,16 +3,18 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary Apache capabilities variables have been set up.
9
- DESC
10
- task :apache do
11
- required_variables = [
12
- :web_server_control_script
13
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary Apache capabilities variables have been set up.
10
+ DESC
11
+ task :apache do
12
+ required_variables = [
13
+ :web_server_control_script
14
+ ]
14
15
 
15
- verify_variables(required_variables)
16
+ verify_variables(required_variables)
17
+ end
16
18
  end
17
19
  end
18
20
  end
@@ -3,16 +3,19 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary Bundler capabilities variables have been set up.
9
- DESC
10
- task :bundler do
11
- required_variables = [
12
- :gem_packager_version
13
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary Bundler capabilities variables have been set up.
10
+ DESC
11
+ task :bundler do
12
+ required_variables = [
13
+ :gem_packager_version,
14
+ :gem_packager_gem_path
15
+ ]
14
16
 
15
- verify_variables(required_variables)
17
+ verify_variables(required_variables)
18
+ end
16
19
  end
17
20
  end
18
21
  end
@@ -7,6 +7,8 @@ Capistrano::Configuration.instance(:must_exist).load do
7
7
  desc "[internal] Sets intelligent defaults for Bundler deployments."
8
8
  task :bundler do
9
9
  _cset :gem_packager_version, `gem list bundler`.match(/\((.*)\)/)[1]
10
+ _cset :gem_packager_gem_path, "#{shared_path}/bundle"
11
+
10
12
  set :rake, "RAILS_ENV=#{rails_env} bundle exec rake"
11
13
  end
12
14
  end
@@ -9,7 +9,7 @@ Capistrano::Configuration.instance(:must_exist).load do
9
9
  namespace :gems do
10
10
  desc "Install Bundled Gems"
11
11
  task :install, :roles => :app do
12
- run "cd #{latest_release} && bundle install --gemfile #{latest_release}/Gemfile --path #{shared_path}/bundle --deployment --quiet --without development test"
12
+ run_with_rvm rvm_ruby_string, "bundle install --gemfile #{latest_release}/Gemfile --path #{gem_packager_gem_path} --deployment --without development test"
13
13
  end
14
14
 
15
15
  desc "Update Bundled Gems"
@@ -18,6 +18,11 @@ Capistrano::Configuration.instance(:must_exist).load do
18
18
 
19
19
  run "cd #{latest_release} && bundle update"
20
20
  end
21
+
22
+ desc "Remove Bundled Gems"
23
+ task :clean, :roles => :app do
24
+ run "rm -rf #{gem_packager_gem_path}/*"
25
+ end
21
26
  end
22
27
 
23
28
  namespace :bundler do
@@ -2,15 +2,30 @@
2
2
  # CAPABILITIES CHECK #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- before 'capabilities:check', 'load_capability_checks'
5
+ before 'capabilities:variable:check', 'load_capability_checks'
6
6
 
7
7
  namespace :capabilities do
8
- namespace :check do
9
- desc "[internal] Runs checks for all of the capabilities listed."
10
- task :default do
11
- if exists?(:capabilities)
12
- fetch(:capabilities).each do |capability|
13
- top.capabilities.check.send(capability.to_s) if top.capabilities.check.respond_to?(capability.to_sym)
8
+ namespace :variable do
9
+ namespace :check do
10
+ desc "[internal] Runs variable checks for all of the capabilities listed."
11
+ task :default do
12
+ if exists?(:capabilities)
13
+ fetch(:capabilities).each do |capability|
14
+ top.capabilities.variable.check.send(capability.to_s) if top.capabilities.variable.check.respond_to?(capability.to_sym)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ namespace :deployment do
22
+ namespace :check do
23
+ desc "[internal] Runs deployment checks for all of the capabilities listed."
24
+ task :default do
25
+ if exists?(:capabilities)
26
+ fetch(:capabilities).each do |capability|
27
+ top.capabilities.deployment.check.send(capability.to_s) if top.capabilities.deployment.check.respond_to?(capability.to_sym)
28
+ end
14
29
  end
15
30
  end
16
31
  end
@@ -3,19 +3,21 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary Heroku environment variables have been set up.
9
- DESC
10
- task :heroku do
11
- required_variables = [
12
- :deploy_site_name,
13
- :user,
14
- :heroku_credentials_path,
15
- :heroku_credentials_file
16
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary Heroku environment variables have been set up.
10
+ DESC
11
+ task :heroku do
12
+ required_variables = [
13
+ :deploy_site_name,
14
+ :user,
15
+ :heroku_credentials_path,
16
+ :heroku_credentials_file
17
+ ]
17
18
 
18
- verify_variables(required_variables)
19
+ verify_variables(required_variables)
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -3,16 +3,18 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary Nginx capabilities variables have been set up.
9
- DESC
10
- task :nginx do
11
- required_variables = [
12
- :web_server_control_script
13
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary Nginx capabilities variables have been set up.
10
+ DESC
11
+ task :nginx do
12
+ required_variables = [
13
+ :web_server_control_script
14
+ ]
14
15
 
15
- verify_variables(required_variables)
16
+ verify_variables(required_variables)
17
+ end
16
18
  end
17
19
  end
18
20
  end
@@ -0,0 +1,10 @@
1
+ ######################################################################
2
+ # PASSENGER DEFAULTS #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ namespace :capabilities do
6
+ namespace :defaults do
7
+ set :application_server_type, :passenger
8
+ end
9
+ end
10
+ end
@@ -5,12 +5,14 @@ Capistrano::Configuration.instance(:must_exist).load do
5
5
  require 'chicken_soup/capabilities/shared/db-checks'
6
6
 
7
7
  namespace :capabilities do
8
- namespace :check do
9
- desc <<-DESC
10
- [internal] Checks to see if all necessary Postgres capabilities variables have been set up.
11
- DESC
12
- task :postgres do
13
- capabilities.check.db
8
+ namespace :variable do
9
+ namespace :check do
10
+ desc <<-DESC
11
+ [internal] Checks to see if all necessary Postgres capabilities variables have been set up.
12
+ DESC
13
+ task :postgres do
14
+ capabilities.variable.check.db
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -3,18 +3,36 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary RVM variables have been set up.
9
- DESC
10
- task :rvm do
11
- required_variables = [
12
- :ruby_version,
13
- :ruby_gemset,
14
- :rvm_ruby_string,
15
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary RVM variables have been set up.
10
+ DESC
11
+ task :rvm do
12
+ required_variables = [
13
+ :rvmrc_file,
14
+ :ruby_version,
15
+ :rvm_gemset,
16
+ :rvm_ruby_string,
17
+ ]
16
18
 
17
- verify_variables(required_variables)
19
+ verify_variables(required_variables)
20
+ end
21
+ end
22
+ end
23
+
24
+ namespace :deployment do
25
+ namespace :check do
26
+ task :rvm do
27
+ abort "Could not find an .rvmrc file at #{rvmrc_file}. To use the RVM capability, you must have a valid local .rvmrc file." unless File.exist?(rvmrc_file)
28
+
29
+ rvmrc_file_contents = capture("cat #{current_path}/.rvmrc", :roles => :app)
30
+ set :current_rvm_ruby_string, rvmrc_file_contents.match(ChickenSoup::RVM_INFO_FORMAT)[1]
31
+
32
+ unless ruby_version_update_pending
33
+ abort "'#{rvm_ruby_string}' does not match the version currently installed on the server (#{current_rvm_ruby_string}). Please run 'cap <environment> ruby:update deploy:subzero' if you would like to upgrade your Ruby version prior to deploying." unless current_rvm_ruby_string == rvm_ruby_string
34
+ end
35
+ end
18
36
  end
19
37
  end
20
38
  end
@@ -1,13 +1,25 @@
1
1
  ######################################################################
2
2
  # RVM DEFAULTS #
3
3
  ######################################################################
4
+ ChickenSoup::RVM_INFO_FORMAT = /^rvm.+\s(([a-zA-Z0-9\-\._]+)(?:@([a-zA-Z0-9\-\._]+))?)/
5
+
4
6
  Capistrano::Configuration.instance(:must_exist).load do
5
7
  namespace :capabilities do
6
8
  namespace :defaults do
7
- _cset :ruby_version, ENV["rvm_ruby_string"]
8
- _cset :ruby_gemset, ENV["GEM_HOME"].split('@')[1]
9
+ _cset :rvmrc_file, File.join(rails_root, '.rvmrc')
10
+ set :ruby_version_update_pending, false
11
+
12
+ _cset(:ruby_version) do
13
+ contents = File.read(rvmrc_file)
14
+ contents.match(ChickenSoup::RVM_INFO_FORMAT)[2]
15
+ end
16
+
17
+ _cset(:rvm_gemset) do
18
+ contents = File.read(rvmrc_file)
19
+ contents.match(ChickenSoup::RVM_INFO_FORMAT)[3]
20
+ end
9
21
 
10
- _cset(:rvm_ruby_string) {ruby_gemset ? "#{ruby_version}@#{ruby_gemset}" : ruby_version}
22
+ _cset(:rvm_ruby_string) {rvm_gemset ? "#{ruby_version}@#{rvm_gemset}" : ruby_version}
11
23
  end
12
24
  end
13
25
  end
@@ -4,3 +4,30 @@
4
4
  def run_with_rvm(ruby_env_string, command)
5
5
  run("rvm use #{ruby_env_string} && #{command}")
6
6
  end
7
+
8
+ Capistrano::Configuration.instance(:must_exist).load do
9
+ run_task 'ruby:update', :as => manager_username
10
+
11
+ namespace :ruby do
12
+ desc <<-DESC
13
+ During the deployment, the wrapper ruby executable used by the
14
+ application server will be switched to utilize the ruby sepecified
15
+ by the application.
16
+
17
+ Note: This is only available during a subzero deployment since the web
18
+ server will need to be restarted in order for the changes to take effect.
19
+ DESC
20
+ task :update do
21
+ if ruby_version_update_pending
22
+ after 'ruby:update', 'gems:clean', 'gems:install'
23
+
24
+ set :ruby_version_update_pending, false
25
+
26
+ run("rvm use --create #{rvm_ruby_string}")
27
+ run("rvm wrapper #{rvm_ruby_string} #{application_server_type}")
28
+ else
29
+ set :ruby_version_update_pending, true
30
+ end
31
+ end
32
+ end
33
+ end
@@ -3,16 +3,33 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary DB capabilities variables have been set up.
9
- DESC
10
- task :db do
11
- required_variables = [
12
- :skip_backup_before_migration
13
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary DB capabilities variables have been set up.
10
+ DESC
11
+ task :db do
12
+ required_variables = [
13
+ :skip_backup_before_migration,
14
+ :db_backups_path
15
+ ]
14
16
 
15
- verify_variables(required_variables)
17
+ verify_variables(required_variables)
18
+ end
19
+ end
20
+ end
21
+
22
+ namespace :deployment do
23
+ namespace :check do
24
+ desc <<-DESC
25
+ [internal] Checks to see if the DB is ready for deployment.
26
+ DESC
27
+ task :db, :roles => :db, :only => {:primary => true} do
28
+ backup_task_exists = capture("cd #{current_path} && #{rake} -T | grep db:backup | wc -l").chomp
29
+ abort("There must be a task named db:backup in order to deploy. If you do not want to backup your DB during deployments, set the skip_backup_before_migration variable to true in your deploy.rb.") if backup_task_exists == '0'
30
+
31
+ run "if [ ! -d #{db_backups_path} ]; then mkdir #{db_backups_path}; fi"
32
+ end
16
33
  end
17
34
  end
18
35
  end
@@ -7,6 +7,7 @@ Capistrano::Configuration.instance(:must_exist).load do
7
7
  desc "[internal] Sets intelligent defaults for DB deployments."
8
8
  task :db do
9
9
  _cset :skip_backup_before_migration, false
10
+ _cset :db_backups_path, "#{shared_path}/db_backups"
10
11
  end
11
12
  end
12
13
  end
@@ -10,8 +10,6 @@ Capistrano::Configuration.instance(:must_exist).load do
10
10
 
11
11
  before "deploy:migrate", "db:backup" unless skip_backup_before_migration
12
12
 
13
- before 'db:backup', 'db:backup:check'
14
-
15
13
  namespace :db do
16
14
  desc <<-DESC
17
15
  Calls the rake task `db:backup` on the server for the given environment.
@@ -23,15 +21,35 @@ Capistrano::Configuration.instance(:must_exist).load do
23
21
  DESC
24
22
  namespace :backup do
25
23
  task :default, :roles => :db, :only => {:primary => true} do
26
- run "cd #{current_path} && BACKUP_DIRECTORY=#{shared_path}/db_backups #{rake} db:backup"
24
+ run "cd #{current_path} && BACKUP_DIRECTORY=#{db_backups_path} #{rake} db:backup"
27
25
  end
26
+ end
27
+
28
+ desc <<-DESC
29
+ Creates an easy way to debug remote data locally.
30
+
31
+ * Running this task will create a dump file of all the data in the specified
32
+ environment.
33
+ * Copy the dump file to the local machine
34
+ * Drop and recreate all local databases
35
+ * Import the dump file
36
+ * Bring the local DB up-to-date with any local migrations
37
+ * Prepare the test environment
38
+ DESC
39
+ namespace :pull do
40
+ task :default, :roles => :db, :only => {:primary => true} do
41
+ db.backup.default
42
+ db.pull.latest
43
+ end
44
+
45
+ task :latest, :roles => :db, :only => {:primary => true} do
46
+ latest_backup = capture(%Q{ls #{db_backups_path} -xtC | head -n 1 | cut -d " " -f 1}).chomp
28
47
 
29
- desc "[internal] Used to check to see if the db:backup task exists on the server."
30
- task :check, :roles => :db do
31
- backup_task_exists = capture("cd #{current_path} && #{rake} -T | grep db:backup | wc -l").chomp
32
- abort("There must be a task named db:backup in order to deploy. If you do not want to backup your DB during deployments, set the skip_backup_before_migration variable to true in your deploy.rb.") if backup_task_exists == '0'
48
+ download_compressed "#{db_backups_path}/#{latest_backup}", "#{rails_root}/tmp/#{latest_backup}", :once => true
33
49
 
34
- run "if [ ! -d #{shared_path}/db_backups ]; then mkdir #{shared_path}/db_backups; fi"
50
+ `rake db:drop:all db:create:all`
51
+ `rails dbconsole development < #{rails_root}/tmp/#{latest_backup}`
52
+ `rake db:migrate db:test:prepare`
35
53
  end
36
54
  end
37
55
 
@@ -15,6 +15,12 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  before 'deploy', 'deploy:web:disable'
16
16
  after 'deploy', 'deploy:web:enable'
17
17
 
18
+ before 'deploy:subzero', 'web_server:stop'
19
+ after 'deploy:subzero', 'web_server:start'
20
+
21
+ before 'deploy:cold', 'website:disable'
22
+ after 'deploy:cold', 'website:enable'
23
+
18
24
  namespace :deploy do
19
25
  namespace :web do
20
26
  desc <<-DESC
@@ -78,22 +84,22 @@ Capistrano::Configuration.instance(:must_exist).load do
78
84
  namespace :web_server do
79
85
  desc "Stop the web server"
80
86
  task :stop, :roles => :web do
81
- run "#{sudo} #{web_server_control_script} stop"
87
+ run "#{sudo} #{web_server_control_script} stop", :pty => true
82
88
  end
83
89
 
84
90
  desc "Start the web server"
85
91
  task :start, :roles => :web do
86
- run "#{sudo} #{web_server_control_script} start"
92
+ run "#{sudo} #{web_server_control_script} start", :pty => true
87
93
  end
88
94
 
89
95
  desc "Restart the web server"
90
96
  task :restart, :roles => :web do
91
- run "#{sudo} #{web_server_control_script} restart"
97
+ run "#{sudo} #{web_server_control_script} restart", :pty => true
92
98
  end
93
99
 
94
100
  desc "Reloads the web server configuration"
95
101
  task :reload, :roles => :web do
96
- run "#{sudo} #{web_server_control_script} reload"
102
+ run "#{sudo} #{web_server_control_script} reload", :pty => true
97
103
  end
98
104
  end
99
105
  end
@@ -3,30 +3,32 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :capabilities do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary unix environment variables have been set up.
9
- DESC
10
- task :unix do
11
- required_variables = [
12
- :user,
13
- :deployment_username,
14
- :manager_username,
15
- :user_home,
16
- :deployment_user_home,
17
- :manager_user_home,
18
- :deploy_base_dir,
19
- :deploy_site_name,
20
- :deploy_to,
21
- :app_server_ip,
22
- :web_server_ip,
23
- :db_server_ip,
24
- :web_servers,
25
- :app_servers,
26
- :db_servers
27
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary unix environment variables have been set up.
10
+ DESC
11
+ task :unix do
12
+ required_variables = [
13
+ :user,
14
+ :deployment_username,
15
+ :manager_username,
16
+ :user_home,
17
+ :deployment_user_home,
18
+ :manager_user_home,
19
+ :deploy_base_dir,
20
+ :deploy_site_name,
21
+ :deploy_to,
22
+ :app_server_ip,
23
+ :web_server_ip,
24
+ :db_server_ip,
25
+ :web_servers,
26
+ :app_servers,
27
+ :db_servers
28
+ ]
28
29
 
29
- verify_variables(required_variables)
30
+ verify_variables(required_variables)
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -24,9 +24,7 @@ Capistrano::Configuration.instance(:must_exist).load do
24
24
  DESC
25
25
  task :cold do
26
26
  transaction do
27
- website.disable
28
27
  deploy.base
29
- website.enable
30
28
  end
31
29
  end
32
30
 
@@ -39,9 +37,8 @@ Capistrano::Configuration.instance(:must_exist).load do
39
37
  DESC
40
38
  task :subzero do
41
39
  transaction do
42
- web_server.stop
40
+ ruby.update
43
41
  deploy.base
44
- web_server.start
45
42
  end
46
43
  end
47
44
 
@@ -15,22 +15,35 @@
15
15
  #
16
16
  ######################################################################
17
17
  Capistrano::Configuration.instance(:must_exist).load do
18
- on :start, 'environment:check', :except => ['staging', 'production']
18
+ on :start, 'environment:variable:check', :except => ['staging', 'production']
19
+ before 'deploy', 'environment:deployment:check'
20
+ before 'deploy:cold', 'environment:deployment:check'
21
+ before 'deploy:subzero', 'environment:deployment:check'
19
22
 
20
- after 'environment:check', 'capabilities:check', 'notifiers:check'
23
+ after 'environment:variable:check', 'capabilities:variable:check', 'notifiers:variable:check'
24
+ after 'environment:deployment:check', 'capabilities:deployment:check', 'notifiers:deployment:check'
21
25
 
22
26
  namespace :environment do
23
- desc "[internal] Checks for environment variables shared among all deployment types."
24
- task :check do
25
- abort "You need to specify staging or production when you deploy. ie 'cap staging db:backup'" unless exists?(:rails_env)
26
- abort "You need to specify a deployment type in your application's 'deploy.rb' file. ie 'set :deployment_type, :heroku'" unless exists?(:deployment_type)
27
+ namespace :variable do
28
+ desc "[internal] Checks for environment variables shared among all deployment types."
29
+ task :check do
30
+ abort "You need to specify staging or production when you deploy. ie 'cap staging db:backup'" unless exists?(:rails_env)
31
+ abort "You need to specify a deployment type in your application's 'deploy.rb' file. ie 'set :deployment_type, :heroku'" unless exists?(:deployment_type)
27
32
 
28
- required_variables = [
29
- :application,
30
- :application_short
31
- ]
33
+ required_variables = [
34
+ :application,
35
+ :application_short
36
+ ]
32
37
 
33
- verify_variables(required_variables)
38
+ verify_variables(required_variables)
39
+ end
40
+ end
41
+
42
+ namespace :deployment do
43
+ desc "[internal] Attempts to ensure the deployment will be successful prior to attempting it."
44
+ task :check do
45
+ # Empty
46
+ end
34
47
  end
35
48
  end
36
49
  end
@@ -10,7 +10,7 @@ Capistrano::Configuration.instance(:must_exist).load do
10
10
  desc "[internal] Load the Chicken Soup environment"
11
11
  task :init do
12
12
  environment.defaults.default
13
- environment.check
13
+ environment.variable.check
14
14
  environment.load_tasks
15
15
  end
16
16
  end
@@ -120,3 +120,14 @@ end
120
120
  def require_if_exists(file)
121
121
  require file if File.exists?(File.join(File.dirname(__FILE__), '..', "#{file}.rb"))
122
122
  end
123
+
124
+ def download_compressed(remote, local, options = {})
125
+ remote_compressed_filename = "#{remote}.bz2"
126
+ local_compressed_filename = "#{local}.bz2"
127
+
128
+ run "bzip2 -zvck9 #{remote} > #{remote_compressed_filename}"
129
+ download remote_compressed_filename, local_compressed_filename, options
130
+
131
+ run "rm -f #{remote_compressed_filename}"
132
+ `bunzip2 -f #{local_compressed_filename} && rm -f #{local_compressed_filename}`
133
+ end
@@ -2,15 +2,30 @@
2
2
  # NOTIFIERS CHECK #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- before 'notifiers:check', 'load_notifier_checks'
5
+ before 'notifiers:variable:check', 'load_notifier_checks'
6
6
 
7
7
  namespace :notifiers do
8
- namespace :check do
9
- desc "[internal] Runs checks for all of the notifiers listed."
10
- task :default do
11
- if exists?(:notifiers)
12
- fetch(:notifiers).each do |notifier|
13
- top.notifiers.check.send(notifier.to_s) if top.notifiers.check.respond_to?(notifier.to_sym)
8
+ namespace :variable do
9
+ namespace :check do
10
+ desc "[internal] Runs checks for all of the notifiers listed."
11
+ task :default do
12
+ if exists?(:notifiers)
13
+ fetch(:notifiers).each do |notifier|
14
+ top.notifiers.variable.check.send(notifier.to_s) if top.notifiers.variable.check.respond_to?(notifier.to_sym)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ namespace :deployment do
22
+ namespace :check do
23
+ desc "[internal] Runs deployment checks for all of the notifiers listed."
24
+ task :default do
25
+ if exists?(:notifiers)
26
+ fetch(:notifiers).each do |notifier|
27
+ top.notifiers.deployment.check.send(notifier.to_s) if top.notifiers.deployment.check.respond_to?(notifier.to_sym)
28
+ end
14
29
  end
15
30
  end
16
31
  end
@@ -3,23 +3,25 @@
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :notifiers do
6
- namespace :check do
7
- desc <<-DESC
8
- [internal] Checks to see if all necessary email notification environment variables have been set up.
9
- DESC
10
- task :email do
11
- required_variables = [
12
- :email_notifier_client_recipients,
13
- :email_notifier_internal_recipients,
14
- :email_notifier_domain,
15
- :email_notifier_username,
16
- :email_notifier_password,
17
- :vc_log
18
- ]
6
+ namespace :variable do
7
+ namespace :check do
8
+ desc <<-DESC
9
+ [internal] Checks to see if all necessary email notification environment variables have been set up.
10
+ DESC
11
+ task :email do
12
+ required_variables = [
13
+ :email_notifier_client_recipients,
14
+ :email_notifier_internal_recipients,
15
+ :email_notifier_domain,
16
+ :email_notifier_username,
17
+ :email_notifier_password,
18
+ :vc_log
19
+ ]
19
20
 
20
- abort "You must specify either internal or client recipients in order to use the email notifier." if email_notifier_client_recipients.empty? && email_notifier_internal_recipients.empty?
21
+ abort "You must specify either internal or client recipients in order to use the email notifier." if email_notifier_client_recipients.empty? && email_notifier_internal_recipients.empty?
21
22
 
22
- verify_variables(required_variables)
23
+ verify_variables(required_variables)
24
+ end
23
25
  end
24
26
  end
25
27
  end
@@ -8,5 +8,14 @@ Capistrano::Configuration.instance(:must_exist).load do
8
8
  DESC
9
9
  task :load_tasks do
10
10
  end
11
+
12
+ desc <<-DESC
13
+ Disables all notifiers for the current deployment.
14
+
15
+ This task must be called prior to any of the `deploy` tasks.
16
+ DESC
17
+ task :disable do
18
+ set :notifiers, []
19
+ end
11
20
  end
12
21
  end
@@ -1,3 +1,3 @@
1
1
  module ChickenSoup
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,82 +1,84 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: chicken_soup
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.1
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.5.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - thekompanee
9
9
  - jfelchner
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-07-23 00:00:00.000000000 -05:00
13
+
14
+ date: 2011-08-08 00:00:00 -05:00
14
15
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
17
18
  name: capistrano
18
- requirement: &2157449740 !ruby/object:Gem::Requirement
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
19
21
  none: false
20
- requirements:
22
+ requirements:
21
23
  - - ~>
22
- - !ruby/object:Gem::Version
24
+ - !ruby/object:Gem::Version
23
25
  version: 2.6.0
24
26
  type: :runtime
25
- prerelease: false
26
- version_requirements: *2157449740
27
- - !ruby/object:Gem::Dependency
27
+ version_requirements: *id001
28
+ - !ruby/object:Gem::Dependency
28
29
  name: mail
29
- requirement: &2157449240 !ruby/object:Gem::Requirement
30
+ prerelease: false
31
+ requirement: &id002 !ruby/object:Gem::Requirement
30
32
  none: false
31
- requirements:
33
+ requirements:
32
34
  - - ~>
33
- - !ruby/object:Gem::Version
35
+ - !ruby/object:Gem::Version
34
36
  version: 2.2.15
35
37
  type: :runtime
36
- prerelease: false
37
- version_requirements: *2157449240
38
- - !ruby/object:Gem::Dependency
38
+ version_requirements: *id002
39
+ - !ruby/object:Gem::Dependency
39
40
  name: bundler
40
- requirement: &2157448780 !ruby/object:Gem::Requirement
41
+ prerelease: false
42
+ requirement: &id003 !ruby/object:Gem::Requirement
41
43
  none: false
42
- requirements:
44
+ requirements:
43
45
  - - ~>
44
- - !ruby/object:Gem::Version
46
+ - !ruby/object:Gem::Version
45
47
  version: 1.0.10
46
48
  type: :development
47
- prerelease: false
48
- version_requirements: *2157448780
49
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *id003
50
+ - !ruby/object:Gem::Dependency
50
51
  name: rspec
51
- requirement: &2157448320 !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id004 !ruby/object:Gem::Requirement
52
54
  none: false
53
- requirements:
55
+ requirements:
54
56
  - - ~>
55
- - !ruby/object:Gem::Version
57
+ - !ruby/object:Gem::Version
56
58
  version: 2.6.0
57
59
  type: :development
58
- prerelease: false
59
- version_requirements: *2157448320
60
- - !ruby/object:Gem::Dependency
60
+ version_requirements: *id004
61
+ - !ruby/object:Gem::Dependency
61
62
  name: yard
62
- requirement: &2157447860 !ruby/object:Gem::Requirement
63
+ prerelease: false
64
+ requirement: &id005 !ruby/object:Gem::Requirement
63
65
  none: false
64
- requirements:
66
+ requirements:
65
67
  - - ~>
66
- - !ruby/object:Gem::Version
68
+ - !ruby/object:Gem::Version
67
69
  version: 0.7.1
68
70
  type: :development
69
- prerelease: false
70
- version_requirements: *2157447860
71
- description: Why do you keep typing all that crap into your Capistrano recipes? Are
72
- you too cool for standards? Well, ARE YA!?
71
+ version_requirements: *id005
72
+ description: Why do you keep typing all that crap into your Capistrano recipes? Are you too cool for standards? Well, ARE YA!?
73
73
  email: support@thekompanee.com
74
74
  executables: []
75
+
75
76
  extensions: []
76
- extra_rdoc_files:
77
+
78
+ extra_rdoc_files:
77
79
  - README.md
78
80
  - LICENSE
79
- files:
81
+ files:
80
82
  - .gitignore
81
83
  - .rspec
82
84
  - .rvmrc
@@ -102,6 +104,7 @@ files:
102
104
  - lib/chicken_soup/capabilities/nginx/nginx-checks.rb
103
105
  - lib/chicken_soup/capabilities/nginx/nginx-defaults.rb
104
106
  - lib/chicken_soup/capabilities/nginx/nginx-tasks.rb
107
+ - lib/chicken_soup/capabilities/passenger/passenger-defaults.rb
105
108
  - lib/chicken_soup/capabilities/passenger/passenger-tasks.rb
106
109
  - lib/chicken_soup/capabilities/postgres/postgres-checks.rb
107
110
  - lib/chicken_soup/capabilities/postgres/postgres-defaults.rb
@@ -143,28 +146,30 @@ files:
143
146
  has_rdoc: true
144
147
  homepage: http://github.com/jfelchner/chicken_soup
145
148
  licenses: []
149
+
146
150
  post_install_message:
147
- rdoc_options:
151
+ rdoc_options:
148
152
  - --charset = UTF-8
149
- require_paths:
153
+ require_paths:
150
154
  - lib
151
- required_ruby_version: !ruby/object:Gem::Requirement
155
+ required_ruby_version: !ruby/object:Gem::Requirement
152
156
  none: false
153
- requirements:
154
- - - ! '>='
155
- - !ruby/object:Gem::Version
156
- version: '0'
157
- required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: "0"
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
162
  none: false
159
- requirements:
160
- - - ! '>='
161
- - !ruby/object:Gem::Version
162
- version: '0'
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: "0"
163
167
  requirements: []
168
+
164
169
  rubyforge_project: chicken_soup
165
170
  rubygems_version: 1.6.2
166
171
  signing_key:
167
172
  specification_version: 3
168
- summary: ! '...for the Deployment Soul.'
169
- test_files:
173
+ summary: ...for the Deployment Soul.
174
+ test_files:
170
175
  - spec/support/focused.rb