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