chicken_soup 0.5.3 → 0.6.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.
- data/README.md +128 -9
- data/lib/chicken_soup/capabilities/apache/apache-checks.rb +2 -0
- data/lib/chicken_soup/capabilities/apache/apache-defaults.rb +16 -12
- data/lib/chicken_soup/capabilities/bundler/bundler-checks.rb +2 -0
- data/lib/chicken_soup/capabilities/bundler/bundler-defaults.rb +2 -0
- data/lib/chicken_soup/capabilities/bundler/bundler-tasks.rb +12 -9
- data/lib/chicken_soup/capabilities/git/git-checks.rb +21 -0
- data/lib/chicken_soup/capabilities/git/git-defaults.rb +1 -2
- data/lib/chicken_soup/capabilities/github/github-defaults.rb +23 -0
- data/lib/chicken_soup/capabilities/github/github-tasks.rb +14 -0
- data/lib/chicken_soup/capabilities/heroku/heroku-checks.rb +2 -0
- data/lib/chicken_soup/capabilities/heroku/heroku-defaults.rb +2 -0
- data/lib/chicken_soup/capabilities/mysql/mysql-checks.rb +32 -0
- data/lib/chicken_soup/capabilities/nginx/nginx-checks.rb +2 -0
- data/lib/chicken_soup/capabilities/nginx/nginx-defaults.rb +12 -8
- data/lib/chicken_soup/capabilities/postgres/postgres-checks.rb +13 -0
- data/lib/chicken_soup/capabilities/rvm/rvm-checks.rb +7 -5
- data/lib/chicken_soup/capabilities/rvm/rvm-defaults.rb +7 -3
- data/lib/chicken_soup/capabilities/rvm/rvm-tasks.rb +8 -4
- data/lib/chicken_soup/capabilities/shared/db-checks.rb +2 -0
- data/lib/chicken_soup/capabilities/shared/db-defaults.rb +2 -0
- data/lib/chicken_soup/capabilities/shared/db-tasks.rb +17 -11
- data/lib/chicken_soup/capabilities/shared/web_server-tasks.rb +2 -0
- data/lib/chicken_soup/capabilities/svn/svn-defaults.rb +2 -0
- data/lib/chicken_soup/capabilities/unix/unix-checks.rb +2 -0
- data/lib/chicken_soup/capabilities/unix/unix-defaults.rb +2 -0
- data/lib/chicken_soup/capabilities/unix/unix-tasks.rb +5 -8
- data/lib/chicken_soup/capabilities.rb +4 -2
- data/lib/chicken_soup/deploy.rb +0 -1
- data/lib/chicken_soup/environment/checks.rb +2 -0
- data/lib/chicken_soup/environment/defaults.rb +5 -0
- data/lib/chicken_soup/global.rb +182 -121
- data/lib/chicken_soup/notifiers/airbrake/airbrake-tasks.rb +21 -0
- data/lib/chicken_soup/notifiers/email/email-checks.rb +2 -0
- data/lib/chicken_soup/notifiers/email/email-defaults.rb +2 -0
- data/lib/chicken_soup/notifiers/email/email-tasks.rb +19 -11
- data/lib/chicken_soup/notifiers/email/presenter.rb +3 -2
- data/lib/chicken_soup/notifiers/git/git-tasks.rb +3 -4
- data/lib/chicken_soup/notifiers.rb +2 -0
- data/lib/chicken_soup/version.rb +1 -1
- metadata +7 -3
- data/lib/chicken_soup/notifiers/hoptoad/hoptoad-tasks.rb +0 -6
data/README.md
CHANGED
@@ -1,16 +1,136 @@
|
|
1
|
-
Chicken Soup... for the
|
2
|
-
================================
|
1
|
+

