Sha256: c1d1d2f3f73a84914d5dddf4e15c28280a47709435db5e2fc64ade699915251f

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

class Recipes::DataMigrate < Rails::AppBuilder
  def create
    gather_gem('data_migrate')
    annotate_task = 'lib/tasks/auto_annotate_models.rake'
    insert_into_file annotate_task, annotate_config, after: "Annotate.load_tasks\n"
  end

  def install
    create
  end

  def installed?
    gem_exists?(/data_migrate/)
  end

  private

  def annotate_config
    <<-RUBY

  data_migrate_tasks = %w(
    db:migrate:with_data
    db:migrate:up:with_data
    db:migrate:down:with_data
    db:migrate:redo:with_data
    db:rollback:with_data
  )

  data_migrate_tasks.each do |task|
    Rake::Task[task].enhance do
      Rake::Task[Rake.application.top_level_tasks.last].enhance do
        annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options')
                                    'app:set_annotation_options'
                                  else
                                    'set_annotation_options'
                                  end
        Rake::Task[annotation_options_task].invoke
        Annotate::Migration.update_annotations
      end
    end
  end
    RUBY
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
potassium-7.2.0 lib/potassium/recipes/data_migrate.rb
potassium-7.1.0 lib/potassium/recipes/data_migrate.rb
potassium-7.0.0 lib/potassium/recipes/data_migrate.rb
potassium-6.7.0 lib/potassium/recipes/data_migrate.rb
potassium-6.6.0 lib/potassium/recipes/data_migrate.rb
potassium-6.5.0 lib/potassium/recipes/data_migrate.rb
potassium-6.4.0 lib/potassium/recipes/data_migrate.rb
potassium-6.3.0 lib/potassium/recipes/data_migrate.rb
potassium-6.2.0 lib/potassium/recipes/data_migrate.rb
potassium-6.1.0 lib/potassium/recipes/data_migrate.rb
potassium-6.0.0 lib/potassium/recipes/data_migrate.rb
potassium-5.2.3 lib/potassium/recipes/data_migrate.rb