Skip to content

Instantly share code, notes, and snippets.

@blake-simpson
Created August 6, 2012 10:55
Show Gist options
  • Save blake-simpson/3273435 to your computer and use it in GitHub Desktop.
Save blake-simpson/3273435 to your computer and use it in GitHub Desktop.
Rake Setup task
task :devenv_check do
raise "You can only run this task in development mode!" unless Rails.env == 'development'
end
task :setup do
puts "Preparing to build databases. Running Rake tasks...."
#Remove all existing photo uploads and caches. TextMate users will appreciate this!
system "rm -rf public/uploads/*"
system "rm -rf tmp/cache/*"
system "rake devenv_check"
puts "Running 'rake db:drop'"
system "rake db:drop"
puts "Running 'rake db:create'"
system "rake db:create"
puts "Running 'rake db:migrate'"
system "rake db:migrate"
puts "Running 'rake db:seed'"
system "rake db:seed"
puts "Running 'rake db:test:prepare'"
system "rake db:test:prepare"
puts "Your databases and test environment are ready. Run 'rspec && cucumber' to test the application is working correctly."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment