From f0a698d8062aaf80fcbb937b0094bd05cf9de486 Mon Sep 17 00:00:00 2001 From: danielgrippi <danielgrippi@gmail.com> Date: Wed, 18 Jan 2012 16:43:40 -0800 Subject: [PATCH] added before_deploy and after_deploy tasks --- lib/tasks/after_deploy.rake | 13 +++++++++++++ lib/tasks/before_deploy.rake | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 lib/tasks/after_deploy.rake create mode 100644 lib/tasks/before_deploy.rake diff --git a/lib/tasks/after_deploy.rake b/lib/tasks/after_deploy.rake new file mode 100644 index 0000000000..16d3707c50 --- /dev/null +++ b/lib/tasks/after_deploy.rake @@ -0,0 +1,13 @@ +desc "revert custom landing page commit after heroku san deploys" +task :after_deploy => :environment do + + # Perform this task only if custom landing page is not present in app/views/home/_show.html.haml + if File.exist?(File.join(Rails.root, "app", "views", "home", "_show.html.haml")) && system("git log | head -5 | grep 'custom\ landing\ page'") + puts "-----> resetting HEAD before custom landing page commit" + + system("git reset --hard HEAD^") ? true : fail + + puts "-----> done" + end + +end diff --git a/lib/tasks/before_deploy.rake b/lib/tasks/before_deploy.rake new file mode 100644 index 0000000000..4dc4c6b6df --- /dev/null +++ b/lib/tasks/before_deploy.rake @@ -0,0 +1,16 @@ +desc "include custom landing page before heroku san deploys" +task :before_deploy => :environment do + + # Perform this task only if custom landing page is not present in app/views/home/_show.html.haml + if File.exist?(File.join(Rails.root, "app", "views", "home", "_show.html.haml")) + puts "-----> custom landing page detected..." + + puts "-----> including custom landing page in a temp commit" + + system("git add app/views/home/_show.html.haml -f") ? true : fail + system("git commit -m 'adding custom landing page for heroku'") ? true : fail + + puts "-----> done" + end + +end -- GitLab