chicken_soup 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/README.md +128 -9
  2. data/lib/chicken_soup/capabilities/apache/apache-checks.rb +2 -0
  3. data/lib/chicken_soup/capabilities/apache/apache-defaults.rb +16 -12
  4. data/lib/chicken_soup/capabilities/bundler/bundler-checks.rb +2 -0
  5. data/lib/chicken_soup/capabilities/bundler/bundler-defaults.rb +2 -0
  6. data/lib/chicken_soup/capabilities/bundler/bundler-tasks.rb +12 -9
  7. data/lib/chicken_soup/capabilities/git/git-checks.rb +21 -0
  8. data/lib/chicken_soup/capabilities/git/git-defaults.rb +1 -2
  9. data/lib/chicken_soup/capabilities/github/github-defaults.rb +23 -0
  10. data/lib/chicken_soup/capabilities/github/github-tasks.rb +14 -0
  11. data/lib/chicken_soup/capabilities/heroku/heroku-checks.rb +2 -0
  12. data/lib/chicken_soup/capabilities/heroku/heroku-defaults.rb +2 -0
  13. data/lib/chicken_soup/capabilities/mysql/mysql-checks.rb +32 -0
  14. data/lib/chicken_soup/capabilities/nginx/nginx-checks.rb +2 -0
  15. data/lib/chicken_soup/capabilities/nginx/nginx-defaults.rb +12 -8
  16. data/lib/chicken_soup/capabilities/postgres/postgres-checks.rb +13 -0
  17. data/lib/chicken_soup/capabilities/rvm/rvm-checks.rb +7 -5
  18. data/lib/chicken_soup/capabilities/rvm/rvm-defaults.rb +7 -3
  19. data/lib/chicken_soup/capabilities/rvm/rvm-tasks.rb +8 -4
  20. data/lib/chicken_soup/capabilities/shared/db-checks.rb +2 -0
  21. data/lib/chicken_soup/capabilities/shared/db-defaults.rb +2 -0
  22. data/lib/chicken_soup/capabilities/shared/db-tasks.rb +17 -11
  23. data/lib/chicken_soup/capabilities/shared/web_server-tasks.rb +2 -0
  24. data/lib/chicken_soup/capabilities/svn/svn-defaults.rb +2 -0
  25. data/lib/chicken_soup/capabilities/unix/unix-checks.rb +2 -0
  26. data/lib/chicken_soup/capabilities/unix/unix-defaults.rb +2 -0
  27. data/lib/chicken_soup/capabilities/unix/unix-tasks.rb +5 -8
  28. data/lib/chicken_soup/capabilities.rb +4 -2
  29. data/lib/chicken_soup/deploy.rb +0 -1
  30. data/lib/chicken_soup/environment/checks.rb +2 -0
  31. data/lib/chicken_soup/environment/defaults.rb +5 -0
  32. data/lib/chicken_soup/global.rb +182 -121
  33. data/lib/chicken_soup/notifiers/airbrake/airbrake-tasks.rb +21 -0
  34. data/lib/chicken_soup/notifiers/email/email-checks.rb +2 -0
  35. data/lib/chicken_soup/notifiers/email/email-defaults.rb +2 -0
  36. data/lib/chicken_soup/notifiers/email/email-tasks.rb +19 -11
  37. data/lib/chicken_soup/notifiers/email/presenter.rb +3 -2
  38. data/lib/chicken_soup/notifiers/git/git-tasks.rb +3 -4
  39. data/lib/chicken_soup/notifiers.rb +2 -0
  40. data/lib/chicken_soup/version.rb +1 -1
  41. metadata +7 -3
  42. data/lib/chicken_soup/notifiers/hoptoad/hoptoad-tasks.rb +0 -6
@@ -2,6 +2,8 @@
2
2
  # UNIX SERVER DEFAULTS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
+ extend ChickenSoup
6
+
5
7
  namespace :capabilities do
6
8
  namespace :defaults do
7
9
  desc "[internal] Sets intelligent defaults for unix server deployments."
@@ -2,6 +2,8 @@
2
2
  # UNIX TASKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
+ extend ChickenSoup
6
+
5
7
  before "deploy:shared_files:symlink", "deploy:shared_files:setup"
6
8
 
7
9
  namespace :deploy do
