chicken_soup 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/chicken_soup.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  #= Manifest =#
30
30
 
31
31
  s.add_dependency('capistrano', '~> 2.5.19')
32
+ s.add_dependency('mail', '~> 2.2.15')
32
33
 
33
34
  s.add_development_dependency('bundler', '~> 1.0.10')
34
35
  end
@@ -0,0 +1,16 @@
1
+ ######################################################################
2
+ # CAPABILITIES SETUP #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ require 'chicken_soup/capabilities/defaults'
6
+ require "chicken_soup/capabilities/checks"
7
+
8
+ desc "[internal] This task is only here because `require` cannot be used within a `namespace`"
9
+ task :load_capabilities do
10
+ require "chicken_soup/capabilities/#{deployment_type}"
11
+
12
+ fetch(:capabilities).each do |capability|
13
+ require "chicken_soup/capabilities/#{capability}"
14
+ end
15
+ end
16
+ end
@@ -2,9 +2,6 @@
2
2
  # BUNDLER TASKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- _cset :gem_packager_version, `gem list bundler`.match(/\((.*)\)/)[1]
6
- set :rake, 'bundle exec rake'
7
-
8
5
  before 'gems:install', 'bundler:install'
9
6
 
10
7
  namespace :gems do
@@ -24,19 +21,25 @@ Capistrano::Configuration.instance(:must_exist).load do
24
21
  namespace :bundler do
25
22
  desc "Install Bundler"
26
23
  task :install do
27
- run_with_rvm "#{ruby_version}@global", "gem install bundler --version #{gem_packager_version} --no-ri --no-rdoc && gem cleanup bundler"
24
+ bundler_install_command = "gem install bundler --version #{gem_packager_version} --no-ri --no-rdoc && gem cleanup bundler"
25
+
26
+ if fetch(:capabilities).include? :rvm
27
+ run_with_rvm "#{ruby_version}@global", bundler_install_command
28
+ else
29
+ run bundler_install_command
30
+ end
28
31
  end
29
32
  end
30
33
  end
31
34
 
32
35
  ######################################################################
33
- # BUNDLER ENVIRONMENT CHECKS #
36
+ # BUNDLER CHECKS #
34
37
  ######################################################################
35
38
  Capistrano::Configuration.instance(:must_exist).load do
36
- namespace :environment do
39
+ namespace :capabilities do
37
40
  namespace :check do
38
41
  desc <<-DESC
39
- [internal] Checks to see if all necessary Bundler environment variables have been set up.
42
+ [internal] Checks to see if all necessary Bundler capabilities variables have been set up.
40
43
  DESC
41
44
  task :bundler do
42
45
  required_variables = [
@@ -50,14 +53,15 @@ Capistrano::Configuration.instance(:must_exist).load do
50
53
  end
51
54
 
52
55
  ######################################################################
53
- # DEFAULT BUNDLER SETUP #
56
+ # BUNDLER DEFAULTS #
54
57
  ######################################################################
55
58
  Capistrano::Configuration.instance(:must_exist).load do
56
- namespace :environment do
59
+ namespace :capabilities do
57
60
  namespace :defaults do
58
61
  desc "[internal] Sets intelligent defaults for Bundler deployments."
59
62
  task :bundler do
60
- _cset :bundler_version, `gem list bundler`.match(/\((.*)\)/)[1]
63
+ _cset :gem_packager_version, `gem list bundler`.match(/\((.*)\)/)[1]
64
+ set :rake, 'bundle exec rake'
61
65
  end
62
66
  end
63
67
  end
@@ -0,0 +1,19 @@
1
+ ######################################################################
2
+ # CAPABILITIES CHECK #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ after 'environment:check', 'capabilities:check'
6
+
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)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ ######################################################################
2
+ # DEFAULT CAPABILITIES SETUP #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ after 'environment:defaults', 'capabilities:defaults'
6
+ before 'capabilities:defaults', 'load_capabilities'
7
+
8
+ namespace :capabilities do
9
+ namespace :defaults do
10
+ desc <<-DESC
11
+ [internal] Installs the entire capabilities for the given deployment type.
12
+
13
+ Most of these values can be overridden in each application's deploy.rb file.
14
+ DESC
15
+ task :default do
16
+ defaults.send(deployment_type.to_s)
17
+
18
+ if exists?(:capabilities)
19
+ fetch(:capabilities).each do |capability|
20
+ capabilities.defaults.send(capability.to_s) if capabilities.defaults.respond_to?(capability.to_sym)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -2,52 +2,20 @@
2
2
  # GIT TASKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- before 'deploy:cleanup', 'deploy:tag'
