Sha256: 16c56faa667cc98b5f5600d778cab82b6b8ab06bc78da0d7afc8b2bff721a86a

Contents?: true

Size: 468 Bytes

Versions: 8

Compression:

Stored size: 468 Bytes

Contents

Rake::TaskManager.class_eval do
  def alias_task(fq_name)
    new_name = "#{fq_name}:original"
    @tasks[new_name] = @tasks.delete(fq_name)
  end
end

def alias_task(fq_name)
  Rake.application.alias_task(fq_name)
end

def override_task(*args, &block)
  name, params, deps = Rake.application.resolve_args(args.dup)
  fq_name = Rake.application.instance_variable_get(:@scope).dup.push(name).join(':')
  alias_task(fq_name)
  Rake::Task.define_task(*args, &block)
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dbmigrator-0.7.7 lib/dbmigrator/task_manager.rb
dbmigrator-0.7.6 lib/dbmigrator/task_manager.rb
dbmigrator-0.7.5 lib/dbmigrator/task_manager.rb
dbmigrator-0.7.4 lib/dbmigrator/task_manager.rb
dbmigrator-0.7.1 lib/dbmigrator/task_manager.rb
dbmigrator-0.7.0 lib/dbmigrator/task_manager.rb
dbmigrator-0.6.0 lib/dbmigrator/task_manager.rb
dbmigrator-0.5.3 lib/dbmigrator/task_manager.rb