@@ -22,8 +24,7 @@ Capistrano::Configuration.instance(:must_exist).load do
22
24
  If it finds it, it will upload the file or directory to the shared directory on
23
25
  the server and rename it to the proper file name.
24
26
 
25
- If it doesn't find it, it will check to see if the remote file exists, if not,
26
- it will use whatever local file is available with that name.
27
+ If it doesn't find it, it will check to see if the remote file exists.
27
28
 
28
29
  As a last resort, it will error out because the symlink task which follows will
29
30
  fail due to the missing file.
@@ -36,18 +37,14 @@ Capistrano::Configuration.instance(:must_exist).load do
36
37
  run "mkdir -p '#{shared_path}/#{base_dir_of_shared_file}'"
37
38
 
38
39
  remote_shared_file = "#{shared_path}/#{shared_file}"
39
- local_shared_file = "#{Dir.pwd}/#{shared_file}"
40
+ local_shared_file = "#{rails_root}/#{shared_file}"
40
41
  local_environment_specific_file = "#{local_shared_file}.#{rails_env}"
41
42
  permissions = File.directory? local_shared_file ? "755" : "600"
42
43
 
43
44
  if File.exists?(local_environment_specific_file)
44
45
  top.upload(local_environment_specific_file, remote_shared_file, :mode => permissions)
45
46
  elsif !remote_file_exists?(remote_shared_file)
46
- if File.exists?(local_shared_file)
47
- top.upload(local_shared_file, remote_shared_file, :mode => permissions)
48
- else
49
- abort "I'm sorry Dave, but I couldn't find a local file or directory at '#{local_shared_file}' or '#{local_environment_specific_file}'"
50
- end
47
+ abort "I'm sorry Dave, but I couldn't find a local file or directory at '#{local_environment_specific_file}' or on the remote server at '#{remote_shared_file}'"
51
48
  end
52
49
  end
53
50
  end
@@ -14,9 +14,11 @@
14
14
  #
15
15
  ######################################################################
16
16
  Capistrano::Configuration.instance(:must_exist).load do
17
+ extend ChickenSoup
18
+
17
19
  require 'chicken_soup/capabilities/defaults'
18
- require "chicken_soup/capabilities/checks"
19
- require "chicken_soup/capabilities/tasks"
20
+ require 'chicken_soup/capabilities/checks'
21
+ require 'chicken_soup/capabilities/tasks'
20
22
 
21
23
  ['defaults', 'checks', 'tasks'].each do |method|
22
24
  desc "[internal] This task is only here because `require` cannot be used within a `namespace`"
@@ -11,7 +11,6 @@ Capistrano::Configuration.instance(:must_exist).load do
11
11
  deploy.update
12
12
  deploy.shared_files.symlink
13
13
  gems.install
14
- deploy.migrate
15
14
  deploy.cleanup
16
15
  end
17
16
  end
@@ -15,6 +15,8 @@
15
15
  #
16
16
  ######################################################################
17
17
  Capistrano::Configuration.instance(:must_exist).load do
18
+ extend ChickenSoup
19
+
18
20
  on :start, 'environment:variable:check', :except => ['staging', 'production']
19
21
  before 'deploy', 'environment:deployment:check'
20
22
  before 'deploy:cold', 'environment:deployment:check'
@@ -17,7 +17,11 @@
17
17
  # The latter should be set in the application's deploy.rb file.
18
18
  #
19
19
  ######################################################################
20
+ require 'etc'
21
+
20
22
  Capistrano::Configuration.instance(:must_exist).load do
23
+ extend ChickenSoup
24
+
21
25
  after 'production', 'environment:defaults:production', 'environment:init'
22
26
  after 'staging', 'environment:defaults:staging', 'environment:init'
23
27
 
@@ -37,6 +41,7 @@ Capistrano::Configuration.instance(:must_exist).load do
37
41
 
38
42
  desc "[internal] Sets intelligent common defaults for deployments"
39
43
  task :default do
44
+ _cset :local_user, Etc.getlogin
40
45
  _cset :use_sudo, false
41
46
  _cset :default_shell, false
42
47
 