6
-
7
- namespace :deploy do
5
+ namespace :vc do
8
6
  desc <<-DESC
9
- Tags the deployed Git commit with the timestamp and environment it was deployed to.
10
-
11
- The tag is auto-pushed to whatever `remote` is set to as well as `origin`.
12
- Tag push happens in the background so it won't slow down deployment.
13
7
  DESC
14
- task :tag do
15
- timestamp_string_without_seconds = Time.now.strftime("%Y%m%d%H%M")
16
- tag_name = "deployed_to_#{rails_env}_#{timestamp_string_without_seconds}"
17
-
18
- `git tag -a -m "Tagging deploy to #{rails_env} at #{timestamp_string_without_seconds}" #{tag_name} #{branch}`
19
- `git push #{remote} --tags > /dev/null 2>&1 &`
20
- `git push origin --tags > /dev/null 2>&1 &`
21
- end
22
- end
23
- end
24
-
25
- ######################################################################
26
- # GIT ENVIRONMENT CHECK #
27
- ######################################################################
28
- Capistrano::Configuration.instance(:must_exist).load do
29
- namespace :environment do
30
- namespace :defaults do
31
- desc "[internal] Sets intelligent version control defaults for deployments"
32
- task :git do
33
- _cset :github_account, ENV["USER"]
34
- _cset :deploy_via, :remote_cache
35
-
36
- set :scm, :git
37
- set(:repository) {"git@github.com:#{github_account}/#{application}.git"}
38
- set(:branch) { `git branch`.match(/\* (\S+)\s/m)[1] || raise("Couldn't determine current branch") }
39
- set(:remote) { `git remote`.match(/(\S+)\s/m)[1] || raise("Couldn't determine default remote repository") }
40
- ssh_options[:forward_agent] = true
41
- end
8
+ task :log do
9
+ set :vc_log, `git log #{previous_revision}..#{current_revision} --pretty=format:%ai:::%an:::%s`
42
10
  end
43
11
  end
44
12
  end
45
13
 
46
14
  ######################################################################
47
- # DEFAULT GIT SETUP #
15
+ # GIT DEFAULTS #
48
16
  ######################################################################
49
17
  Capistrano::Configuration.instance(:must_exist).load do
50
- namespace :environment do
18
+ namespace :capabilities do
51
19
  namespace :defaults do
52
20
  desc "[internal] Sets intelligent version control defaults for deployments"
53
21
  task :git do
@@ -246,10 +246,10 @@ Capistrano::Configuration.instance(:must_exist).load do
246
246
  end
247
247
 
248
248
  ######################################################################
249
- # HEROKU ENVIRONMENT CHECKS #
249
+ # HEROKU CHECKS #
250
250
  ######################################################################
251
251
  Capistrano::Configuration.instance(:must_exist).load do
252
- namespace :environment do
252
+ namespace :capabilities do
253
253
  namespace :check do
254
254
  desc <<-DESC
255
255
  [internal] Checks to see if all necessary Heroku environment variables have been set up.
@@ -269,10 +269,10 @@ Capistrano::Configuration.instance(:must_exist).load do
269
269
  end
270
270
 
271
271
  ######################################################################
272
- # DEFAULT HEROKU ENVIRONMENT SETUP #
272
+ # HEROKU DEFAULTS #
273
273
  ######################################################################
274
274
  Capistrano::Configuration.instance(:must_exist).load do
275
- namespace :environment do
275
+ namespace :capabilities do
276
276
  namespace :defaults do
277
277
  desc "[internal] Sets intelligent defaults for Heroku deployments"
278
278
  task :heroku do
@@ -6,10 +6,10 @@ def run_with_rvm(ruby_env_string, command)
6
6
  end
7
7
 
8
8
  ######################################################################
9
- # RVM ENVIRONMENT CHECKS #
9
+ # RVM CHECKS #
10
10
  ######################################################################
