From 5652b5a7c851d4eba7633d3d0c70760a034c3b7e Mon Sep 17 00:00:00 2001 From: Imanpal Singh Date: Fri, 6 Jun 2025 15:41:41 +0530 Subject: [PATCH 1/2] Add new module console This module will load all the rakefiles and start the IRB. --- lib/rake/console.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/rake/console.rb diff --git a/lib/rake/console.rb b/lib/rake/console.rb new file mode 100644 index 000000000..3c4f2ace4 --- /dev/null +++ b/lib/rake/console.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +module Rake + module Console + def self.start + require "irb" + + puts "Rake console, version #{Rake::VERSION}" + Rake.application.load_rakefile + ARGV.clear + IRB.start + exit + end + end +end From ac9d47a032f6cef86cb63000cc93fef48ffbfbbe Mon Sep 17 00:00:00 2001 From: Imanpal Singh Date: Fri, 6 Jun 2025 15:42:22 +0530 Subject: [PATCH 2/2] add new flag --console, -c Usage: $ rake --console Rake console, version 13.3.0 irb(main):001> --- lib/rake/application.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 87ae47b32..b784cdef6 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -7,6 +7,7 @@ require_relative "thread_history_display" require_relative "trace_output" require_relative "win32" +require_relative "console" module Rake @@ -644,6 +645,9 @@ def standard_rake_options # :nodoc: options.ignore_deprecate = true } ], + ["--console", "-c", "Start an interactive Rake console (IRB)", lambda { |value| + Console.start + }], ]) end