rake-commander 0.2.12 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00c13e58c8b9c78ac538ca0100d714a7c3f72ca98a655ae564ebbca13cacf2f6
4
- data.tar.gz: bfbf686120c4245ba541605db6fbb46e14455b77553948827946fb1417cb376b
3
+ metadata.gz: f671966099a385b76b7e0535fb3a0e584072a5996265c5c56adb26f047bd6fa2
4
+ data.tar.gz: 32617c52c0773ca1aeff4b8665c197cc765c9e879866eb684310bf62523709f4
5
5
  SHA512:
6
- metadata.gz: 1d7941181f5ea5b4bd1210bcb3e5a1307bbedbd0a503636144af350a320a6a7ed4a5d8948d2212c81b401513bb383c37ad4645825e544cb952a73bbdf3d62110
7
- data.tar.gz: 41a29e32b0536d073c4481df467ff65351bd84c5782db961398ea6ac66c73d6652d623df7d1c363e321130182f32db78368528996b7331478c16505b1b059c76
6
+ metadata.gz: 2d114f3fd737cc41f659b00d5a539c110057b9371335688e94d4777853a0082c86c2473beabc5a4ed1fdbe5595879028f6bd11683ba1fccf97b86551e7d70471
7
+ data.tar.gz: c2afd435a3f70f2fdf7af647eb7facb2dbe89593ff668af6453d766f8f4346d87ccd25a555572873f1c74d6fd748a218b290f2150f22addfc8b9ee8501cfffe4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
4
  ## TO DO
