Sha256: 3142c8281e5ea8274605917726bcb9c1db14995a6f8217e1f883512de18bf95a

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

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).to_a.reverse.push(name).join(':')
  alias_task(fq_name)
  Rake::Task.define_task(*args, &block)
end

override_task :c do
  Rake::Task['console'].invoke
end

override_task :console do
  Rake::Task['console'].invoke
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
envkeeper-0.1.2 lib/envkeeper/tasks.rake
envkeeper-0.1.1 lib/envkeeper/tasks.rake