Sha256: dfedff37dadbbd814b956ff5fd510c8bb2cf3ff6bfc10ae5541e609b2baeb747

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

module Blueprints
  module Helper
    def build_plan(*names)
      Namespace.root.build(*names)
      Namespace.root.copy_ivars(self)
    end

    alias :build :build_plan

    def demolish(*args)
      options = args.extract_options!
      Blueprints.delete_tables(*args)

      if options[:undo] == :all
        Namespace.root.executed_plans.clear
      else
        undo = [options[:undo]].flatten.compact
        unless (not_found = undo - Namespace.root.executed_plans.to_a).blank?
          raise(ArgumentError, "Scenario(s) #{not_found} not found")
        end
        Namespace.root.executed_plans -= undo
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blueprints-0.3.1 lib/blueprints/helper.rb
blueprints-0.3.0 lib/blueprints/helper.rb