Sha256: a5f3167f7879b5cda64f118ed7ed0677794e58bfbcccfc1ea7abc250101e4702

Contents?: true

Size: 919 Bytes

Versions: 83

Compression:

Stored size: 919 Bytes

Contents

require 'rake/tasklib'

=begin

require 'pact_broker/tasks'

PactBroker::DB::MigrationTask.new do | task |
  require 'my_app/db'
  task.database_connection = MyApp::DB
end

=end

module PactBroker
  module DB
    class MigrationTask < ::Rake::TaskLib

      attr_accessor :database_connection

      def initialize &block
        rake_task &block
      end

      def rake_task &block
        namespace :pact_broker do
          namespace :db do
            desc "Run sequel migrations for pact broker database"
            task :migrate, [:target] do | t, args |
              require 'pact_broker/db/migrate'
              instance_eval(&block)
              options = {}
              if args[:target]
                options[:target] = args[:target].to_i
              end
              PactBroker::DB::Migrate.call(database_connection, options)
            end
          end
        end
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
pact_broker-2.2.0 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.1.1 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.1.0 lib/pact_broker/tasks/migration_task.rb