karmi (owner)

Forks

Revisions

gist: 129590 Download_button fork
public
Public Clone URL: git://gist.github.com/129590.git
Embed All Files: show embed
bootstrap.rake #
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
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