Class: Rails::Command::HyperdriveCommand
- Inherits:
-
Base
- Object
- Base
- Rails::Command::HyperdriveCommand
- Defined in:
- lib/rails/commands/hyperdrive/hyperdrive_command.rb
Overview
The generators are the sole authority on option parsing, defaults, and
validation; this class only forwards argv and renders --help.
Class Method Summary collapse
-
.mirror_generator_options(klass) ⇒ Object
Mirrors a generator's own flags so the help surface cannot drift from what the generator actually accepts.
Instance Method Summary collapse
- #discover ⇒ Object
- #init ⇒ Object
-
#initialize(args = [], local_options = {}, config = {}) ⇒ HyperdriveCommand
constructor
Thor treats a leading
--as an options terminator, so with-- --mergethe flag lands in positional args andoptions[:merge]is false. - #sync ⇒ Object
Constructor Details
#initialize(args = [], local_options = {}, config = {}) ⇒ HyperdriveCommand
Thor treats a leading -- as an options terminator, so with -- --merge
the flag lands in positional args and options[:merge] is false. Both
spellings must reach the generator identically.
27 28 29 30 31 |
# File 'lib/rails/commands/hyperdrive/hyperdrive_command.rb', line 27 def initialize(args = [], = {}, config = {}) super @argv = args + (.is_a?(Array) ? : []) @argv = @argv.drop(1) if @argv.first == "--" end |
Class Method Details
.mirror_generator_options(klass) ⇒ Object
Mirrors a generator's own flags so the help surface cannot drift from what the generator actually accepts. Thor's runtime options are excluded: they are inherited plumbing, not part of this command.
17 18 19 20 21 22 |
# File 'lib/rails/commands/hyperdrive/hyperdrive_command.rb', line 17 def self.(klass) klass..each do |name, option| next if ::Rails::Generators::Base..key?(name) [name] = option end end |
Instance Method Details
#discover ⇒ Object
47 48 49 |
# File 'lib/rails/commands/hyperdrive/hyperdrive_command.rb', line 47 def discover(*) start_generator("discover", "DiscoverGenerator") end |
#init ⇒ Object
35 36 37 |
# File 'lib/rails/commands/hyperdrive/hyperdrive_command.rb', line 35 def init(*) start_generator("install", "InstallGenerator") end |
#sync ⇒ Object
41 42 43 |
# File 'lib/rails/commands/hyperdrive/hyperdrive_command.rb', line 41 def sync(*) start_generator("sync", "SyncGenerator") end |