Sha256: c95b822401194907eca20438df65ab282c6368b68ffaa3dfa5769c4a6d1446d9

Contents?: true

Size: 968 Bytes

Versions: 21

Compression:

Stored size: 968 Bytes

Contents

# frozen_string_literal: true

namespace :ridgepole do
  desc 'Apply database schema'
  task apply: :environment do
    ridgepole('--apply', "-E #{Rails.env}", "--file #{schema_file}")
    Rake::Task['db:schema:dump'].invoke if Rails.env.development?
    Rake::Task['annotate_models'].invoke if Rails.env.development?
  end

  desc 'Export database schema'
  task export: :environment do
    ridgepole('--export', "-E #{Rails.env}", '--split', "--output #{schema_file}")
  end

  desc 'import seed data'
  task seed: :environment do
    path = Rails.root.join("db/seeds/#{Rails.env}.rb")
    path = path.sub(Rails.env, 'development') unless File.exist?(path)
    require path
  end

  private

  def schema_file
    Rails.root.join('db/Schemafile')
  end

  def config_file
    Rails.root.join('config/database.yml')
  end

  def ridgepole(*options)
    command = ['bundle exec ridgepole', "--config #{config_file}"]
    system [command + options].join(' ')
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ibrain-core-0.3.0 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.9 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.8 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.7 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.6 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.5 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.4 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.3 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.2 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.1 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.2.0 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.9 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.8 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.7 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.6 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.5 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.4 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.3 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.2 lib/tasks/ibrain/ridgepole.rake
ibrain-core-0.1.1 lib/tasks/ibrain/ridgepole.rake