lib/blueprints/helper.rb in blueprints-0.7.3 vs lib/blueprints/helper.rb in blueprints-0.8.0
- old
+ new
@@ -31,27 +31,13 @@
end
alias :build :build_blueprint
alias :build! :build_blueprint!
- # Clears all tables in database. You can pass table names to clear only those tables. You can also pass <tt>:undo</tt> option
- # to remove scenarios from built scenarios cache.
+ # Demolishes built blueprints (by default simply calls destroy method on result of blueprint, but can be customized).
#
- # TODO: add sample usage
- def demolish(*args)
- STDERR.puts "DEPRECATION WARNING: demolish is deprecated and will be changed to support per blueprint demolishing in blueprints 0.8.0"
- options = args.extract_options!
- args = (ActiveRecord::Base.connection.tables - ['schema_migrations']) if args.blank?
- args.each {|table| ActiveRecord::Base.connection.execute("DELETE FROM #{table}") }
-
- if options[:undo] == :all
- Namespace.root.executed_blueprints.clear
- else
- undo = [options[:undo]].flatten.compact.collect(&:to_s)
- unless (not_found = undo - Namespace.root.executed_blueprints.to_a).blank?
- raise(BlueprintNotFoundError, not_found)
- end
- Namespace.root.executed_blueprints -= undo
- end
+ # demolish :apple, :pear
+ def demolish(*names)
+ names.each { |name| Namespace.root[name].demolish }
end
end
end