Class: Hanami::CLI::Commands::Generate::App Private

Inherits:
Command
  • Object
show all
Defined in:
lib/hanami/cli/commands/generate/app.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.

Since:

  • 1.1.0

Direct Known Subclasses

New::App

Instance Method Summary collapse

Methods inherited from Command

inherited, #initialize

Constructor Details

This class inherits a constructor from Hanami::CLI::Commands::Command

Instance Method Details

#call(app:, application_base_url: nil, **options) ⇒ 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.

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength

Since:

  • 1.1.0



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/hanami/cli/commands/generate/app.rb', line 25

def call(app:, application_base_url: nil, **options)
  app      = Utils::String.underscore(app)
  template = options.fetch(:template)
  base_url = application_base_url || "/#{app}"
  context  = Context.new(app: app, base_url: base_url, test: options.fetch(:test), template: template, options: options)

  assert_valid_base_url!(context)

  generate_app(context)
  generate_routes(context)
  generate_layout(context)
  generate_template(context)
  generate_favicon(context)

  create_controllers_directory(context)
  create_assets_images_directory(context)
  create_assets_javascripts_directory(context)
  create_assets_stylesheets_directory(context)

  create_spec_features_directory(context)
  create_spec_controllers_directory(context)
  generate_layout_spec(context)

  inject_require_app(context)
  inject_mount_app(context)

  append_development_http_session_secret(context)
  append_test_http_session_secret(context)
end