gorilla-capistrano-recipes 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/gorilla-capistrano-recipes.rb +1 -1
- data/lib/gorilla-capistrano-recipes/mysql.rb +55 -51
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require 'capistrano', '>= 2.4.3' # load v2.4.3 or higher
|
@@ -1,52 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
desc 'Dumps the production database to db/production_data.sql on the remote server'
|
5
|
+
task :remote_db_dump, :roles => :db, :only => { :primary => true } do
|
6
|
+
rake = fetch(:rake, "rake")
|
7
|
+
rails_env = fetch(:rails_env, "production")
|
8
|
+
|
9
|
+
run "cd #{deploy_to}/#{current_dir} && " +
|
10
|
+
"#{rake} RAILS_ENV=#{rails_env} db:database_dump --trace"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Loads the production database to db/production_data.sql on the remote server'
|
14
|
+
task :remote_db_load, :roles => :db, :only => { :primary => true } do
|
15
|
+
rake = fetch(:rake, "rake")
|
16
|
+
rails_env = fetch(:rails_env, "production")
|
17
|
+
|
18
|
+
run "cd #{deploy_to}/#{current_dir} && " +
|
19
|
+
"#{rake} RAILS_ENV=#{rails_env} db:production_data_load --trace"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Downloads db/production_data.sql from the remote production environment to your local machine'
|
23
|
+
task :remote_db_download, :roles => :db, :only => { :primary => true } do
|
24
|
+
download("#{deploy_to}/#{current_dir}/db/production_data.sql", "db/production_data.sql", :via => :scp)
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Uploads db/production_data.sql to the remote production environment from your local machine'
|
28
|
+
task :remote_db_upload, :roles => :db, :only => { :primary => true } do
|
29
|
+
upload("db/development_data.sql", "#{deploy_to}/#{current_dir}/db/production_data.sql", :via => :scp)
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Cleans up data dump file'
|
33
|
+
task :remote_db_cleanup, :roles => :db, :only => { :primary => true } do
|
34
|
+
run "rm #{deploy_to}/#{current_dir}/db/production_data.sql"
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Cleans up data dump file'
|
38
|
+
task :remote_cache_cleanup, :roles => :app do
|
39
|
+
run "rm -rf #{deploy_to}/#{current_dir}/cache/* ;true"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Dumps, downloads and then cleans up the production data dump'
|
43
|
+
task :remote_db_runner do
|
44
|
+
remote_db_dump
|
45
|
+
remote_db_download
|
46
|
+
remote_db_cleanup
|
47
|
+
end
|
48
|
+
|
49
|
+
desc 'Dumps, uploads and then cleans up the production data dump'
|
50
|
+
task :local_db_runner do
|
51
|
+
remote_db_upload
|
52
|
+
remote_db_load
|
53
|
+
remote_cache_cleanup
|
54
|
+
remote_db_cleanup
|
55
|
+
end
|
52
56
|
end
|