@@ -1,137 +1,198 @@
1
- ###
2
- # Helper method to close all session connections to the remote servers
3
- #
4
- def close_sessions
5
- sessions.values.each { |session| session.close }
6
- sessions.clear
7
- end
1
+ module ChickenSoup
2
+ ###
3
+ # Helper method to close all session connections to the remote servers
4
+ #
5
+ def close_sessions
6
+ sessions.values.each { |session| session.close }
7
+ sessions.clear
8
+ end
8
9
 
9
- ###
10
- # Forces all connections to switch to the user passed into it.
11
- #
12
- # It will forcibly terminate all open connections in order to accomplish this.
13
- #
14
- # @example Switch to the 'deploy' user:
15
- # set_user_to 'deploy'
16
- #
17
- # @param [String] username The username you would like to begin using.
18
- #
19
- def set_user_to(username)
20
- close_sessions
21
- set :user, username
22
- set(:password) {Capistrano::CLI.password_prompt("#{username.capitalize}'s Password: ")}
23
- set(:user_home) { user == "root" ? "/root" : "/home/#{username}" }
24
- end
10
+ ###
11
+ # Forces all connections to switch to the user passed into it.
12
+ #
13
+ # It will forcibly terminate all open connections in order to accomplish this.
14
+ #
15
+ # @example Switch to the 'deploy' user:
16
+ # set_user_to 'deploy'
17
+ #
18
+ # @param [String] username The username you would like to begin using.
19
+ #
20
+ def set_user_to(username)
21
+ close_sessions
22
+ set :user, username
23
+ set(:password) {Capistrano::CLI.password_prompt("#{username.capitalize}'s Password: ")}
24
+ set(:user_home) { user == "root" ? "/root" : "/home/#{username}" }
25
+ end
25
26
 
26
- ###
27
- # Helper method to run tasks in different contexts.
28
- #
29
- # The workflow is as follows:
30
- # * Current user is saved
31
- # * User is switched to the desired username passed in via the :as option
32
- # * The task is run
33
- # * The user is switched back to the original user
34
- #
35
- # By default the task hooks are prepared but the task itself is not executed.
36
- # You can change this by passing :now as an option.
37
- #
38
- # Running a task 'now' does not create hooks. Standard calls to the task will
39
- # be executed via the current user.
40
- #
41
- # @example Always run the task to install gems as the 'manage' user:
42
- # run_task 'gems:install', :as => 'manage'
43
- # @example Run the db migration task now as the 'deploy' user:
44
- # run_task 'db:migrate', :as => 'deploy', :now => true
45
- #
46
- # @param [String] task_name The name of the task to run.
47
- # @param [Hash] options Options to customize how the task is run. Valid options are:
48
- # @option options [Boolean] :now - If present, the task will be executed immediately.
49
- # @option options [String] :as - The name of the user you wish the task to be executed as.
50
- #
51
- # @todo Remove all previous hooks prior to adding new ones. Also disable hooks when running "now"
52
- #
53
- def run_task(task_name, options = {})
54
- abort "#run_task must be passed an `:as` option so that it knows who to change the user to." unless options[:as]
27
+ ###
28
+ # Helper method to run tasks in different contexts.
29
+ #
30
+ # The workflow is as follows:
31
+ # * Current user is saved
32
+ # * User is switched to the desired username passed in via the :as option
33
+ # * The task is run
34
+ # * The user is switched back to the original user
35
+ #
36
+ # By default the task hooks are prepared but the task itself is not executed.
37
+ # You can change this by passing :now as an option.
38
+ #
39
+ # Running a task 'now' does not create hooks. Standard calls to the task will
40
+ # be executed via the current user.
41
+ #
42
+ # @example Always run the task to install gems as the 'manage' user:
43
+ # run_task 'gems:install', :as => 'manage'
44
+ # @example Run the db migration task now as the 'deploy' user:
45
+ # run_task 'db:migrate', :as => 'deploy', :now => true
46
+ #
47
+ # @param [String] task_name The name of the task to run.
48
+ # @param [Hash] options Options to customize how the task is run. Valid options are:
49
+ # @option options [Boolean] :now - If present, the task will be executed immediately.
50
+ # @option options [String] :as - The name of the user you wish the task to be executed as.
51
+ #
52
+ # @todo Remove all previous hooks prior to adding new ones. Also disable hooks when running "now"
53
+ #
54
+ def run_task(task_name, options = {})
55
+ abort "#run_task must be passed an `:as` option so that it knows who to change the user to." unless options[:as]
55
56
 
