lib/thor/spree/bootstrap_cleanup.thor in datashift-0.8.0 vs lib/thor/spree/bootstrap_cleanup.thor in datashift-0.9.0

- old
+ new

@@ -7,23 +7,22 @@ # bundle exec thor help datashift:spreeboot # bundle exec thor datashift:spreeboot:cleanup # # Note, not DataShift, case sensitive, create namespace for command line : datashift -require File.expand_path('config/environment.rb') - - module Datashift class Spreeboot < Thor include DataShift::Logging desc "cleanup", "Remove Spree Product/Variant data from DB" def cleanup() + require File.expand_path('config/environment.rb') + require 'spree_helper' require File.expand_path('config/environment.rb') ActiveRecord::Base.connection.execute("TRUNCATE spree_products_taxons") @@ -35,10 +34,14 @@ cleanup.each do |k| klass = DataShift::SpreeHelper::get_spree_class(k) if(klass) puts "Clearing model #{klass}" - klass.delete_all + begin + klass.delete_all + rescue => e + puts e + end else puts "WARNING - Could not find AR model for class name #{k}" end end \ No newline at end of file