I am thinking about making the app look different when rake launches it.
Is it enough to check caller if it is called from the rake, or do you need and what task?
Hope this is normal when you can modify the rakefile file. I have a version that introduces Rake.application.current_task .
# Rakefile require 'rake' module Rake class Application attr_accessor :current_task end class Task alias :old_execute :execute def execute(args=nil) Rake.application.current_task = @name old_execute(args) end end
Two comments about this:
- you can add changes to rake to the file and require it in your rake file.
- starting and setting tasks are test tasks for checking if there is more than one task.
- I did only small tests for side effects. I could imagine that in a real production situation there are problems.
knut Sep 20 2018-11-21T00: 00Z
source share