Sha256: 4f10e93144a17391c0b1a0bce75b085bf6f9444b639719bb2330b965e1fbf595

Contents?: true

Size: 958 Bytes

Versions: 58

Compression:

Stored size: 958 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 do
              instance_eval(&block)
              require 'sequel'
              Sequel.extension :migration
              db_migrations_dir = File.expand_path("../../../../db/migrations", __FILE__)
              puts "Running migrations in directory #{db_migrations_dir}"
              Sequel::Migrator.run(database_connection, db_migrations_dir)
            end
          end
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
pact_broker-2.0.5 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.4 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.3 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.2 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.1 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.6 lib/pact_broker/tasks/migration_task.rb
pact_broker-1.18.0 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/tasks/migration_task.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/tasks/migration_task.rb
pact_broker-1.17.2 lib/pact_broker/tasks/migration_task.rb
pact_broker-1.17.1 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.4 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.3 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.2 lib/pact_broker/tasks/migration_task.rb
pact_broker-2.0.0.beta.1 lib/pact_broker/tasks/migration_task.rb
pact_broker-1.17.0 lib/pact_broker/tasks/migration_task.rb
pact_broker-1.16.0 lib/pact_broker/tasks/migration_task.rb