56
- original_username = exists?(:user) ? user : nil
57
+ original_username = exists?(:user) ? user : nil
57
58
 
58
- if options[:now]
59
- set_user_to options[:as]
60
- find_and_execute_task(task_name)
61
- set_user_to original_username
62
- else
63
- before task_name, "os:users:#{options[:as]}:use"
64
- after task_name, "os:users:#{original_username}:use"
59
+ if options[:now]
60
+ set_user_to options[:as]
61
+ find_and_execute_task(task_name)
62
+ set_user_to original_username
63
+ else
64
+ before task_name, "os:users:#{options[:as]}:use"
65
+ after task_name, "os:users:#{original_username}:use"
66
+ end
65
67
  end
66
- end
67
68
 
68
- ###
69
- # Checks an array of items to see if they are currently set within the
70
- # Capistrano scope. If any of them fail, Capistrano execution will terminate.
71
- #
72
- # @param [Array, #each] required_variables An iterable list of items which
73
- # represent the names of Capistrano environment variables. Each item in this
74
- # list is expected to be set.
75
- #
76
- # @raise [CapistranoGoBoom] Calls #abort on the Capistrano execution if any of
77
- # the variables are not set.
78
- #
79
- # @example Using an array:
80
- # verify_variables [:user, :deploy_base_dir, :app_server]
81
- #
82
- def verify_variables(required_variables)
83
- required_variables.each do |expected_variable|
84
- abort( "You have not defined '#{expected_variable}' which is necessary for deployment." ) unless exists?(expected_variable)
69
+ ###
70
+ # Checks an array of items to see if they are currently set within the
71
+ # Capistrano scope. If any of them fail, Capistrano execution will terminate.
72
+ #
73
+ # @param [Array, #each] required_variables An iterable list of items which
74
+ # represent the names of Capistrano environment variables. Each item in this
75
+ # list is expected to be set.
76
+ #
77
+ # @raise [CapistranoGoBoom] Calls #abort on the Capistrano execution if any of
78
+ # the variables are not set.
79
+ #
80
+ # @example Using an array:
81
+ # verify_variables [:user, :deploy_base_dir, :app_server]
82
+ #
83
+ def verify_variables(required_variables)
84
+ required_variables.each do |expected_variable|
85
+ abort( "You have not defined '#{expected_variable}' which is necessary for deployment." ) unless exists?(expected_variable)
86
+ end
85
87
  end
86
- end
87
88
 
88
- ###
89
- # @note Taken directly from the Capistrano codebase.
90
- #
91
- # Sets a variable only if it doesn't already exist.
92
- #
93
- def _cset(name, *args, &block)
94
- unless exists?(name)
95
- set(name, *args, &block)
89
+ ###
90
+ # @note Taken directly from the Capistrano codebase.
91
+ #
92
+ # Sets a variable only if it doesn't already exist.
93
+ #
94
+ def _cset(name, *args, &block)
95
+ unless exists?(name)
96
+ set(name, *args, &block)
97
+ end
96
98
  end
97
- end
98
99
 
99
- ###
100
- # Runs a command on the remote server to see if the file currently exists.
101
- #
102
- # @param [String] file The filename (optionally including path), directory,
103
- # or symlink that is may or may not exist.
104
- #
105
- # @return [Boolean] Whether or not the file, directory or symlink exists.
106
- #
107
- # @example File without path:
108
- # remote_file_exists? 'server.log'
109
- # @example File with path:
110
- # remote_file_exists? '/var/www/myappdir/log/production.log'
111
- # @example Directory:
112
- # remote_file_exists? '/var/www/myappdir/log'
113
- # @example Symbolic Link:
114
- # remote_file_exists? '/var/www/myappdir/current'
115
- #
116
- def remote_file_exists?(file)
117
- capture("if [[ -d #{file} ]] || [[ -h #{file} ]] || [[ -f #{file} ]]; then echo -n 'exists'; fi;") == "exists"
118
- end
100
+ ###
101
+ # Runs a command on the remote server to see if the file currently exists.
102
+ #
103
+ # @param [String] file The filename (optionally including path), directory,
104
+ # or symlink that is may or may not exist.
105
+ #
106
+ # @return [Boolean] Whether or not the file, directory or symlink exists.
107
+ #
108
+ # @example File without path:
109
+ # remote_file_exists? 'server.log'
110
+ # @example File with path:
111
+ # remote_file_exists? '/var/www/myappdir/log/production.log'
112
+ # @example Directory:
113
+ # remote_file_exists? '/var/www/myappdir/log'
114
+ # @example Symbolic Link:
115
+ # remote_file_exists? '/var/www/myappdir/current'
116
+ #
117
+ def remote_file_exists?(file)
118
+ capture("if [[ -d #{file} ]] || [[ -h #{file} ]] || [[ -f #{file} ]]; then echo -n 'exists'; fi;") == "exists"
119
+ end
119
120
 