|
3
2
|
|
4
|
-
|
3
|
+
Even more opinionated than Capistrano itself, Chicken Soup adds a lot of useful tasks
|
4
|
+
specifically for those who want to DRY up deploying their Rails applications.
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
Interface
|
7
|
+
------------------------
|
8
|
+
Whether deploying to Heroku or your own servers, Chicken Soup gives you one command
|
9
|
+
interface to do it all.
|
10
|
+
|
11
|
+
Capabilities
|
12
|
+
------------------------
|
13
|
+
Chicken Soup makes it easy to only use the functionality you need. Out of the box it
|
14
|
+
comes with:
|
15
|
+
|
16
|
+
* Heroku
|
17
|
+
* Unix Server
|
18
|
+
* Apache
|
19
|
+
* Nginx
|
20
|
+
* RVM
|
21
|
+
* Bundler
|
22
|
+
* Isolate (coming soon)
|
23
|
+
* Git
|
24
|
+
* Github
|
25
|
+
* Subversion (partial)
|
26
|
+
* Passenger
|
27
|
+
* Postgres
|
28
|
+
* MySQL
|
29
|
+
|
30
|
+
Notifiers
|
31
|
+
------------------------
|
32
|
+
Executing items to notify upon a successful deployment is a breeze. Chicken Soup comes
|
33
|
+
loaded with:
|
34
|
+
|
35
|
+
* Email
|
36
|
+
* Git Tagging
|
37
|
+
|
38
|
+
Installation
|
39
|
+
------------------------
|
40
|
+
gem install chicken_soup
|
41
|
+
|
42
|
+
or
|
43
|
+
|
44
|
+
gem chicken_soup, :require => false
|
45
|
+
|
46
|
+
in your Gemfile.
|
47
|
+
|
48
|
+
Run the included generator to create Rake tasks that Chicken Soup will need to do awesome stuff
|
49
|
+
on the server.
|
50
|
+
|
51
|
+
rails generate chicken_soup:add_ingredients
|
52
|
+
|
53
|
+
This will also modify your Capfile (or create it if you don't have one) and install a file in
|
54
|
+
`lib/recipes/` which will load Chicken Soup when you invoke Capistrano.
|
55
|
+
|
56
|
+
Finally, you'll get a deploy.rb template that will get you started with your Chicken Soup
|
57
|
+
experience.
|
58
|
+
|
59
|
+
Getting Started
|
60
|
+
------------------------
|
61
|
+
Chicken Soup is all about sensible defaults. Any of which can be overridden in your deploy.rb
|
62
|
+
file.
|
63
|
+
|
64
|
+
Let's take a common example. You're deploying to your Unix server and you have your code
|
65
|
+
repository stored on Github. You use Bundler to handle all of your gem needs and RVM is installed
|
66
|
+
to manage your Ruby versions. Instead of remembering all kinds of random configurations such
|
67
|
+
as `default_run_options[:pty] = true` or where you need to include the Capistrano helpers for Bundler,
|
68
|
+
you can put this in your deploy.rb file:
|
69
|
+
|
70
|
+
set :application, 'myapplication'
|
71
|
+
set :capabilities, [:unix, :github, :bundler, :rvm]
|
72
|
+
|
73
|
+
set :deployment_type, :unix
|
74
|
+
|
75
|
+
And you can deploy with:
|
76
|
+
|
77
|
+
cap <staging|production> deploy
|
8
78
|
|
79
|
+
Want to add automatic Nginx integration? Just add :nginx to your capabilities list and your deployment
|
80
|
+
will do the right thing.
|
81
|
+
|
82
|
+
Wnat to migrate your application's DB automatically during deployment? Add :mysql or :postgres to your
|
83
|
+
capabilities list.
|
84
|
+
|
85
|
+
How Does This Work?
|
86
|
+
------------------------
|
87
|
+
Well, that's what we mean by 'sensible defaults'. Using the above configuration, Chicken Soup will infer
|
88
|
+
certain things. For example, it will look in your gitconfig file for either a github username or a git
|
89
|
+
username. If either of these are found, it will assume your source code can be retrieved from:
|
90
|
+
|
91
|
+
git://github.com/your_username/myapplication
|
92
|
+
|
93
|
+
To figure out the server, it will assume you want to connect to:
|
94
|
+
|
95
|
+
staging.myapplication.com
|
96
|
+
|
97
|
+
for staging. And:
|
98
|
+
|
99
|
+
myapplication.com
|
100
|
+
|
101
|
+
for production.
|
102
|
+
|
103
|
+
Built-in Multistage Support
|
104
|
+
------------------------
|
105
|
+
Yes it's required. It's what makes Chicken Soup 'opinionated'. In your deploy.rb file, you'll want
|
106
|
+
(if you want different settings in staging vs production) to create 2 tasks:
|
107
|
+
|
108
|
+
* :staging
|
109
|
+
* :production
|
110
|
+
|
111
|
+
Each of these tasks will contain 'siloed' variables that will only be set when deploying to that
|
112
|
+
environment.
|
113
|
+
|
114
|
+
__Note: Yes, we know about the Capistrano multi-stage extension but found it not extensible enough or useful
|
115
|
+
enough for us to reuse here. We attempted to keep to the same API in order to make it easy for people to
|
116
|
+
transition.__
|
117
|
+
|
118
|
+
What Isn't Chicken Soup?
|
119
|
+
------------------------
|
120
|
+
Chicken Soup is __not__ a server management tool. It is used for easing deployment woes. In other words,
|
121
|
+
use it to `start`, `stop` and `restart` Nginx. Not to __install__ Nginx.
|
122
|
+
|
123
|
+
Making Your Own Chicken Soup
|
124
|
+
------------------------
|
125
|
+
We attempted to develop Chicken Soup to be as easy as possible to add new notifiers and capabilities to your
|
126
|
+
deployments. Redis, MongoDB, Isolate, Mercurial, they're all fair game. So get Pull Requestin'!!
|
127
|
+
|
128
|
+
Issues
|
129
|
+
------------------------
|
9
130
|
If you have problems, please create a [Github issue](https://github.com/jfelchner/chicken_soup/issues).
|
10
131
|
|
11
132
|
Credits
|
12
|
-
|
13
|
-
|
133
|
+
-------------------------
|
14
134
|

|
15
135
|
|
16
136
|
chicken_soup is maintained by [The Kompanee, Ltd.](http://www.thekompanee.com)
|
@@ -18,7 +138,6 @@ chicken_soup is maintained by [The Kompanee, Ltd.](http://www.thekompanee.com)
|
|
18
138
|
The names and logos for The Kompanee are trademarks of The Kompanee, Ltd.
|
19
139
|
|
20
140
|
License
|
21
|
-
|
22
|
-
|
141
|
+
-------------------------
|
23
142
|
chicken_soup is Copyright © 2011 The Kompanee. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
24
143
|
|
@@ -1,7 +1,23 @@
|
|
1
1
|
######################################################################
|
2
2
|
# APACHE DEFAULTS #
|
3
3
|
######################################################################
|
4
|
+
module ChickenSoup
|
5
|
+
def find_web_server_control_script
|
6
|
+
if remote_file_exists?("/usr/sbin/apachectl")
|
7
|
+
set :web_server_control_script, "/usr/sbin/apachectl"
|
8
|
+
elsif remote_file_exists?("/usr/sbin/apache2")
|
9
|
+
set :web_server_control_script, "/usr/sbin/apache2"
|
10
|
+
elsif remote_file_exists?("/usr/sbin/httpd")
|
11
|
+
set :web_server_control_script, "/usr/sbin/httpd"
|
12
|
+
end
|
13
|
+
|
14
|
+
abort "Couldn't figure out how to control your installation of Apache" unless exists?(:web_server_control_script)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
Capistrano::Configuration.instance(:must_exist).load do
|
19
|
+
extend ChickenSoup
|
20
|
+
|
5
21
|
namespace :capabilities do
|
6
22
|
namespace :defaults do
|
7
23
|
desc "[internal] Sets intelligent defaults for Apache deployments."
|
@@ -16,15 +32,3 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
16
32
|
end
|
17
33
|
end
|
18
34
|
end
|
19
|
-
|
20
|
-
def find_web_server_control_script
|
21
|
-
if remote_file_exists?("/usr/sbin/apachectl")
|
22
|
-
set :web_server_control_script, "/usr/sbin/apachectl"
|
23
|
-
elsif remote_file_exists?("/usr/sbin/apache2")
|
24
|
-
set :web_server_control_script, "/usr/sbin/apache2"
|
25
|
-
elsif remote_file_exists?("/usr/sbin/httpd")
|
26
|
-
set :web_server_control_script, "/usr/sbin/httpd"
|
27
|
-
end
|
28
|
-
|
29
|
-
abort "Couldn't figure out how to control your installation of Apache" unless exists?(:web_server_control_script)
|
30
|
-
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# BUNDLER 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 Bundler deployments."
|
@@ -2,24 +2,31 @@
|
|
2
2
|
# BUNDLER TASKS #
|
3
3
|
######################################################################
|
4
4
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
extend ChickenSoup
|
6
|
+
|
5
7
|
before 'gems:install', 'bundler:install'
|
6
8
|
|
7
9
|
run_task 'bundler:install', :as => manager_username
|
8
10
|
|
9
11
|
namespace :gems do
|
10
|
-
desc "
|
12
|
+
desc "Processes the file containing all of the gems that you want installed and installs them one-by-one."
|
11
13
|
task :install, :roles => :app do
|
12
|
-
|
14
|
+
run_with_ruby_manager full_ruby_environment_string, "bundle install --gemfile #{latest_release}/Gemfile --path #{gem_packager_gem_path} --deployment --without development test"
|
13
15
|
end
|
14
16
|
|
15
|
-
desc
|
17
|
+
desc <<-DESC
|
18
|
+
Checks for the newest version of each gem and installs it.
|
19
|
+
|
20
|
+
> Note: This can never be used in production. If you really wish to do this,
|
21
|
+
> you'll need to log into the server manually or use Capistrano's `console` task.
|
22
|
+
DESC
|
16
23
|
task :update, :roles => :app do
|
17
24
|
abort "I'm sorry Dave, but I can't let you do that. I have full control over production." if rails_env == 'production'
|
18
25
|
|
19
26
|
run "cd #{latest_release} && bundle update"
|
20
27
|
end
|
21
28
|
|
22
|
-
desc "
|
29
|
+
desc "Removes all of the gems currently installed."
|
23
30
|
task :clean, :roles => :app do
|
24
31
|
run "rm -rf #{gem_packager_gem_path}/*"
|
25
32
|
end
|
@@ -30,11 +37,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
30
37
|
task :install, :roles => :app do
|
31
38
|
bundler_install_command = "gem install bundler --version #{gem_packager_version} --no-ri --no-rdoc && gem cleanup bundler"
|
32
39
|
|
33
|
-
|
34
|
-
run_with_rvm "#{ruby_version}@global", bundler_install_command
|
35
|
-
else
|
36
|
-
run bundler_install_command
|
37
|
-
end
|
40
|
+
run_with_ruby_manager "#{ruby_version}@global", bundler_install_command
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
######################################################################
|
2
|
+
# GIT CHECKS #
|
3
|
+
######################################################################
|
4
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
namespace :capabilities do
|
6
|
+
namespace :variable do
|
7
|
+
namespace :check do
|
8
|
+
desc <<-DESC
|
9
|
+
[internal] Checks to see if all necessary Git variables have been set up.
|
10
|
+
DESC
|
11
|
+
task :rvm do
|
12
|
+
required_variables = [
|
13
|
+
:repository
|
14
|
+
]
|
15
|
+
|
16
|
+
verify_variables(required_variables)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,13 +6,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
6
6
|
namespace :defaults do
|
7
7
|
desc "[internal] Sets intelligent version control defaults for deployments"
|
8
8
|
task :git do
|
9
|
-
_cset :github_account, ENV["USER"]
|
10
9
|
_cset :deploy_via, :remote_cache
|
11
10
|
|
12
11
|
set :scm, :git
|
13
|
-
set(:repository) { "git@github.com:#{github_account}/#{application}.git" }
|
14
12
|
set(:branch) { `git branch`.match(/\* (\S+)\s/m)[1] || raise("Couldn't determine current branch") }
|
15
13
|
set(:remote) { `git remote`.match(/(\S+)\s/m)[1] || raise("Couldn't determine default remote repository") }
|
14
|
+
|
16
15
|
ssh_options[:forward_agent] = true
|
17
16
|
end
|
18
17
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
######################################################################
|
2
|
+
# GITHUB DEFAULTS #
|
3
|
+
######################################################################
|
4
|
+
require 'chicken_soup/capabilities/git/git-defaults'
|
5
|
+
|
6
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
7
|
+
before 'capabilities:defaults:github', 'capabilities:defaults:git'
|
8
|
+
|
9
|
+
namespace :capabilities do
|
10
|
+
namespace :defaults do
|
11
|
+
desc "[internal] Sets defaults for deployments from Github"
|
12
|
+
task :github do
|
13
|
+
gitconfig_github_user = `git config --get github.user`.chomp
|
14
|
+
|
15
|
+
_cset :github_account, gitconfig_github_user != '' ? gitconfig_github_user : local_user
|
16
|
+
_cset :github_repository, application
|
17
|
+
|
18
|
+
set :github_url, "https://github.com/#{github_account}/#{github_repository}"
|
19
|
+
set(:repository) { "git@github.com:#{github_account}/#{github_repository}.git" }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
######################################################################
|
2
|
+
# GITHUB TASKS #
|
3
|
+
######################################################################
|
4
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
namespace :git do
|
6
|
+
desc <<-DESC
|
7
|
+
Opens the default browser so that you can view the commit that
|
8
|
+
is currently on the specified environment.
|
9
|
+
DESC
|
10
|
+
task :browse do
|
11
|
+
`open #{github_url}/tree/#{current_revision}`
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# HEROKU 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 Heroku deployments"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
######################################################################
|
2
|
+
# MYSQL CHECKS #
|
3
|
+
######################################################################
|
4
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
require 'chicken_soup/capabilities/shared/db-checks'
|
6
|
+
|
7
|
+
namespace :capabilities do
|
8
|
+
namespace :variable do
|
9
|
+
namespace :check do
|
10
|
+
desc <<-DESC
|
11
|
+
[internal] Checks to see if all necessary MySQL capabilities variables have been set up.
|
12
|
+
DESC
|
13
|
+
task :mysql do
|
14
|
+
capabilities.variable.check.db
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
namespace :capabilities do
|
21
|
+
namespace :deployment do
|
22
|
+
namespace :check do
|
23
|
+
desc <<-DESC
|
24
|
+
[internal] Checks to see MySQL is ready for deployment.
|
25
|
+
DESC
|
26
|
+
task :mysql do
|
27
|
+
capabilities.deployment.check.db
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,7 +1,19 @@
|
|
1
1
|
######################################################################
|
2
2
|
# NGINX DEFAULTS #
|
3
3
|
######################################################################
|
4
|
+
module ChickenSoup
|
5
|
+
def find_web_server_control_script
|
6
|
+
if remote_file_exists?("/etc/init.d/nginx")
|
7
|
+
set :web_server_control_script, "/etc/init.d/nginx"
|
8
|
+
end
|
9
|
+
|
10
|
+
abort "Couldn't figure out how to control your installation of Nginx" unless exists?(:web_server_control_script)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
4
14
|
Capistrano::Configuration.instance(:must_exist).load do
|
15
|
+
extend ChickenSoup
|
16
|
+
|
5
17
|
namespace :capabilities do
|
6
18
|
namespace :defaults do
|
7
19
|
desc "[internal] Checks to see what type of Nginx installation is running on the remote."
|
@@ -11,11 +23,3 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
11
23
|
end
|
12
24
|
end
|
13
25
|
end
|
14
|
-
|
15
|
-
def find_web_server_control_script
|
16
|
-
if remote_file_exists?("/etc/init.d/nginx")
|
17
|
-
set :web_server_control_script, "/etc/init.d/nginx"
|
18
|
-
end
|
19
|
-
|
20
|
-
abort "Couldn't figure out how to control your installation of Nginx" unless exists?(:web_server_control_script)
|
21
|
-
end
|
@@ -16,4 +16,17 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
namespace :capabilities do
|
21
|
+
namespace :deployment do
|
22
|
+
namespace :check do
|
23
|
+
desc <<-DESC
|
24
|
+
[internal] Checks to see Postgres is ready for deployment.
|
25
|
+
DESC
|
26
|
+
task :postgres do
|
27
|
+
capabilities.deployment.check.db
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
19
32
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# RVM CHECKS #
|
3
3
|
######################################################################
|
4
4
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
extend ChickenSoup
|
6
|
+
|
5
7
|
namespace :capabilities do
|
6
8
|
namespace :variable do
|
7
9
|
namespace :check do
|
@@ -12,8 +14,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
12
14
|
required_variables = [
|
13
15
|
:rvmrc_file,
|
14
16
|
:ruby_version,
|
15
|
-
:
|
16
|
-
:
|
17
|
+
:ruby_gemset,
|
18
|
+
:full_ruby_environment_string,
|
17
19
|
]
|
18
20
|
|
19
21
|
verify_variables(required_variables)
|
@@ -26,11 +28,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
26
28
|
task :rvm do
|
27
29
|
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
30
|
|
29
|
-
rvmrc_file_contents
|
30
|
-
set :
|
31
|
+
rvmrc_file_contents = capture("cat #{current_path}/.rvmrc", :roles => :app)
|
32
|
+
set :current_ruby_environment_string, rvmrc_file_contents.match(ChickenSoup::RVM_INFO_FORMAT)[1]
|
31
33
|
|
32
34
|
unless ruby_version_update_pending
|
33
|
-
abort "'#{
|
35
|
+
abort "'#{full_ruby_environment_string}' does not match the version currently installed on the server (#{current_ruby_environment_string}). Please run 'cap <environment> ruby:update deploy:subzero' if you would like to upgrade your Ruby version prior to deploying." unless current_ruby_environment_string == full_ruby_environment_string
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
######################################################################
|
2
2
|
# RVM DEFAULTS #
|
3
3
|
######################################################################
|
4
|
-
|
4
|
+
module ChickenSoup
|
5
|
+
RVM_INFO_FORMAT = /^rvm.+\s(([a-zA-Z0-9\-\._]+)(?:@([a-zA-Z0-9\-\._]+))?)/
|
6
|
+
end
|
5
7
|
|
6
8
|
Capistrano::Configuration.instance(:must_exist).load do
|
9
|
+
extend ChickenSoup
|
10
|
+
|
7
11
|
namespace :capabilities do
|
8
12
|
namespace :defaults do
|
9
13
|
_cset :rvmrc_file, File.join(rails_root, '.rvmrc')
|
@@ -14,12 +18,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
14
18
|
contents.match(ChickenSoup::RVM_INFO_FORMAT)[2]
|
15
19
|
end
|
16
20
|
|
17
|
-
_cset(:
|
21
|
+
_cset(:ruby_gemset) do
|
18
22
|
contents = File.read(rvmrc_file)
|
19
23
|
contents.match(ChickenSoup::RVM_INFO_FORMAT)[3]
|
20
24
|
end
|
21
25
|
|
22
|
-
_cset(:
|
26
|
+
_cset(:full_ruby_environment_string) {ruby_gemset ? "#{ruby_version}@#{ruby_gemset}" : ruby_version}
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
######################################################################
|
2
2
|
# RVM TASKS #
|
3
3
|
######################################################################
|
4
|
-
|
5
|
-
|
4
|
+
module ChickenSoup
|
5
|
+
def run_with_ruby_manager(ruby_env_string, command, options = {})
|
6
|
+
run "rvm use #{ruby_env_string} && #{command}", options
|
7
|
+
end
|
6
8
|
end
|
7
9
|
|
8
10
|
Capistrano::Configuration.instance(:must_exist).load do
|
11
|
+
extend ChickenSoup
|
12
|
+
|
9
13
|
run_task 'ruby:update', :as => manager_username
|
10
14
|
|
11
15
|
namespace :ruby do
|
@@ -23,8 +27,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
23
27
|
|
24
28
|
set :ruby_version_update_pending, false
|
25
29
|
|
26
|
-
run("rvm use --create #{
|
27
|
-
run("rvm wrapper #{
|
30
|
+
run("rvm use --create #{full_ruby_environment_string}")
|
31
|
+
run("rvm wrapper #{full_ruby_environment_string} #{application_server_type}")
|
28
32
|
else
|
29
33
|
set :ruby_version_update_pending, true
|
30
34
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# DB 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 DB deployments."
|
@@ -2,12 +2,15 @@
|
|
2
2
|
# COMMON DB TASKS #
|
3
3
|
######################################################################
|
4
4
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
extend ChickenSoup
|
6
|
+
|
5
7
|
_cset(:db_root_password) {Capistrano::CLI.password_prompt("Root Password For DB: ")}
|
6
8
|
_cset(:db_app_password) {Capistrano::CLI.password_prompt("App Password For DB: ")}
|
7
9
|
|
8
10
|
run_task "db:create", :as => manager_username
|
9
11
|
run_task "db:drop", :as => manager_username
|
10
12
|
|
13
|
+
before "deploy:cleanup", "deploy:migrate"
|
11
14
|
before "deploy:migrate", "db:backup" unless skip_backup_before_migration
|
12
15
|
|
13
16
|
namespace :db do
|
@@ -25,23 +28,26 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
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
31
|
namespace :pull do
|
32
|
+
desc <<-DESC
|
33
|
+
Creates an easy way to debug remote data locally.
|
34
|
+
|
35
|
+
* Running this task will create a dump file of all the data in the specified
|
36
|
+
environment.
|
37
|
+
* Copy the dump file to the local machine
|
38
|
+
* Drop and recreate all local databases
|
39
|
+
* Import the dump file
|
40
|
+
* Bring the local DB up-to-date with any local migrations
|
41
|
+
* Prepare the test environment
|
42
|
+
DESC
|
40
43
|
task :default, :roles => :db, :only => {:primary => true} do
|
41
44
|
db.backup.default
|
42
45
|
db.pull.latest
|
43
46
|
end
|
44
47
|
|
48
|
+
desc <<-DESC
|
49
|
+
Just like `db:pull` but doesn't create a new backup first.
|
50
|
+
DESC
|
45
51
|
task :latest, :roles => :db, :only => {:primary => true} do
|
46
52
|
latest_backup = capture(%Q{ls #{db_backups_path} -xtC | head -n 1 | cut -d " " -f 1}).chomp
|
47
53
|
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# COMMON WEB SERVER TASKS #
|
3
3
|
######################################################################
|
4
4
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
extend ChickenSoup
|
6
|
+
|
5
7
|
run_task 'web_server:stop', :as => manager_username
|
6
8
|
run_task 'web_server:start', :as => manager_username
|
7
9
|
run_task 'web_server:restart', :as => manager_username
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# SUBVERSION 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 version control defaults for deployments"
|