Skip to content

Instantly share code, notes, and snippets.

@karmi
Created June 14, 2009 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save karmi/129590 to your computer and use it in GitHub Desktop.
Save karmi/129590 to your computer and use it in GitHub Desktop.
namespace :app do
desc "Install the application for local development"
task :install => :environment do
Rake::Task['app:bootstrap:exit_or_continue_in_production?'].invoke
Rake::Task['app:bootstrap'].invoke
Rake::Task['app:seed'].invoke
puts "\n*** Installed the application"
end
desc "Bootstrap the application -- create admin/admin user, migrate database, etc"
task :bootstrap => :environment do
# rake db:drop, db:create, db:migrate, insert admin user, etc
end
desc "Seed the application with data for development"
task :seed => :environment do
# Load data from fixtures/etc
end
namespace :bootstrap do
task :exit_or_continue_in_production? do
if Rails.env.production?
puts "!!!WARNING!!! This task will DESTROY your production database and RESET all application settings"
puts "Continue? y/n"
continue = STDIN.gets.chomp
unless continue == 'y'
puts "Exiting..."
exit!
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment