Class: Hanami::CliSubCommands::Generate Private

Inherits:
Thor
  • Object
show all
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`

Since:

  • 0.6.0

Instance Method Summary collapse

Methods included from Hanami::CliBase

define_commands

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.

Since:

  • 0.6.0


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(options).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 options[:help]
    invoke :help, ['action']
  else
    Hanami::Commands::Generate::Action.new(options, 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.

Since:

  • 0.6.0


118
119
120
121
122
123
124
125
# File 'lib/hanami/cli_sub_commands/generate.rb', line 118

def app(application_name)
  if options[:help]
    invoke :help, ['app']
  else
    require 'hanami/commands/generate/app'
    Hanami::Commands::Generate::App.new(options, 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.

Since:

  • 0.6.0


99
100
101
102
103
104
105
# File 'lib/hanami/cli_sub_commands/generate.rb', line 99

def mailer(name)
  if options[:help]
    invoke :help, ['mailer']
  else
    Hanami::Commands::Generate::Mailer.new(options, 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.

Since:

  • 0.6.0


60
61
62
63
64
65
66
67
# File 'lib/hanami/cli_sub_commands/generate.rb', line 60

def migration(name)
  if options[:help]
    invoke :help, ['migration']
  else
    require 'hanami/commands/generate/migration'
    Hanami::Commands::Generate::Migration.new(options, 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.

Since:

  • 0.6.0


80
81
82
83
84
85
86
87
# File 'lib/hanami/cli_sub_commands/generate.rb', line 80

def model(name)
  if options[:help]
    invoke :help, ['model']
  else
    require 'hanami/commands/generate/model'
    Hanami::Commands::Generate::Model.new(options, 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.

Since:

  • 0.6.0


134
135
136
137
138
139
140
141
# File 'lib/hanami/cli_sub_commands/generate.rb', line 134

def secret(application_name = nil)
  if options[:help]
    invoke :help, ['secret']
  else
    require 'hanami/commands/generate/secret_token'
    Hanami::Commands::Generate::SecretToken.new(application_name).start
  end
end