Module: RakeCommander::Patcher::Application::TopLevelMethod::ClassMethods

Includes:
Debug
Defined in:
lib/rake-commander/patcher/application/top_level_method.rb

Instance Method Summary collapse

Methods included from Debug

#rake_comm_debug, #rake_comm_debug_main_object_id, #rake_comm_debug_random_object_id

Instance Method Details

#relaunch_rake_applicationObject

Reloading Rakefile has drawbacks around require only being launched once per dependency. Apparently some tasks of some gems are installed at require run-time. This requires to keep known tasks when we switch the application.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rake-commander/patcher/application/top_level_method.rb', line 53

def relaunch_rake_application
  prev_rake_app = Rake.application
  rake_comm_debug "R A K E   R E L A U N C H   ( p a t c h    i n a c t i v e )", "\n", num: 2, pid: true
  rake_comm_debug "  ---> Known tasks: #{prev_rake_app.tasks.map(&:name).join(", ")}"
  Rake.application = Rake::Application.new
  rake_comm_debug "N e w   R a k e  A p p", "\n", num: 4, pid: true
  RakeCommander.self_load_reset
  Rake.application.run #RakeCommander.argv_rake_native_arguments(ARGV)
  rake_comm_debug "T e r m i n a t i n g   R U N", "\n", num: 3, pid: true
  exit(0)
end