120
- def require_if_exists(file)
121
- require file if File.exists?(File.join(File.dirname(__FILE__), '..', "#{file}.rb"))
122
- end
121
+ ###
122
+ # Will require a file but will not throw an error if that file does not
123
+ # exist.
124
+ #
125
+ # @param [String] file The filename (optionally including path), directory,
126
+ # or symlink that is may or may not exist.
127
+ #
128
+ # @return [nil] nil will be returned if the file was loaded successfully.
129
+ #
130
+ # @example
131
+ # require_if_exists 'my_library'
132
+ #
133
+ def require_if_exists(file)
134
+ require file if File.exists?(File.join(File.dirname(__FILE__), '..', "#{file}.rb"))
135
+ end
123
136
 
124
- def download_compressed(remote, local, options = {})
125
- remote_compressed_filename = "#{remote}.bz2"
126
- local_compressed_filename = "#{local}.bz2"
137
+ ###
138
+ # Compresses a specific remote file before transferring it to the local
139
+ # machine. Once the transfer is completed, the file will be uncompressed
140
+ # and the compressed version will be deleted.
141
+ #
142
+ # @param [String] remote The remote filename (optionally including path),
143
+ # or directory that you would like to transfer.
144
+ #
145
+ # @param [String] local The location locally where you would like the file
146
+ # or directory to be transferred.
147
+ #
148
+ # @param [String] options Any options that can be passed to Capistrano's
149
+ # #download method.
150
+ #
151
+ # @example
152
+ # download_compressed 'my/remote/file', 'my/local/file', :once => true
153
+ #
154
+ def download_compressed(remote, local, options = {})
155
+ remote_compressed_filename = "#{remote}.bz2"
156
+ local_compressed_filename = "#{local}.bz2"
127
157
 
128
- run "bzip2 -zvck9 #{remote} > #{remote_compressed_filename}"
129
- download remote_compressed_filename, local_compressed_filename, options
158
+ run "bzip2 -zvck9 #{remote} > #{remote_compressed_filename}"
159
+ download remote_compressed_filename, local_compressed_filename, options
130
160
 
131
- run "rm -f #{remote_compressed_filename}"
132
- `bunzip2 -f #{local_compressed_filename} && rm -f #{local_compressed_filename}`
133
- end
161
+ run "rm -f #{remote_compressed_filename}"
162
+ `bunzip2 -f #{local_compressed_filename} && rm -f #{local_compressed_filename}`
163
+ end
164
+
165
+ ###
166
+ # A stub method which simply passes through to Capistrano's #run. This
167
+ # method is meant to be overridden when a Ruby manager capability (ie RVM)
168
+ # is installed.
169
+ #
170
+ # @param [String] ruby_version This is simply a noop on this method. It
171
+ # is not used. It is instead intended to be used with the Ruby manager
172
+ # that is installed.
173
+ #
174
+ # @param [String] command The command that is passed to #run
175
+ #
176
+ # @param [String] options Any options that can be passed to Capistrano's
177
+ # #run method.
178
+ #
179
+ # @example
180
+ # run_with_ruby_manager 'foo', 'gem list', :pty => false
181
+ #
182
+ def run_with_ruby_manager(ruby_version, command, options = {})
183
+ run command, options
184
+ end
134
185
 
135
- def vc_log
136
- nil
186
+ ###
187
+ # A stub method which simply returns nil. It is meant to be overridden
188
+ # when a version control capability (ie Git) is installed.
189
+ #
190
+ # @return [nil] Always returns nil
191
+ #
192
+ # @example
193
+ # run_with_ruby_manager 'foo', 'gem list', :pty => false
194
+ #
195
+ def vc_log
196
+ nil
197
+ end
137
198
  end
