eycap 0.5.5 → 0.5.6
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/History.txt +4 -0
- data/lib/eycap.rb +1 -3
- data/lib/eycap/lib/ey_logger.rb +2 -2
- data/lib/eycap/recipes/bundler.rb +1 -1
- data/lib/eycap/recipes/database.rb +19 -24
- data/lib/eycap/recipes/slice.rb +3 -3
- metadata +2 -2
data/History.txt
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
== 0.5.6 / 2009-6-17
|
|
2
|
+
* updated bundler task so it won't install test or development gems
|
|
3
|
+
* updated database tasks - based on Tyler Poland's update
|
|
4
|
+
|
|
1
5
|
== 0.5.5 / 2009-3-16
|
|
2
6
|
* fixed 2 bugs that are in 0.5.4 with the SSL and bundler recipes
|
|
3
7
|
* use this version with bundler version 0.9.2
|
data/lib/eycap.rb
CHANGED
data/lib/eycap/lib/ey_logger.rb
CHANGED
|
@@ -63,7 +63,7 @@ module Capistrano
|
|
|
63
63
|
self.close
|
|
64
64
|
|
|
65
65
|
hooks = [:any]
|
|
66
|
-
hooks <<
|
|
66
|
+
hooks << self.successful? ? :success : :failure
|
|
67
67
|
puts "Executing Post Processing Hooks"
|
|
68
68
|
hooks.each do |h|
|
|
69
69
|
@_post_process_hooks[h].each do |key|
|
|
@@ -122,4 +122,4 @@ module Capistrano
|
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
end
|
|
125
|
-
end
|
|
125
|
+
end
|
|
@@ -2,7 +2,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
|
2
2
|
namespace :bundler do
|
|
3
3
|
desc "Automatically installed your bundled gems if a Gemfile exists"
|
|
4
4
|
task :bundle_gems do
|
|
5
|
-
run "if [ -f #{release_path}/Gemfile ]; then cd #{release_path} && bundle install; fi"
|
|
5
|
+
run "if [ -f #{release_path}/Gemfile ]; then cd #{release_path} && bundle install --without=test,development; fi"
|
|
6
6
|
end
|
|
7
7
|
after "deploy:symlink_configs","bundler:bundle_gems"
|
|
8
8
|
end
|
|
@@ -12,45 +12,39 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
|
12
12
|
task :clone_prod_to_staging, :roles => :db, :only => { :primary => true } do
|
|
13
13
|
|
|
14
14
|
# This task currently runs only on traditional EY offerings.
|
|
15
|
-
# You need to have both a production and staging environment defined in
|
|
16
|
-
# your deploy.rb file.
|
|
15
|
+
# You need to have both a production and staging environment defined in
|
|
16
|
+
# your deploy.rb file.
|
|
17
17
|
|
|
18
|
-
backup_name
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
backup_name unless exists?(:backup_file)
|
|
19
|
+
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
|
20
|
+
dump
|
|
21
21
|
|
|
22
22
|
if @environment_info['adapter'] == 'mysql'
|
|
23
|
-
|
|
24
|
-
dbhost = environment_dbhost.sub('-master', '') + '-replica'
|
|
25
|
-
run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
|
|
26
|
-
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
|
27
|
-
end
|
|
28
|
-
run "bzcat #{backup_file}.bz2 | mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database}" do |ch, stream, out|
|
|
23
|
+
run "gunzip < #{backup_file}.gz | mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database}" do |ch, stream, out|
|
|
29
24
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
|
30
25
|
end
|
|
31
26
|
else
|
|
32
|
-
run "
|
|
33
|
-
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
|
34
|
-
end
|
|
35
|
-
run "bzcat #{backup_file}.bz2 | psql -W -U #{dbuser} -h #{staging_dbhost} #{staging_database}" do |ch, stream, out|
|
|
27
|
+
run "gunzip < #{backup_file}.gz | psql -W -U #{dbuser} -h #{staging_dbhost} #{staging_database}" do |ch, stream, out|
|
|
36
28
|
ch.send_data "#{dbpass}\n" if out=~ /^Password/
|
|
37
29
|
end
|
|
38
30
|
end
|
|
39
|
-
run "rm -f #{backup_file}.
|
|
31
|
+
run "rm -f #{backup_file}.gz"
|
|
40
32
|
end
|
|
41
33
|
|
|
42
34
|
desc "Backup your MySQL or PostgreSQL database to shared_path+/db_backups"
|
|
43
35
|
task :dump, :roles => :db, :only => {:primary => true} do
|
|
44
|
-
backup_name
|
|
36
|
+
backup_name unless exists?(:backup_file)
|
|
37
|
+
on_rollback { run "rm -f #{backup_file}" }
|
|
45
38
|
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
|
39
|
+
|
|
46
40
|
if @environment_info['adapter'] == 'mysql'
|
|
47
41
|
dbhost = @environment_info['host']
|
|
48
42
|
dbhost = environment_dbhost.sub('-master', '') + '-replica' if dbhost != 'localhost' # added for Solo offering, which uses localhost
|
|
49
|
-
run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} |
|
|
43
|
+
run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | gzip -c > #{backup_file}.gz" do |ch, stream, out |
|
|
50
44
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
|
51
45
|
end
|
|
52
46
|
else
|
|
53
|
-
run "pg_dump -W -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} |
|
|
47
|
+
run "pg_dump -W -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | gzip -c > #{backup_file}.gz" do |ch, stream, out |
|
|
54
48
|
ch.send_data "#{dbpass}\n" if out=~ /^Password:/
|
|
55
49
|
end
|
|
56
50
|
end
|
|
@@ -58,17 +52,18 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
|
58
52
|
|
|
59
53
|
desc "Sync your production database to your local workstation"
|
|
60
54
|
task :clone_to_local, :roles => :db, :only => {:primary => true} do
|
|
61
|
-
backup_name
|
|
55
|
+
backup_name unless exists?(:backup_file)
|
|
62
56
|
dump
|
|
63
|
-
get "#{backup_file}.
|
|
57
|
+
get "#{backup_file}.gz", "/tmp/#{application}.sql.gz"
|
|
64
58
|
development_info = YAML.load_file("config/database.yml")['development']
|
|
65
59
|
if development_info['adapter'] == 'mysql'
|
|
66
|
-
run_str = "
|
|
60
|
+
run_str = "gunzip < /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} --password='#{development_info['password']}' -h #{development_info['host']} #{development_info['database']}"
|
|
67
61
|
else
|
|
68
|
-
run_str = "PGPASSWORD=#{development_info['password']}
|
|
62
|
+
run_str = "PGPASSWORD=#{development_info['password']} gunzip < /tmp/#{application}.sql.gz | psql -U #{development_info['username']} -h #{development_info['host']} #{development_info['database']}"
|
|
69
63
|
end
|
|
70
64
|
%x!#{run_str}!
|
|
65
|
+
run "rm -f #{backup_file}.gz"
|
|
71
66
|
end
|
|
72
67
|
end
|
|
73
68
|
|
|
74
|
-
end
|
|
69
|
+
end
|
data/lib/eycap/recipes/slice.rb
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Capistrano::Configuration.instance(:must_exist).load do
|
|
2
2
|
|
|
3
3
|
namespace :slice do
|
|
4
|
-
desc "Tail the Rails
|
|
5
|
-
task :
|
|
4
|
+
desc "Tail the Rails production log for this environment"
|
|
5
|
+
task :tail_production_logs, :roles => :app do
|
|
6
6
|
run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
|
|
7
7
|
puts # for an extra line break before the host name
|
|
8
8
|
puts "#{channel[:server]} -> #{data}"
|
|
9
9
|
break if stream == :err
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
|
-
desc "Tail the Mongrel logs
|
|
12
|
+
desc "Tail the Mongrel logs this environment"
|
|
13
13
|
task :tail_mongrel_logs, :roles => :app do
|
|
14
14
|
run "tail -f #{shared_path}/log/mongrel*.log" do |channel, stream, data|
|
|
15
15
|
puts # for an extra line break before the host name
|