11
11
  Capistrano::Configuration.instance(:must_exist).load do
12
- namespace :environment do
12
+ namespace :capabilities do
13
13
  namespace :check do
14
14
  desc <<-DESC
15
15
  [internal] Checks to see if all necessary RVM variables have been set up.
@@ -28,10 +28,10 @@ Capistrano::Configuration.instance(:must_exist).load do
28
28
  end
29
29
 
30
30
  ######################################################################
31
- # DEFAULT RVM ENVIRONMENT SETUP #
31
+ # RVM DEFAULTS #
32
32
  ######################################################################
33
33
  Capistrano::Configuration.instance(:must_exist).load do
34
- namespace :environment do
34
+ namespace :capabilities do
35
35
  namespace :defaults do
36
36
  _cset :ruby_version, ENV["rvm_ruby_string"]
37
37
  _cset :ruby_gemset, ENV["GEM_HOME"].split('@')[1]
@@ -0,0 +1,34 @@
1
+ ######################################################################
2
+ # SUBVERSION TASKS #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ namespace :vc do
6
+ desc <<-DESC
7
+ DESC
8
+ task :log do
9
+ set :vc_log, `svn log -r #{previous_revision.to_i + 1}:#{current_revision}`
10
+ end
11
+ end
12
+ end
13
+
14
+ ######################################################################
15
+ # SUBVERSION DEFAULTS #
16
+ ######################################################################
17
+ Capistrano::Configuration.instance(:must_exist).load do
18
+ namespace :capabilities do
19
+ namespace :defaults do
20
+ desc "[internal] Sets intelligent version control defaults for deployments"
21
+ task :svn do
22
+ set :scm, :subversion
23
+
24
+ # _cset :github_account, ENV["USER"]
25
+ # _cset :deploy_via, :remote_cache
26
+ # _cset(:repository) {"git@github.com:#{github_account}/#{application}.git"}
27
+ # _cset(:branch) { `git branch`.match(/\* (\S+)\s/m)[1] || raise("Couldn't determine current branch") }
28
+ # _cset(:remote) { `git remote`.match(/(\S+)\s/m)[1] || raise("Couldn't determine default remote repository") }
29
+
30
+ # ssh_options[:forward_agent] = true
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  ######################################################################
2
- # COMMON *NIX TASKS #
2
+ # UNIX TASKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  before "deploy:config:symlink", "deploy:config:create"
@@ -57,8 +57,6 @@ Capistrano::Configuration.instance(:must_exist).load do
57
57
  [internal] Switches Capistrano to use the root user for all subsequent SSH actions.
58
58
 
59
59
  It will prompt for the root user's password the first time it's needed.
60
- (If the Kompanee Bash environment has been installed, you will no longer
61
- be able to log in as root.)
62
60
  DESC
63
61
  task :use do
64
62
  set_user_to("root")
@@ -67,7 +65,7 @@ Capistrano::Configuration.instance(:must_exist).load do
67
65
 
68
66
  namespace :manager do
69
67
  desc <<-DESC
70
- Switches Capistrano to use the manager user for all subsequent SSH actions.
68
+ [internal] Switches Capistrano to use the manager user for all subsequent SSH actions.
71
69
 
72
70
  It will prompt for the manager user's password the first time it's needed.
73
71
  (If public key authentication is already installed, you will not be prompted.)
@@ -79,7 +77,7 @@ Capistrano::Configuration.instance(:must_exist).load do
79
77
 
80
78
  namespace :deploy do
81
79
  desc <<-DESC
82
- Switches Capistrano to use the deployment user for all subsequent SSH actions.
80
+ [internal] Switches Capistrano to use the deployment user for all subsequent SSH actions.
83
81
 
84
82
  It will prompt for the deployment user's password the first time it's needed.
85
83
  (If public key authentication is already installed, you will not be prompted.)
@@ -93,10 +91,10 @@ Capistrano::Configuration.instance(:must_exist).load do
93
91
  end
94
92
 
95
93
  ######################################################################
96
- # UNIX ENVIRONMENT CHECKS #
94
+ # UNIX CHECKS #
97
95
  ######################################################################
98
96
  Capistrano::Configuration.instance(:must_exist).load do
99
- namespace :environment do
97
+ namespace :capabilities do
100
98
  namespace :check do