@@ -0,0 +1,21 @@
1
+ ######################################################################
2
+ # AIRBRAKE NOTIFIER TASKS #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ after "deploy", "notify:via_airbrake"
6
+
7
+ namespace :notify do
8
+ desc <<-DESC
9
+ [internal] Sends Airbrake information regarding the deployment.
10
+ If you have a paid version of Airbrake, it will resolve all of
11
+ your errors.
12
+ DESC
13
+ task :via_airbrake, :except => { :no_release => true } do
14
+ notify_command = "rake hoptoad:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
15
+ notify_command << " DRY_RUN=true" if dry_run
16
+ notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
17
+
18
+ `#{notify_command}`
19
+ end
20
+ end
21
+ end
@@ -2,6 +2,8 @@
2
2
  # EMAIL NOTIFIER CHECKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
+ extend ChickenSoup
6
+
5
7
  namespace :notifiers do
6
8
  namespace :variable do
7
9
  namespace :check do
@@ -6,6 +6,8 @@ require 'erb'
6
6
  require 'chicken_soup/notifiers/email/presenter'
7
7
 
8
8
  Capistrano::Configuration.instance(:must_exist).load do |cap|
9
+ extend ChickenSoup
10
+
9
11
  namespace :notifiers do
10
12
  namespace :defaults do
11
13
  task :email do
@@ -4,7 +4,7 @@
4
4
  require 'mail'
5
5
 
6
6
  Capistrano::Configuration.instance(:must_exist).load do |cap|
7
- after 'deploy:cleanup', 'notify:via_email'
7
+ after 'deploy', 'notify:via_email'
8
8
 
9
9
  namespace :notify do
10
10
  desc <<-DESC
@@ -16,20 +16,28 @@ Capistrano::Configuration.instance(:must_exist).load do |cap|
16
16
  end
17
17
 
18
18
  if !cap[:email_notifier_client_recipients].empty?
19
- Mail.deliver do
20
- to cap[:email_notifier_client_recipients]
21
- from cap[:email_notifier_sender]
22
- subject cap[:email_notifier_subject]
23
- body cap[:email_notifier_client_body]
19
+ begin
20
+ Mail.deliver do
21
+ to cap[:email_notifier_client_recipients]
22
+ from cap[:email_notifier_sender]
23
+ subject cap[:email_notifier_subject]
24
+ body cap[:email_notifier_client_body]
25
+ end
26
+ rescue
27
+ puts "I'm sorry Dave, but I couldn't contact the mail server. The client email notifications you requested have not been sent"
24
28
  end
25
29
  end
26
30
 
27
31
  if !cap[:email_notifier_internal_recipients].empty?
28
- Mail.deliver do
29
- to cap[:email_notifier_internal_recipients]
30
- from cap[:email_notifier_sender]
31
- subject cap[:email_notifier_subject]
32
- body cap[:email_notifier_internal_body]
32
+ begin
33
+ Mail.deliver do
34
+ to cap[:email_notifier_internal_recipients]
35
+ from cap[:email_notifier_sender]
36
+ subject cap[:email_notifier_subject]
37
+ body cap[:email_notifier_internal_body]
38
+ end
39
+ rescue
40
+ puts "I'm sorry Dave, but I couldn't contact the mail server. The email notifications to the development team you requested have not been sent"
33
41
  end
34
42
  end
35
43
  end
@@ -1,9 +1,10 @@
1
- require 'etc'
2
1
  require 'time'
3
2
 
4
3
  module ChickenSoup
5
4
  module Email
6
5
  class Presenter
6
+ include ChickenSoup
7
+
7
8
  LongDateFormat = "%A, %B %e, %Y at %l:%M%p %Z"
8
9
 
9
10
  def initialize(capistrano)
@@ -19,7 +20,7 @@ module ChickenSoup
19
20
  end
20
21
 
21
22
  def deployed_by
22
- Etc.getlogin
23
+ @capistrano[:local_user]
23
24
  end
24
25
 
25
26
  def deploy_date_in_long_format
@@ -8,7 +8,7 @@ module ChickenSoup
8
8
  end
9
9
 
10
10
  Capistrano::Configuration.instance(:must_exist).load do
11
- after 'deploy:cleanup', 'notify:via_git:tag'
11
+ after 'deploy', 'notify:via_git:tag'
12
12
 
