Top Level Namespace
Defined Under Namespace
Modules: Rwm
Instance Method Summary collapse
-
#cacheable_task(*args, **opts, &block) ⇒ Object
Top-level DSL method available in Rakefiles.
Instance Method Details
#cacheable_task(*args, **opts, &block) ⇒ Object
Top-level DSL method available in Rakefiles
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rwm/rake.rb', line 48 def cacheable_task(*args, **opts, &block) output = opts.delete(:output) # Remaining keyword opts are Rake dependency syntax (e.g. seed: :environment) args << opts unless opts.empty? # Resolve the task name using Rake's own parser (dup because resolve_args mutates) task_name, = Rake.application.resolve_args(args.dup) Rwm::RakeCache.register(task_name, output: output) # Clear existing actions so we replace rather than stack (e.g. rspec-rails :spec) Rake::Task[task_name].clear_actions if Rake::Task.task_defined?(task_name) Rake::Task.define_task(*args, &block) end |