101
99
  desc <<-DESC
102
100
  [internal] Checks to see if all necessary unix environment variables have been set up.
@@ -127,10 +125,10 @@ Capistrano::Configuration.instance(:must_exist).load do
127
125
  end
128
126
 
129
127
  ######################################################################
130
- # DEFAULT UNIX SERVER ENVIRONMENT SETUP #
128
+ # UNIX SERVER DEFAULTS #
131
129
  ######################################################################
132
130
  Capistrano::Configuration.instance(:must_exist).load do
133
- namespace :environment do
131
+ namespace :capabilities do
134
132
  namespace :defaults do
135
133
  desc "[internal] Sets intelligent defaults for unix server deployments."
136
134
  task :unix do
@@ -1,3 +1,6 @@
1
+ ######################################################################
2
+ # DEPLOYMENT TASKS #
3
+ ######################################################################
1
4
  Capistrano::Configuration.instance(:must_exist).load do
2
5
  before "deploy", "deploy:web:disable"
3
6
  after "deploy", "deploy:web:enable"
@@ -2,14 +2,6 @@
2
2
  # ENVIRONMENT SETUP #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- require 'chicken_soup/environment/checks'
6
5
  require 'chicken_soup/environment/defaults'
7
-
8
- desc "[internal] This task is only here because `require` cannot be used within a `namespace`"
9
- task :load_capabilities do
10
- require "chicken_soup/capabilities/unix"
11
- capabilities.each do |capability|
12
- require "chicken_soup/capabilities/#{capability}"
13
- end
14
- end
6
+ require 'chicken_soup/environment/checks'
15
7
  end
@@ -2,38 +2,20 @@
2
2
  # ENVIRONMENT CHECKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- on :start, 'environment:check', :except => ['staging', 'production']
6
-
7
- before 'environment:check', 'environment:check:common'
5
+ on :start, 'environment:check', :except => ['staging', 'production']
8
6
 
9
7
  namespace :environment do
10
- namespace :check do
11
- desc "[internal] Checks for environment variables shared among all deployment types."
12
- task :common do
13
- abort "You need to specify staging or production when you deploy. ie 'cap staging db:backup'" unless exists?(:rails_env)
14
- abort "You need to specify a deployment type in your application's 'deploy.rb' file. ie 'set :deployment_type, :heroku'" unless exists?(:deployment_type)
15
-
16
- required_variables = [
17
- :application,
18
- :application_short
19
- ]
20
-
21
- verify_variables(required_variables)
22
- end
8
+ desc "[internal] Checks for environment variables shared among all deployment types."
9
+ task :check do
10
+ abort "You need to specify staging or production when you deploy. ie 'cap staging db:backup'" unless exists?(:rails_env)
11
+ abort "You need to specify a deployment type in your application's 'deploy.rb' file. ie 'set :deployment_type, :heroku'" unless exists?(:deployment_type)
23
12
 
24
- desc "[internal] Runs checks for all of the capabilities listed."
25
- task :capabilities do
26
- if exists?(:capabilities)
27
- fetch(:capabilities).each do |capability|
28
- environment.check.send(capability.to_s) if environment.check.respond_to?(capability.to_sym)
29
- end
30
- end
31
- end
13
+ required_variables = [
14
+ :application,
15
+ :application_short
16
+ ]
32
17
 
33
- desc "[internal] Checks to see if all the necessary environment variables have been set up for a proper deployment."
34
- task :default do
35
- environment.check.capabilities
36
- end
18
+ verify_variables(required_variables)
37
19
  end
38
20
  end
39
21
  end
@@ -1,53 +1,32 @@
1
1
  ######################################################################
2
- # DEFAULT ENVIRONMENT SETUP #
2
+ # ENVIRONMENT DEFAULTS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
- after 'production', 'environment:defaults:production', 'environment:defaults'
6
- after 'staging', 'environment:defaults:staging', 'environment:defaults'
7
-
8
- before 'environment:defaults', 'load_capabilities'
5
+ after 'production', 'environment:defaults:production', 'environment:defaults'
6
+ after 'staging', 'environment:defaults:staging', 'environment:defaults'
9
7
 
10
8
  namespace :environment do
11
9
  namespace :defaults do