13
13
  namespace :notify do
14
14
  namespace :via_git do
@@ -19,10 +19,9 @@ Capistrano::Configuration.instance(:must_exist).load do
19
19
  Tag push happens in the background so it won't slow down deployment.
20
20
  DESC
21
21
  task :tag do
22
- timestamp_string_without_seconds = Time.now.strftime("%Y%m%d%H%M")
23
- tag_name = "deployed_to_#{rails_env}_#{timestamp_string_without_seconds}"
22
+ tag_name = "deployment/#{rails_env}/#{current_release}"
24
23
 
25
- `git tag -a -m "Tagging deploy to #{rails_env} at #{timestamp_string_without_seconds}" #{tag_name} #{branch}`
24
+ `git tag -a -m "Tagging deploy to #{rails_env} at #{current_release}" #{tag_name} #{branch}`
26
25
  `git push #{remote} --tags > /dev/null 2>&1 &`
27
26
  `git push origin --tags > /dev/null 2>&1 &`
28
27
  end
@@ -2,6 +2,8 @@
2
2
  # NOTIFIERS SETUP #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
+ extend ChickenSoup
6
+
5
7
  require 'chicken_soup/notifiers/defaults'
6
8
  require "chicken_soup/notifiers/checks"
7
9
  require "chicken_soup/notifiers/tasks"
@@ -1,3 +1,3 @@
1
1
  module ChickenSoup
2
- VERSION = "0.5.3"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: chicken_soup
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.3
5
+ version: 0.6.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - thekompanee
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-08-10 00:00:00 -05:00
14
+ date: 2011-08-11 00:00:00 -05:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -96,10 +96,14 @@ files:
96
96
  - lib/chicken_soup/capabilities/bundler/bundler-tasks.rb
97
97
  - lib/chicken_soup/capabilities/checks.rb
98
98
  - lib/chicken_soup/capabilities/defaults.rb
99
+ - lib/chicken_soup/capabilities/git/git-checks.rb
99
100
  - lib/chicken_soup/capabilities/git/git-defaults.rb
101
+ - lib/chicken_soup/capabilities/github/github-defaults.rb
102
+ - lib/chicken_soup/capabilities/github/github-tasks.rb
100
103
  - lib/chicken_soup/capabilities/heroku/heroku-checks.rb
101
104
  - lib/chicken_soup/capabilities/heroku/heroku-defaults.rb
102
105
  - lib/chicken_soup/capabilities/heroku/heroku-tasks.rb
106
+ - lib/chicken_soup/capabilities/mysql/mysql-checks.rb
103
107
  - lib/chicken_soup/capabilities/mysql/mysql-tasks.rb
104
108
  - lib/chicken_soup/capabilities/nginx/nginx-checks.rb
105
109
  - lib/chicken_soup/capabilities/nginx/nginx-defaults.rb
@@ -129,6 +133,7 @@ files:
129
133
  - lib/chicken_soup/environment/tasks.rb
130
134
  - lib/chicken_soup/global.rb
131
135
  - lib/chicken_soup/notifiers.rb
136
+ - lib/chicken_soup/notifiers/airbrake/airbrake-tasks.rb
132
137
  - lib/chicken_soup/notifiers/checks.rb
133
138
  - lib/chicken_soup/notifiers/defaults.rb
134
139
  - lib/chicken_soup/notifiers/email/email-checks.rb
@@ -136,7 +141,6 @@ files:
136
141
  - lib/chicken_soup/notifiers/email/email-tasks.rb
137
142
  - lib/chicken_soup/notifiers/email/presenter.rb
138
143
  - lib/chicken_soup/notifiers/git/git-tasks.rb
139
- - lib/chicken_soup/notifiers/hoptoad/hoptoad-tasks.rb
140
144
  - lib/chicken_soup/notifiers/tasks.rb
141
145
  - lib/chicken_soup/templates/client_email.html.erb
142
146
  - lib/chicken_soup/templates/internal_email.html.erb
@@ -1,6 +0,0 @@
1
- ######################################################################
2
- # HOPTOAD NOTIFIER TASKS #
3
- ######################################################################
4
- Capistrano::Configuration.instance(:must_exist).load do
5
- # require 'hoptoad_notifier/capistrano'
6
- end