Class: Charming::Generators::AppGenerator

Inherits:
Base
  • Object
show all
Includes:
AppSpecTemplates, BasicTemplates, ComponentTemplates, ControllerTemplate, LayoutTemplate, ModelTemplates, ScreenSpecTemplates, ViewTemplate
Defined in:
lib/charming/generators/app_generator.rb,
lib/charming/generators/app_generator/view_template.rb,
lib/charming/generators/app_generator/basic_templates.rb,
lib/charming/generators/app_generator/layout_template.rb,
lib/charming/generators/app_generator/model_templates.rb,
lib/charming/generators/app_generator/app_spec_templates.rb,
lib/charming/generators/app_generator/component_templates.rb,
lib/charming/generators/app_generator/controller_template.rb,
lib/charming/generators/app_generator/screen_spec_templates.rb

Defined Under Namespace

Modules: AppSpecTemplates, BasicTemplates, ComponentTemplates, ControllerTemplate, LayoutTemplate, ModelTemplates, ScreenSpecTemplates, ViewTemplate

Constant Summary collapse

FILE_TEMPLATES =
[
  ["Gemfile", :gemfile],
  ["Rakefile", :rakefile],
  ["README.md", :readme],
  ["%<name>s.gemspec", :gemspec],
  ["exe/%<name>s", :executable],
  ["lib/%<name>s.rb", :root_file],
  ["lib/%<name>s/application.rb", :application],
  ["lib/%<name>s/version.rb", :version],
  ["config/routes.rb", :routes],
  ["app/models/application_model.rb", :application_model],
  ["app/models/home_model.rb", :home_model],
  ["app/controllers/application_controller.rb", :application_controller],
  ["app/controllers/home_controller.rb", :controller],
  ["app/views/layouts/application.rb", :layout],
  ["app/views/home_view.rb", :view],
  ["app/components/app_frame_component.rb", :component],
  ["spec/spec_helper.rb", :spec_helper],
  ["spec/models/home_model_spec.rb", :spec_model],
  ["spec/controllers/home_controller_spec.rb", :spec_controller],
  ["spec/views/home_view_spec.rb", :spec_view],
  ["spec/components/app_frame_component_spec.rb", :spec_component]
].freeze

Instance Method Summary collapse

Methods included from AppSpecTemplates

#spec_component, #spec_controller, #spec_model, #spec_view

Methods included from ViewTemplate

#application, #executable, #root_file, #version, #view, #view_helpers

Methods included from ScreenSpecTemplates

#spec_controller, #spec_model, #spec_view

Methods included from ModelTemplates

#application_model, #home_model

Methods included from LayoutTemplate

#layout, #layout_dimension_helpers, #layout_frame_helpers, #layout_frame_style_helpers, #layout_helpers, #layout_modal_helpers, #layout_navigation_helpers, #layout_style_helpers

Methods included from ControllerTemplate

#application_controller, #controller, #controller_actions, #controller_helpers, #render_helpers

Methods included from ComponentTemplates

#component, #component_helpers

Methods included from BasicTemplates

#gemfile, #gemspec, #gemspec_attributes, #gemspec_dependencies, #rakefile, #readme

Constructor Details

#initialize(name, out:, destination:, force: false) ⇒ AppGenerator

Returns a new instance of AppGenerator.



39
40
41
42
# File 'lib/charming/generators/app_generator.rb', line 39

def initialize(name, out:, destination:, force: false)
  super(out: out, destination: File.join(destination, name), force: force)
  @name = Name.new(name)
end

Instance Method Details

#generateObject



44
45
46
47
48
# File 'lib/charming/generators/app_generator.rb', line 44

def generate
  FILE_TEMPLATES.each do |path, template|
    create_file(file_path(path), send(template), executable: template == :executable)
  end
end