12
10
  desc "[internal] Used to set up the intelligent staging defaults we like for our projects"
13
11
  task :staging do
14
- set :rails_env, "staging"
12
+ set :rails_env, 'staging'
15
13
  end
16
14
 
17
15
  desc "[internal] Used to set up the intelligent production defaults we like for our projects"
18
16
  task :production do
19
- set :rails_env, "production"
17
+ set :rails_env, 'production'
20
18
  end
21
19
 
22
20
  desc "[internal] Sets intelligent common defaults for deployments"
23
- task :common do
21
+ task :default do
24
22
  _cset :use_sudo, false
25
23
  _cset :default_shell, false
26
24
 
27
25
  _cset :copy_compression, :bz2
28
26
 
27
+ _cset(:application_short) {application}
29
28
  _cset(:application_underscored) {application.gsub(/-/, "_")}
30
29
  end
31
-
32
- desc "[internal] Sets defaults for all of the capabilities listed."
33
- task :capabilities do
34
- if exists?(:capabilities)
35
- fetch(:capabilities).each do |capability|
36
- environment.defaults.send(capability.to_s) if environment.defaults.respond_to?(capability.to_sym)
37
- end
38
- end
39
- end
40
-
41
- desc <<-DESC
42
- [internal] Installs the entire environment for the given deployment type.
43
-
44
- Most of these values can be overridden in each application's deploy.rb file.
45
- DESC
46
- task :default do
47
- defaults.common
48
- defaults.send(deployment_type.to_s)
49
- defaults.capabilities
50
- end
51
30
  end
52
31
  end
53
32
  end
