openminds_deploy 1.0.5.beta → 1.0.5.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/openminds_deploy/defaults.rb +13 -2
- data/lib/openminds_deploy/rails3.rb +0 -14
- metadata +1 -1
@@ -25,13 +25,24 @@ configuration.load do
|
|
25
25
|
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
28
|
after 'deploy:finalize_update', 'dbconfig:link'
|
30
|
-
|
31
29
|
after 'deploy:setup', 'dbconfig:copy_database_config'
|
32
30
|
|
33
31
|
after :deploy, 'deploy:cleanup'
|
34
32
|
|
33
|
+
desc 'Prompts if new migrations are available and runs them if you want to'
|
34
|
+
namespace :deploy do
|
35
|
+
task :needs_migrations, :roles => :db, :only => {:primary => true} do
|
36
|
+
old_rev = capture("cd #{previous_release} && git log --pretty=format:'%H' -n 1 | cat").strip
|
37
|
+
new_rev = capture("cd #{latest_release} && git log --pretty=format:'%H' -n 1 | cat").strip
|
38
|
+
migrations_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('db/migrate')
|
39
|
+
if migrations_changed && Capistrano::CLI.ui.ask("New migrations pending. Enter 'yes' to run db:migrate") == 'yes'
|
40
|
+
migrate
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
after 'deploy:update_code', 'deploy:needs_migrations'
|
45
|
+
|
35
46
|
desc 'Tail application log'
|
36
47
|
task :tail_log, :roles => :app do
|
37
48
|
sudo "tail -f #{shared_path}/log/#{rails_env}.log"
|
@@ -36,18 +36,4 @@ configuration.load do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
40
|
-
desc 'Prompts if new migrations are available and runs them if you want to'
|
41
|
-
namespace :deploy do
|
42
|
-
task :needs_migrations, :roles => :db, :only => {:primary => true} do
|
43
|
-
old_rev = capture("cd #{previous_release} && git log --pretty=format:'%H' -n 1 | cat").strip
|
44
|
-
new_rev = capture("cd #{latest_release} && git log --pretty=format:'%H' -n 1 | cat").strip
|
45
|
-
migrations_changed = capture("cd #{latest_release} && git diff #{old_rev} #{new_rev} --name-only | cat").include?('db/migrate')
|
46
|
-
if migrations_changed && Capistrano::CLI.ui.ask("New migrations pending. Enter 'yes' to run db:migrate") == 'yes'
|
47
|
-
migrate
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
after 'deploy:update_code', 'deploy:needs_migrations'
|
53
39
|
end
|