Class: Hanami::CLI::Commands::App::Generate::Command Private
- Inherits:
-
Command
- Object
- Dry::CLI::Command
- Hanami::CLI::Command
- Command
- Hanami::CLI::Commands::App::Generate::Command
- Defined in:
- lib/hanami/cli/commands/app/generate/command.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #call(name:, slice: nil, **opts) ⇒ Object private
- #generator_class ⇒ Object private
-
#initialize(fs:, out:) ⇒ Command
constructor
private
A new instance of Command.
Methods inherited from Command
#app, #inflector, inherited, #measure, #run_command
Methods inherited from Hanami::CLI::Command
Constructor Details
#initialize(fs:, out:) ⇒ Command
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Command.
24 25 26 27 |
# File 'lib/hanami/cli/commands/app/generate/command.rb', line 24 def initialize(fs:, out:, **) super @generator = generator_class.new(fs:, inflector:, out:) end |
Instance Method Details
#call(name:, slice: nil, **opts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/hanami/cli/commands/app/generate/command.rb', line 38 def call(name:, slice: nil, **opts) slice ||= detect_slice_from_cwd if slice.nil? generator.call( key: name, namespace: app.namespace, base_path: "app", **opts, ) return end slice_root = slice.respond_to?(:root) ? slice.root : detect_slice_root(slice) raise MissingSliceError.new(slice) unless fs.exist?(slice_root) generator.call( key: name, namespace: slice, base_path: slice_root, **opts, ) end |
#generator_class ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 |
# File 'lib/hanami/cli/commands/app/generate/command.rb', line 31 def generator_class # Must be implemented by subclasses, with initialize method that takes: # fs:, out: end |