eycap 0.5.15 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/eycap/recipes.rb +1 -0
- data/lib/eycap/recipes/database.rb +14 -7
- data/lib/eycap/recipes/resque.rb +1 -1
- metadata +3 -3
data/History.txt
CHANGED
data/lib/eycap/recipes.rb
CHANGED
@@ -18,6 +18,7 @@ require 'eycap/recipes/apache'
|
|
18
18
|
require 'eycap/recipes/bundler'
|
19
19
|
require 'eycap/recipes/ssl'
|
20
20
|
require 'eycap/recipes/delayed_job'
|
21
|
+
require 'eycap/recipes/resque'
|
21
22
|
|
22
23
|
Capistrano::Configuration.instance(:must_exist).load do
|
23
24
|
default_run_options[:pty] = true if respond_to?(:default_run_options)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
1
3
|
Capistrano::Configuration.instance(:must_exist).load do
|
2
4
|
|
3
5
|
namespace :db do
|
@@ -7,7 +9,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
7
9
|
backup_time = [now.year,now.month,now.day,now.hour,now.min,now.sec].join('-')
|
8
10
|
set :backup_file, "#{shared_path}/db_backups/#{environment_database}-snapshot-#{backup_time}.sql"
|
9
11
|
end
|
10
|
-
|
12
|
+
|
11
13
|
desc "Clone Production Database to Staging Database."
|
12
14
|
task :clone_prod_to_staging, :roles => :db, :only => { :primary => true } do
|
13
15
|
|
@@ -30,7 +32,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
30
32
|
end
|
31
33
|
run "rm -f #{backup_file}.gz"
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
desc "Backup your MySQL or PostgreSQL database to shared_path+/db_backups"
|
35
37
|
task :dump, :roles => :db, :only => {:primary => true} do
|
36
38
|
backup_name unless exists?(:backup_file)
|
@@ -40,7 +42,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
40
42
|
if ['mysql', 'mysql2'].include? @environment_info['adapter']
|
41
43
|
dbhost = @environment_info['host']
|
42
44
|
if rails_env == "production"
|
43
|
-
dbhost = environment_dbhost.sub('-master', '') + '-replica' if dbhost != 'localhost' # added for Solo offering, which uses localhost
|
45
|
+
dbhost = environment_dbhost.sub('-master', '') + '-replica' if dbhost != 'localhost' # added for Solo offering, which uses localhost
|
44
46
|
end
|
45
47
|
run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | gzip -c > #{backup_file}.gz" do |ch, stream, out |
|
46
48
|
ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
|
@@ -51,21 +53,26 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
54
|
-
|
56
|
+
|
55
57
|
desc "Sync your production database to your local workstation"
|
56
58
|
task :clone_to_local, :roles => :db, :only => {:primary => true} do
|
57
59
|
backup_name unless exists?(:backup_file)
|
58
60
|
dump
|
59
61
|
get "#{backup_file}.gz", "/tmp/#{application}.sql.gz"
|
60
|
-
development_info = YAML.
|
62
|
+
development_info = YAML.load(ERB.new(File.read('config/database.yml')).result)['development']
|
63
|
+
|
61
64
|
if ['mysql', 'mysql2'].include? development_info['adapter']
|
62
65
|
run_str = "gunzip < /tmp/#{application}.sql.gz | mysql -u #{development_info['username']} --password='#{development_info['password']}' -h #{development_info['host']} #{development_info['database']}"
|
63
66
|
else
|
64
|
-
run_str
|
67
|
+
run_str = ""
|
68
|
+
run_str += "PGPASSWORD=#{development_info['password']} " if development_info['password']
|
69
|
+
run_str += "gunzip < /tmp/#{application}.sql.gz | psql -U #{development_info['username']} "
|
70
|
+
run_str += "-h #{development_info['host']} " if development_info['host']
|
71
|
+
run_str += development_info['database']
|
65
72
|
end
|
66
73
|
%x!#{run_str}!
|
67
74
|
run "rm -f #{backup_file}.gz"
|
68
75
|
end
|
69
76
|
end
|
70
77
|
|
71
|
-
end
|
78
|
+
end
|
data/lib/eycap/recipes/resque.rb
CHANGED
@@ -11,7 +11,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
11
11
|
task :symlink, :roles => [:app], :only => {:resque => true} do
|
12
12
|
run "if [ -f #{shared_path}/config/resque.yml ]; then ln -nfs #{shared_path}/config/resque.yml #{latest_release}/config/resque.yml; fi"
|
13
13
|
end
|
14
|
-
after "deploy:
|
14
|
+
after "deploy:symlink_configs", "resque:symlink"
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eycap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 16
|
10
|
+
version: 0.5.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Engine Yard
|