lib/tasks/database.rake in spree-0.5.1 vs lib/tasks/database.rake in spree-0.6.0
- old
+ new
@@ -1,11 +1,11 @@
require 'activerecord'
+require 'highline/import'
namespace :db do
desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!"
task :remigrate => :environment do
- require 'highline/import'
if ENV['SKIP_NAG'] or ENV['OVERWRITE'].to_s.downcase == 'true' or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [yn] ")
# Drop all tables
ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
@@ -17,15 +17,20 @@
else
say "Task cancelled."
exit
end
end
+
+ namespace :admin do
+ desc "Create admin username and password"
+ task :create => :environment do
+ Spree::Setup.create_admin_user
+ end
+ end
desc "Bootstrap your database for Spree."
task :bootstrap => :environment do
- #return unless %w[development test].include? RAILS_ENV
-
- require 'highline/import'
+ raise "Cannot bootstrap in production mode (for saftey reasons.)" unless %w[demo development test].include? RAILS_ENV
if ENV['AUTO_ACCEPT'] or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [yn] ")
ENV['SKIP_NAG'] = 'yes'
# Remigrate