Sha256: a7864c3432d8dc905d4e2ff8bc14374f31e887fe0fcb3452d2222727cb59c7a1

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

module Blueprints
  module Helper
    def build_plan(*names)
      result = Namespace.root.build(*names).last
      Namespace.root.copy_ivars(self)
      result
    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.collect {|bp| bp.to_s }
        unless (not_found = undo - Namespace.root.executed_plans.to_a).blank?
          raise(PlanNotFoundError, 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.4 lib/blueprints/helper.rb
blueprints-0.3.3 lib/blueprints/helper.rb