@@ -0,0 +1,14 @@
1
+ ######################################################################
2
+ # NOTIFIERS SETUP #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ require 'chicken_soup/notifiers/defaults'
6
+ require "chicken_soup/notifiers/checks"
7
+
8
+ desc "[internal] This task is only here because `require` cannot be used within a `namespace`"
9
+ task :load_notifiers do
10
+ fetch(:notifiers).each do |notifier|
11
+ require "chicken_soup/notifiers/#{notifier}"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ ######################################################################
2
+ # NOTIFIERS CHECK #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ after 'environment:check', 'notifiers:check'
6
+
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)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ ######################################################################
2
+ # DEFAULT NOTIFIERS SETUP #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ after 'environment:defaults', 'notifiers:defaults'
6
+ before 'notifiers:defaults', 'load_notifiers'
7
+
8
+ namespace :notifiers do
9
+ namespace :defaults do
10
+ desc <<-DESC
11
+ [internal] Installs the entire notifiers for the given deployment type.
12
+
13
+ Most of these values can be overridden in each application's deploy.rb file.
14
+ DESC
15
+ task :default do
16
+ if exists?(:notifiers)
17
+ fetch(:notifiers).each do |notifier|
18
+ notifiers.defaults.send(notifier.to_s) if notifiers.defaults.respond_to?(notifier.to_sym)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,109 @@
1
+ ######################################################################
2
+ # EMAIL NOTIFIER TASKS #
3
+ ######################################################################
4
+ require 'mail'
5
+ require 'erb'
6
+ require 'chicken_soup/notifiers/email_notifier'
7
+
8
+ Capistrano::Configuration.instance(:must_exist).load do |cap|
9
+ before 'notifiers:defaults:email', 'vc:log'
10
+ after 'deploy:cleanup', 'notify:by_email'
11
+
12
+ namespace :notify do
13
+ desc <<-DESC
14
+ [internal] Sends a notification via email once a deployment is complete.
15
+ DESC
16
+ task :by_email do
17
+ if !cap[:email_notifier_client_recipients].empty?
18
+ Mail.deliver do
19
+ to cap[:email_notifier_client_recipients]
20
+ from cap[:email_notifier_sender]
21
+ subject cap[:email_notifier_subject]
22
+ body cap[:email_notifier_client_body]
23
+ end
24
+ end
25
+
26
+ if !cap[:email_notifier_internal_recipients].empty?
27
+ Mail.deliver do
28
+ to cap[:email_notifier_internal_recipients]
29
+ from cap[:email_notifier_sender]
30
+ subject cap[:email_notifier_subject]
31
+ body cap[:email_notifier_internal_body]
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ ######################################################################
39
+ # EMAIL NOTIFIER CHECKS #
40
+ ######################################################################
41
+ Capistrano::Configuration.instance(:must_exist).load do
42
+ namespace :notifiers do
43
+ namespace :check do
44
+ desc <<-DESC
45
+ [internal] Checks to see if all necessary email notification environment variables have been set up.
46
+ DESC
47
+ task :email do
48
+ required_variables = [
49
+ :email_notifier_client_recipients,
50
+ :email_notifier_internal_recipients,
51
+ :email_notifier_domain,
52
+ :email_notifier_username,
53
+ :email_notifier_password
54
+ ]
55
+
56
+ verify_variables(required_variables)
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ ######################################################################
63
+ # EMAIL NOTIFIER DEFAULTS #
64
+ ######################################################################
65
+ Capistrano::Configuration.instance(:must_exist).load do |cap|
66
+ namespace :notifiers do
67
+ namespace :defaults do
68
+ task :email do
69
+ _cset :email_notifier_format, 'html'
70
+
71
+ _cset :email_notifier_mail_method, :smtp
72
+ _cset :email_notifier_server, "smtp.gmail.com"
73
+ _cset :email_notifier_port, 587
74
+ _cset :email_notifier_authentication, 'plain'
75
+
76
+ _cset :email_notifier_mail_options, { :address => email_notifier_server,
77
+ :port => email_notifier_port,
78
+ :domain => email_notifier_domain,
79
+ :user_name => email_notifier_username,
80
+ :password => email_notifier_password,
81
+ :authentication => email_notifier_authentication,
82
+ :enable_starttls_auto => true }
83
+
84
+ _cset :email_notifier_client_recipients, []
85
+ _cset :email_notifier_internal_recipients, []
86
+ _cset :email_notifier_sender, 'theshadow@theshadowknows.com'
87
+ _cset :email_notifier_subject, "#{application.titleize} has been deployed to #{rails_env.capitalize}"
88
+ _cset :email_notifier_client_template, read_template("client_email.#{email_notifier_format}.erb")
89
+ _cset :email_notifier_internal_template, read_template("internal_email.#{email_notifier_format}.erb")
90
+
91
+ email_notifier = ChickenSoup::EmailNotifier.new(cap)
92
+ _cset :email_notifier_client_body, render_erb(email_notifier_client_template, email_notifier)
93
+ _cset :email_notifier_internal_body, render_erb(email_notifier_internal_template, email_notifier)
94
+
95
+ Mail.defaults do
96
+ delivery_method cap[:email_notifier_mail_method], cap[:email_notifier_mail_options]
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ def render_erb(template, email_info)
104
+ ERB.new(template, 0, "%<>").result(binding)
105
+ end
106
+
107
+ def read_template(template)
108
+ File.read(File.join(File.dirname(__FILE__), template))
109
+ end
@@ -0,0 +1,23 @@
1
+ ######################################################################
2
+ # GIT NOTIFIER TASKS #
3
+ ######################################################################
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ before 'deploy:cleanup', 'git:tag'
6
+
7
+ namespace :git do
8
+ desc <<-DESC
9
+ Tags the deployed Git commit with the timestamp and environment it was deployed to.
10
+
11
+ The tag is auto-pushed to whatever `remote` is set to as well as `origin`.
12
+ Tag push happens in the background so it won't slow down deployment.
13
+ DESC
14
+ task :tag do
15
+ timestamp_string_without_seconds = Time.now.strftime("%Y%m%d%H%M")
16
+ tag_name = "deployed_to_#{rails_env}_#{timestamp_string_without_seconds}"
17
+
18
+ `git tag -a -m "Tagging deploy to #{rails_env} at #{timestamp_string_without_seconds}" #{tag_name} #{branch}`
19
+ `git push #{remote} --tags > /dev/null 2>&1 &`
20
+ `git push origin --tags > /dev/null 2>&1 &`
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  ######################################################################
2
- # HOPTOAD TASKS #
2
+ # HOPTOAD NOTIFIER TASKS #
3
3
  ######################################################################
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  # require 'hoptoad_notifier/capistrano'
@@ -1,3 +1,3 @@
1
1
  module ChickenSoup
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/chicken_stock.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  require "chicken_soup/global"
2
2
  require "chicken_soup/environment"
