Class: Hanami::CliSubCommands::Generate Private
- Inherits:
-
Thor
- Object
- Thor
- Hanami::CliSubCommands::Generate
- Extended by:
- Hanami::CliBase
- Includes:
- Thor::Actions
- Defined in:
- lib/hanami/cli_sub_commands/generate.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.
A set of generator subcommands
It is run with:
`bundle exec hanami generate`
Instance Method Summary collapse
- #actions(application_name = nil, controller_and_action_name) ⇒ Object private
- #app(application_name) ⇒ Object private
- #mailer(name) ⇒ Object private
- #migration(name) ⇒ Object private
- #model(name) ⇒ Object private
- #secret(application_name = nil) ⇒ Object private
Methods included from Hanami::CliBase
Instance Method Details
#actions(application_name = nil, controller_and_action_name) ⇒ 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.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/hanami/cli_sub_commands/generate.rb', line 40 def actions(application_name = nil, controller_and_action_name) if Hanami::Environment.new().container? && application_name.nil? msg = "ERROR: \"hanami generate action\" was called with arguments [\"#{controller_and_action_name}\"]\n" \ "Usage: \"hanami action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME\"" fail Error, msg end if [:help] invoke :help, ['action'] else Hanami::Commands::Generate::Action.new(, application_name, controller_and_action_name).start end end |
#app(application_name) ⇒ 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.
118 119 120 121 122 123 124 125 |
# File 'lib/hanami/cli_sub_commands/generate.rb', line 118 def app(application_name) if [:help] invoke :help, ['app'] else require 'hanami/commands/generate/app' Hanami::Commands::Generate::App.new(, application_name).start end end |
#mailer(name) ⇒ 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.
99 100 101 102 103 104 105 |
# File 'lib/hanami/cli_sub_commands/generate.rb', line 99 def mailer(name) if [:help] invoke :help, ['mailer'] else Hanami::Commands::Generate::Mailer.new(, name).start end end |
#migration(name) ⇒ 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.
60 61 62 63 64 65 66 67 |
# File 'lib/hanami/cli_sub_commands/generate.rb', line 60 def migration(name) if [:help] invoke :help, ['migration'] else require 'hanami/commands/generate/migration' Hanami::Commands::Generate::Migration.new(, name).start end end |
#model(name) ⇒ 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.
80 81 82 83 84 85 86 87 |
# File 'lib/hanami/cli_sub_commands/generate.rb', line 80 def model(name) if [:help] invoke :help, ['model'] else require 'hanami/commands/generate/model' Hanami::Commands::Generate::Model.new(, name).start end end |
#secret(application_name = nil) ⇒ 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.
134 135 136 137 138 139 140 141 |
# File 'lib/hanami/cli_sub_commands/generate.rb', line 134 def secret(application_name = nil) if [:help] invoke :help, ['secret'] else require 'hanami/commands/generate/secret_token' Hanami::Commands::Generate::SecretToken.new(application_name).start end end |