Class: Lotus::Commands::Generate::App

Inherits:
Abstract
  • Object
show all
Defined in:
lib/lotus/commands/generate/app.rb

Overview

Since:

  • 0.1.0

Instance Attribute Summary collapse

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Abstract

#template_source_path

Methods included from Generators::Generatable

#add_mapping, #destroy, #generator, #process_templates, #start, #template_source_path

Constructor Details

#initialize(options, application_name) ⇒ App

Returns a new instance of App.

Since:

  • 0.1.0



12
13
14
15
16
17
18
19
20
# File 'lib/lotus/commands/generate/app.rb', line 12

def initialize(options, application_name)
  super(options)

  assert_application_name!(application_name)
  assert_architecture!

  @application_name = ApplicationName.new(application_name)
  @base_path = Pathname.pwd
end

Instance Attribute Details

#base_pathObject (readonly)

Since:

  • 0.1.0



10
11
12
# File 'lib/lotus/commands/generate/app.rb', line 10

def base_path
  @base_path
end

Instance Method Details

#map_templatesObject

Since:

  • 0.1.0



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lotus/commands/generate/app.rb', line 22

def map_templates
  add_mapping('application.rb.tt', 'application.rb')
  add_mapping('config/routes.rb.tt', 'config/routes.rb')
  add_mapping('views/application_layout.rb.tt', 'views/application_layout.rb')
  add_mapping('templates/application.html.erb.tt', 'templates/application.html.erb')
  add_mapping('favicon.ico', 'assets/favicon.ico')

  add_mapping('.gitkeep', 'controllers/.gitkeep')
  add_mapping('.gitkeep', 'assets/images/.gitkeep')
  add_mapping('.gitkeep', 'assets/javascripts/.gitkeep')
  add_mapping('.gitkeep', 'assets/stylesheets/.gitkeep')
  add_mapping('.gitkeep', "../../spec/#{ app_name }/features/.gitkeep")
  add_mapping('.gitkeep', "../../spec/#{ app_name }/controllers/.gitkeep")
  add_mapping('.gitkeep', "../../spec/#{ app_name }/views/.gitkeep")
end

#post_process_templatesObject

Since:

  • 0.1.0



48
49
50
51
52
# File 'lib/lotus/commands/generate/app.rb', line 48

def post_process_templates
  add_require_app
  add_mount_app
  add_web_session_secret
end

#template_optionsObject

Since:

  • 0.1.0



38
39
40
41
42
43
44
45
46
# File 'lib/lotus/commands/generate/app.rb', line 38

def template_options
  {
    app_name:            app_name,
    upcase_app_name:     upcase_app_name,
    classified_app_name: classified_app_name,
    app_base_url:        application_base_url,
    app_base_path:       application_base_path,
  }
end