3
+ require 'chicken_soup/capabilities'
4
+ require 'chicken_soup/notifiers'
3
5
  require "chicken_soup/deploy"
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chicken_soup
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.5
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - thekompanee
@@ -11,31 +10,39 @@ autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
12
 
14
- date: 2011-02-28 00:00:00 -06:00
13
+ date: 2011-03-03 00:00:00 -06:00
15
14
  default_executable:
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: capistrano
19
- prerelease: false
20
- requirement: &id001 !ruby/object:Gem::Requirement
21
- none: false
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
22
21
  requirements:
23
22
  - - ~>
24
23
  - !ruby/object:Gem::Version
25
24
  version: 2.5.19
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: mail
26
28
  type: :runtime
27
- version_requirements: *id001
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 2.2.15
35
+ version:
28
36
  - !ruby/object:Gem::Dependency
29
37
  name: bundler
30
- prerelease: false
31
- requirement: &id002 !ruby/object:Gem::Requirement
32
- none: false
38
+ type: :development
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
33
41
  requirements:
34
42
  - - ~>
35
43
  - !ruby/object:Gem::Version
36
44
  version: 1.0.10
37
- type: :development
38
- version_requirements: *id002
45
+ version:
39
46
  description: ...for the Deployment Soul. Why do you keep typing all that crap into your Capistrano recipes? Are you too cool for standards? Well, ARE YA!?
40
47
  email: support@thekompanee.com
41
48
  executables: []
@@ -52,22 +59,31 @@ files:
52
59
  - README.md
53
60
  - Rakefile
54
61
  - chicken_soup.gemspec
62
+ - lib/chicken_soup/capabilities.rb
55
63
  - lib/chicken_soup/capabilities/apache.rb
56
64
  - lib/chicken_soup/capabilities/bundler.rb
65
+ - lib/chicken_soup/capabilities/checks.rb
66
+ - lib/chicken_soup/capabilities/defaults.rb
57
67
  - lib/chicken_soup/capabilities/git.rb
58
68
  - lib/chicken_soup/capabilities/heroku.rb
59
- - lib/chicken_soup/capabilities/hoptoad.rb
60
69
  - lib/chicken_soup/capabilities/mysql.rb
61
70
  - lib/chicken_soup/capabilities/passenger.rb
62
71
  - lib/chicken_soup/capabilities/postgres.rb
63
72
  - lib/chicken_soup/capabilities/rvm.rb
64
73
  - lib/chicken_soup/capabilities/shared/db.rb
74
+ - lib/chicken_soup/capabilities/svn.rb
65
75
  - lib/chicken_soup/capabilities/unix.rb
66
76
  - lib/chicken_soup/deploy.rb
67
77
  - lib/chicken_soup/environment.rb
68
78
  - lib/chicken_soup/environment/checks.rb
69
79
  - lib/chicken_soup/environment/defaults.rb
70
80
  - lib/chicken_soup/global.rb
81
+ - lib/chicken_soup/notifiers.rb
82
+ - lib/chicken_soup/notifiers/checks.rb
83
+ - lib/chicken_soup/notifiers/defaults.rb
84
+ - lib/chicken_soup/notifiers/email.rb
85
+ - lib/chicken_soup/notifiers/git.rb
86
+ - lib/chicken_soup/notifiers/hoptoad.rb
71
87
  - lib/chicken_soup/version.rb
72
88
  - lib/chicken_stock.rb
73
89
  has_rdoc: true
@@ -80,23 +96,23 @@ rdoc_options:
80
96
  require_paths:
81
97
  - lib
82
98
  required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
99
  requirements:
85
100
  - - ">="
86
101
  - !ruby/object:Gem::Version
87
102
  version: "0"
103
+ version:
88
104
  required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
105
  requirements:
91
106
  - - ">="
92
107
  - !ruby/object:Gem::Version
93
108
  version: "0"
109
+ version:
94
110
  requirements: []
95
111
 
96
112
  rubyforge_project: chicken_soup
97
- rubygems_version: 1.5.0
113
+ rubygems_version: 1.3.5
98
114
  signing_key:
99
115
  specification_version: 3
100
- summary: chicken_soup-0.0.5
116
+ summary: chicken_soup-0.1.0
101
117
  test_files: []
102
118