Sha256: afab35d4cd8ca9939b45320dd2787ef451400206bb2fcb4a6a16f2e9f5710dff

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

namespace :db do
  task :migrate do
    $rake_ahnnotate_config ||= Ahnnotate::Config.load(root: Rails.root)

    if $rake_ahnnotate_config["rake_db_autorun"]
      Rake::Task["ahnnotate:add"].reenable
      Rake::Task["ahnnotate:add"].invoke
    end
  end

  task :rollback do
    $rake_ahnnotate_config ||= Ahnnotate::Config.load(root: Rails.root)

    if $rake_ahnnotate_config["rake_db_autorun"]
      Rake::Task["ahnnotate:add"].reenable
      Rake::Task["ahnnotate:add"].invoke
    end
  end
end

namespace :ahnnotate do
  desc "Add annotations"
  task :add do
    require "ahnnotate/cli"

    argv = ENV.fetch("AHNNOTATE_ADD", "--fix")

    puts "Adding annotations..."

    cli = Ahnnotate::Cli.new(name: "ahnnotate")
    cli.run(argv, $rake_ahnnotate_config)

    puts "Done!"
  end

  desc "Remove annotations"
  task :remove do
    require "ahnnotate/cli"

    argv = ENV.fetch("AHNNOTATE_REMOVE", "--fix --remove")

    puts "Removing annotations..."

    cli = Ahnnotate::Cli.new(name: "ahnnotate")
    cli.run(argv, $rake_ahnnotate_config)

    puts "Done!"
  end
end

desc "Run rake task `ahnnotate:add`"
task ahnnotate: "ahnnotate:add"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ahnnotate-0.5.1 lib/ahnnotate/rails.rake
ahnnotate-0.5.0 lib/ahnnotate/rails.rake
ahnnotate-0.4.0 lib/ahnnotate/rails.rake