5
+ - Think if [`binstubs`](https://github.com/rbenv/rbenv/wiki/Understanding-binstubs) would offer a neater patch right on `Rake::Application#init`
5
6
  - `option_reopen` -> upsert should be optional (add `upsert: false` as default an raise missing option if not found)
6
7
  - The error on missing short pops up where it's not clear the short was missed in the option_reopen call.
7
8
  - Option results
@@ -28,17 +29,40 @@ All notable changes to this project will be documented in this file.
28
29
  * Example: `on_options(:t, :s, present: true) {|options| do-stuff}` <- block to be called only when the option `:t` and `:s` are both present in the parsed `options` result.
29
30
  - Once this has been done, think about it being a hash-alike object with methods for the option names (i.e. `options.debug?`)
30
31
 
31
- ## DISCARDED IMPROVENTS
32
- - Option to globally enable/disable the 2nd patch?
33
- * That would make this gem completely useless.
34
32
 
35
- ## [0.2.13] - 2023-05-xx
33
+ ## [0.3.7] - 2023-05-xx
36
34
 
37
35
  ### Added
38
36
  ### Fixed
39
37
  ### Changed
40
38
 
41
- ## [0.2.12] - 2023-05-xx
39
+ ## [0.3.6] - 2023-05-15
40
+
41
+ ### Fixed
42
+ - `RakeCommander::Options` inheritance of options in `options_hash` was NOT doing a `dup`
43
+
44
+ ### Changed
45
+ - `RakeCommander::Options#options_hash` made public method
46
+
47
+ ## [0.3.5] - 2023-05-08
48
+
49
+ ### Fixed
50
+ - `RakeCommander::Options#option_reopen` using name to reopen should not redefine if passed as Symbol.
51
+
52
+ ## [0.3.4] - 2023-05-08
53
+
54
+ ### Fixed
55
+ - `RakeCommand::Option#name` boolean form (`[no-]`) should not be part of the name.
56
+
57
+ ### Changed
58
+ - Slight refactor to the patch
59
+
60
+ ## [0.3.3] - 2023-05-01
61
+
62
+ ### Changed
63
+ - Replaced the patching method, so the `Rake` application doesn't need re-launch.
64
+
65
+ ## [0.2.12] - 2023-05-01
42
66
 
43
67
  ### Fixed
44
68
  - `RakeCommander::Option#type_coercion` wasn't correctly captured.
data/README.md CHANGED
@@ -69,6 +69,27 @@ rspec logging and results
69
69
 
70
70
  ### Syntax
71
71
 
72
+ ```ruby
73
+ RakeCommander::Custom::Base < RakeCommander
74
+ include Rake::DSL
75
+ end
76
+ ```
77
+ * `include Rake::DSL` for backwards compatibility
78
+
79
+ ```ruby
80
+ RakeCommander::Custom::MyTask < RakeCommander::Custom::Base
81
+ desc "it does some stuff"
82
+ task :do_stuff
83
+
84
+ option :s, '--do-stuff [SOMETHING]', default: 'nothing'
85
+
86
+ def task(*_args)
87
+ puts "Doing #{options[:s]}" if options[:s]
88
+ end
89
+ end
90
+ ```
91
+
92
+
72
93
  ### Declaring and using Task Options
73
94
 
74
95
  It supports most of options syntax of the native `OptionParser` but for a couple of exceptions perhaps:
@@ -100,16 +121,9 @@ The double dash ` -- ` delimiter allows to modify the `ARGV` parsing behaviour o
100
121
 
101
122
  Work has been done with the aim of providing a full patch on `rake`, provided that the main invocation command remains as `rake`.
102
123
 
103
- To preserve `rake` as invocation command, though, the patch needs to relaunch the rake application when it has already started. The reason is that `rake` has already pre-parsed `ARGV` when `rake-commander` is loaded (i.e. from a `Rakefile`) and has identified as tasks things that are part of the task options.
104
-
105
- * For compatibility with tasks declared using `RakeCommander`, the rake application is always relaunched. Anything that does not belong to task options should not be feed to rake tasks declared with rake commander classes.
106
-
107
124
  ### Patching `Rake`
108
125
 
109
- The two patches:
110
-
111
- 1. Rake commander does come with a neat patch to the [`Rake::Application#run` method](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L79) to clean up the `ARGV` before the rake application starts. But it kicks in too late...
112
- 2. For this reason a more arguable patch has been applied to [`Rake::Application#top_level` method](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L131), where the rake application is relaunched.
126
+ There is only one patch onto [`Rake::Application#top_level` method](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L131), [`collect_command_line_tasks`](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L782) is recalled with the arguments cut (so it does not interpret task option arguments as tasks).
113
127
 
114
128
  For further details please see [`RakeCommander::Patcher`](https://github.com/rellampec/rake-commander/blob/main/lib/rake-commander/patcher).
115
129
 
@@ -32,9 +32,9 @@ class RakeCommander
32
32
 
33
33
  # Creates a new option, result of merging this `opt` with this option,
34
34
  # @return [RakeCommander::Option] where opt has been merged
35
- def merge(opt)
35
+ def merge(opt, **kargs)
36
36
  raise "Expecting RakeCommander::Option. Given: #{opt.class}" unless opt.is_a?(RakeCommander::Option)
37
- dup(**opt.dup_key_arguments, &opt.original_block)
37
+ dup(**opt.dup_key_arguments.merge(kargs), &opt.original_block)
38
38
  end
39
39
 
40
40
  # @return [Boolean] whether this option is required.
@@ -127,9 +127,8 @@ class RakeCommander
127
127
  # @see #name_sym
128
128
  # @return [Symbol, NilClass]
129
129
  def name_word_sym(value)
130
- return nil unless value = name_sym(value)
131
130
  value = value.to_s.gsub(BOOLEAN_TOKEN, '')
132
-
131
+ return nil unless value = name_sym(value)
133
132
  return nil unless value = name_words(value).first
134
133
  value.downcase.to_sym
135
134
  end
@@ -16,7 +16,7 @@ class RakeCommander
16
16
  base.attr_inheritable :banner
17
17
  base.attr_inheritable(:options_hash) do |value, subclass|
18
18
  next nil unless value
19
- value.values.uniq.each {|opt| subclass.send :add_to_options, opt}
19
+ value.values.uniq.each {|opt| subclass.send :add_to_options, opt.dup}
20
20
  subclass.send(:options_hash)
21
21
  end
22
22
  base.class_resolver :option_class, RakeCommander::Option
@@ -44,6 +44,8 @@ class RakeCommander
44
44
  end
45
45
 
46
46
  # It re-opens an option for edition. If it does not exist, it **upserts** it.
47
+ # @note To allow reopen using the name without modifying the argument, use a Symbol
48
+ # Example: `option_reopen :opt_with_arg` will keep the argument of 'opt_with_arg'
47
49
  # @note
48
50
  # 1. If `override` is `false, it will fail to change the `name` or the `short`
49
51
  # when they are already taken by some other option.
@@ -54,7 +56,10 @@ class RakeCommander
54
56
  aux = option_class.new(*args, **kargs, sample: true, &block)
55
57
  opt = options_hash.values_at(aux.name, aux.short).compact.first
56
58
  return option(*args, **kargs, &block) unless opt
57
- replace_in_options(opt, opt.merge(aux), override: override)
59
+ mod = {}.tap do |mkargs|
60
+ mkargs.merge!(name: opt.name_full) if aux.name_full.is_a?(Symbol)
61
+ end
62
+ replace_in_options(opt, opt.merge(aux, **mod), override: override)
58
63
  end
59
64
 
60
65
  # Removes options with short or name `keys` from options
@@ -88,11 +93,19 @@ class RakeCommander
88
93
  # @param method [Symbol] the parsing method (default is `:parse`; others: `:order`)
89
94
  # @return [Array<String>] the **leftovers** of the `OptionParser#parse` call.
90
95
  def parse_options(argv = ARGV, method: :parse, &middleware)
91
- RakeCommander.rake_comm_debug "(#{name}) P A R S E O P T I O N S !", "\n", num: 5, pid: true
92
- RakeCommander.rake_comm_debug " ---> ARGV: [#{argv.map {|a| a.nil?? "nil" : "'#{a}'"}.join(', ')}]"
93
96
  options_parser(&middleware).send(method, argv)
94
97
  end
95
98
 
99
+ # The options indexed by the short and the name (so doubled up in the hash).
100
+ # @param with_implicit [Boolean] whether free implicit shorts of declared options should be included
101
+ # among the keys (pointing to the specific option that has it implicit).
102
+ # @return [Hash] with Symbol name and shorts as keys, and `RakeCommander::Option` as values.
103
+ def options_hash(with_implicit: false)
104
+ @options_hash ||= {}
105
+ return @options_hash unless with_implicit
106
+ @options_hash.merge(implicit_shorts)
107
+ end
108
+
96
109
  # List of configured options
97
110
  # @return [Array<RakeCommander::Option>]
98
111
  def options
@@ -145,16 +158,6 @@ class RakeCommander
145
158
  OptionParser.new(&block)
146
159
  end
147
160
 
148
- # The options indexed by the short and the name (so doubled up in the hash).
149
- # @param with_implicit [Boolean] whether free implicit shorts of declared options should be included
150
- # among the keys (pointing to the specific option that has it implicit).
151
- # @return [Hash] with Symbol name and shorts as keys, and `RakeCommander::Option` as values.
152
- def options_hash(with_implicit: false)
153
- @options_hash ||= {}
154
- return @options_hash unless with_implicit
155
- @options_hash.merge(implicit_shorts)
156
- end
157
-
158
161
  # This covers the gap where `OptionParser` auto-generates shorts out of option names.
159
162
  # @note `OptionParser` implicitly generates a short for the option name. When defining
160
163
  # an option that uses this short, the short gets overriden/reused by the explicit option.
@@ -6,12 +6,7 @@ Let's say that when we invoke `rake` from the command line, `rake-commander` is
6
6
 
7
7
  ### Challenges encountered with the `rake` executable
8
8
 
9
- Let's say you require/load `rake-commander` in a `Rakefile`, and invoke the [`rake` executable](https://github.com/ruby/rake/blob/master/exe/rake). By the time rake commander is loaded, `Rake` has already captured the `ARGV`, parsed its own options, and pre-parsed possible task(s) invokations.
10
-
11
- The **two main problems** to deal with are:
12
-
13
- 1. Rake has it's own `OptionsParser`. If any of your rake `task` options matches any of those, you will be unintentionally invoking `rake` functionality.
14
- 2. Let's say you require/load `rake-commander` in a `Rakefile`. By the time rake commander is loaded, `rake` has already collected as `top_level_tasks` the arguments of your task options; so those that do not start with dash `-` ([see private method `collect_command_line_tasks` in `Rake::Application`](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L782)).
9
+ Let's say you require/load `rake-commander` in a `Rakefile`, and invoke the [`rake` executable](https://github.com/ruby/rake/blob/master/exe/rake). By the time rake commander is loaded, `Rake` has already captured the `ARGV`, parsed its own options, and pre-parsed possible task(s) invokations; it has already collected as `top_level_tasks` the arguments of your task options; so those that do not start with dash `-` ([see private method `collect_command_line_tasks` in `Rake::Application`](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L782)).
15
10
 
16
11
  This is also true when you invoke `rake` via _shell_ from within another task.
17
12
 
@@ -28,40 +23,8 @@ rake aborted!
28
23
  Don't know how to build task 'Just saying...' (See the list of available tasks with `rake --tasks`)
29
24
  ```
30
25
 
31
- ### The alternative of a `raked` executable
32
-
33
- **`raked` executable is not necessary and is not provided for prod environments. The current patch allows to start directly from `rake`**.
34
-
35
- * This has been kept to the only purpose of documentation.
36
-
37
- The `raked` executable would be a modified version of the `rake` executable, where `rake_commander` is loaded right after requiring `rake` and before `Rake.application.run` is invoked.
38
-
39
- ```ruby
40
- #!/usr/bin/env ruby
41
-
42
- require "rake"
43
- require "rake-commander"
44
- Rake.application.run
45
- ```
46
-
47
- This would allow the patch to be active right at the beginning, preventing this way the patch to kick in after the `rake` application has been firstly launched (it saves to rake one loop of parsing arguments and loading rake files).
48
-
49
- ```
50
- $ raked examples:chainer -- --chain --say "Just saying..." --with raked
51
- Calling --> 'bin\raked examples:chained -- --say "Just saying..."'
52
- Chained task has been called!!
53
- Just saying...
54
- ```
55
-
56
- Using `raked` as separate namespace vs `rake` is completely optional. Most will prefer to keep on just with the main `rake` executable and `rake-commander` as enhancement to it. This is the rational behind the second patch (explained in detail in the next section).
57
-
58
-
59
26
  ## Reload `Rake` application
60
27
 
61
- The target is to be able to use `rake` indistinctly (rather than having to rewrite rake commands as `raked`). Unfortunately the **only way around** to the _application-has-started_ is to just **relaunch/reload the application** when the patch kicks in (wouldn't know how to and shouldn't try to reuse the current running application: i.e. task options parsed as rake option modifiers that have already done some stuff).
62
-
63
- Fortunately, the target of `rake-commander` is just to **enhance** existing syntax, which gives a very specific target when it comes to **patching**. The key factor to reach a clean patch is to design the syntax in a fixed way where there is no much flexibility but clearly stated delimiters (i.e. no fancy guessing where dependencies are introduced on defined task options).
64
-
65
28
  Relaunching the application to a new instance requires very little:
66
29
 
67
30
  ```ruby
@@ -69,11 +32,14 @@ Rake.application = Rake::Application.new
69
32
  Rake.application.run
70
33
  exit(0) # abort previous application run
71
34
  ```
35
+ But this approach has been discarded (since `v 0.3.1`), as it loses task definitions loaded via `require`.
72
36
 
73
- ## Missing tasks on reload
37
+ ### Missing tasks on reload
74
38
 
75
39
  Relaunching the `rake` application entails issues with `require` in the chain of `Rakefile` files that have already been loaded. Apparently some tasks of some gems are installed during the `require` runtime, rather than explicitly declaring them in the rake file.
76
40
 
77
41
  This is the case for `bundler/gem_tasks` (i.e. `require "bundler/gem_tasks"`), where all these `tasks` will be missing: build, build:checksum, clean, clobber, install, install:local, release, release:guard_clean, release:rubygem_push, release:source_control_push.
78
42
 
79
- It can potentially be looked at, if ever this shows up to new review.
43
+ ## Re-call `collect_command_line_tasks` from `top_level` method
44
+
45
+ This showed up to solve all the known problems mentioned above. It allow the application to just keep running with whatever it got.
@@ -0,0 +1,49 @@
1
+ class RakeCommander
2
+ module Patcher
3
+ module Application
4
+ module TopLevelResume
5
+ include RakeCommander::Patcher::Base
6
+
7
+ class << self
8
+ def target
9
+ Rake::Application
10
+ end
11
+
12
+ def patch_prepend(_invoked_by)
13
+ return unless target_defined?
14
+ Rake::Application.prepend Patch
15
+ end
16
+
17
+ def target_defined?
18
+ return true if defined?(target)
19
+ puts "Warning (#{self}): undefined target #{target}"
20
+ false
21
+ end
22
+ end
23
+
24
+ module Patch
25
+ # To preserve `rake` as main executable, as the `RunMethod::Patch` is applied only
26
+ # when `Rake::Application` requires the `Rakefile` that loads `rake-commander`,
27
+ # we technically only need to fix the `top_level_tasks` that have been detected.
28
+ def top_level
29
+ RakeCommander.rectify_rake_application
30
+ super
31
+ end
32
+ end
33
+
34
+ module ClassMethods
35
+ include RakeCommander::Patcher::Debug
36
+
37
+ # Reloading `Rakefile` has drawbacks around `require` only being launched once per
38
+ # dependency. Apparently some tasks of some gems are installed at `require` run-time.
39
+ # This requires to keep known tasks when we switch the application.
40
+ def rectify_rake_application
41
+ RakeCommander.self_load_reset
42
+ argv = RakeCommander.argv_rake_native_arguments(ARGV)
43
+ Rake.application.send(:collect_command_line_tasks, argv)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -2,13 +2,11 @@ class RakeCommander
2
2
  module Patcher
3
3
  module Application
4
4
  include RakeCommander::Patcher::Base
5
- require_relative 'application/run_method'
6
- require_relative 'application/top_level_method'
5
+ require_relative 'application/top_level_resume'
7
6
 
8
7
  class << self
9
8
  def patch_include(base)
10
- base.send :include, RunMethod
11
- base.send :include, TopLevelMethod
9
+ base.send :include, TopLevelResume
12
10
  end
13
11
  end
14
12
  end
@@ -1,3 +1,3 @@
1
1
  class RakeCommander
2
- VERSION = '0.2.12'.freeze
2
+ VERSION = '0.3.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura Samper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-01 00:00:00.000000000 Z
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -201,8 +201,7 @@ files:
201
201
  - lib/rake-commander/patcher.rb
202
202
  - lib/rake-commander/patcher/README.md
203
203
  - lib/rake-commander/patcher/application.rb
204
- - lib/rake-commander/patcher/application/run_method.rb
205
- - lib/rake-commander/patcher/application/top_level_method.rb
204
+ - lib/rake-commander/patcher/application/top_level_resume.rb
206
205
  - lib/rake-commander/patcher/base.rb
207
206
  - lib/rake-commander/patcher/debug.rb
208
207
  - lib/rake-commander/patcher/helpers.rb
@@ -229,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
228
  - !ruby/object:Gem::Version
230
229
  version: '0'
231
230
  requirements: []
232
- rubygems_version: 3.1.4
231
+ rubygems_version: 3.4.12
233
232
  signing_key:
234
233
  specification_version: 4
235
234
  summary: Classing rake tasks with options. Creating re-usable tasks, options and samples
@@ -1,46 +0,0 @@
1
- class RakeCommander
2
- module Patcher
3
- module Application
4
- module RunMethod
5
- include RakeCommander::Patcher::Base
6
-
7
- class << self
8
- def target
9
- Rake::Application
10
- end
11
-
12
- def patch_prepend(_invoked_by)
13
- return unless target_defined?
14
- Rake::Application.prepend Patch
15
- end
16
-
17
- def target_defined?
18
- return true if defined?(target)
19
- puts "Warning (#{self}): undefined target #{target}"
20
- false
21
- end
22
- end
23
-
24
- module Patch
25
- include RakeCommander::Patcher::Debug
26
-
27
- # To extend the command line syntax we need to patch `Rake`, provided that
28
- # this gem's extended options are not in `argv` when `Rake` processes it.
29
- # @note we define an instance variable so we can know if the patch was applied when it started.
30
- # @note This patch only works fine if `Rake::Application#run` is **invoked after****
31
- # **`RakeCommander` has been required**.
32
- # * So by itself alone it allows to use `raked` executable that this gem provides.
33
- def run(argv = ARGV)
34
- @rake_commander_run_argv_patch = true unless instance_variable_defined?(:@rake_commander_run_argv_patch)
35
- RakeCommander.self_load
36
- rake_comm_debug "R U N !", "\n", num: 1, pid: true
37
- rake_comm_debug " ---> Command: #{$PROGRAM_NAME}"
38
- rake_comm_debug " ---> ARGV: [#{argv.map {|a| "'#{a}'"}.join(', ')}]"
39
- argv = RakeCommander.argv_rake_native_arguments(argv)
40
- super(argv)
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,74 +0,0 @@
1
- class RakeCommander
2
- module Patcher
3
- module Application
4
- module TopLevelMethod
5
- include RakeCommander::Patcher::Base
6
-
7
- class << self
8
- def target
9
- Rake::Application
10
- end
11
-
12
- def patch_prepend(_invoked_by)
13
- return unless target_defined?
14
- Rake::Application.prepend Patch
15
- end
16
-
17
- def target_defined?
18
- return true if defined?(target)
19
- puts "Warning (#{self}): undefined target #{target}"
20
- false
21
- end
22
- end
23
-
24
- module Patch
25
- include RakeCommander::Patcher::Debug
26
-
27
- # To preserve `rake` as main executable, as the `RunMethod::Patch` is applied only
28
- # when `Rake::Application` requires the `Rakefile` that loads `rake-commander`,
29
- # we need to:
30
- # 1. Intercept the execution on the next stage of the `Rake::Application#run` command,
31
- # [the `top_level` call](https://github.com/ruby/rake/blob/48e798484babf725b0562cc417986da513e5d0ae/lib/rake/application.rb#L82),
32
- # and **re-launch** the rake application (so it only receives the `ARGV` cut that the main patch provides)
33
- # 2. Ensure that **re-launch** is done only once.
34
- # 3. Ensure that it does `exit(0)` to the original running application.
35
- def top_level
36
- unless @rake_commander_run_argv_patch
37
- @rake_commander_run_argv_patch = true
38
- RakeCommander.relaunch_rake_application
39
- # Should not reach this point
40
- end
41
- rake_comm_debug "T O P L E V E L ( p a t c h a c t i v e )", "\n", num: 2, pid: true
42
- rake_comm_debug " ---> Known tasks: #{tasks.map(&:name).join(", ")}"
43
- super
44
- end
45
- end
46
-
47
- module ClassMethods
48
- include RakeCommander::Patcher::Debug
49
-
50
- # Reloading `Rakefile` has drawbacks around `require` only being launched once per
51
- # dependency. Apparently some tasks of some gems are installed at `require` run-time.
52
- # This requires to keep known tasks when we switch the application.
53
- def relaunch_rake_application
54
- prev_rake_app = Rake.application
55
- 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
56
- rake_comm_debug " ---> Known tasks: #{prev_rake_app.tasks.map(&:name).join(", ")}"
57
- Rake.application = Rake::Application.new
58
- rake_comm_debug "N e w R a k e A p p", "\n", num: 4, pid: true
59
- RakeCommander.self_load_reset
60
- Rake.application.run #RakeCommander.argv_rake_native_arguments(ARGV)
61
- rake_comm_debug "T e r m i n a t i n g R U N", "\n", num: 3, pid: true
62
- exit(0)
63
- end
64
-
65
- private
66
-
67
- def rake_reparse_argv(argv = ARGV)
68
- RakeCommander.argv_rake_native_arguments(argv)
69
- end
70
- end
71
- end
72
- end
73
- end
74
- end