Class: Md::Generators::ScaffoldGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
MarionetteDust::Generators::Helpers
Defined in:
lib/generators/md/scaffold/scaffold_generator.rb

Instance Method Summary collapse

Methods included from MarionetteDust::Generators::Helpers

#app_name, #apps_path, #asset_file_name, #asset_path, #entities_path, #extension, #javascript_path, #plural_entity_name, #plural_file_name, #rails_app_name, #singular_entity_name, #singular_file_name, #sub_app_file_name, #sub_app_name, #sub_app_scope, #template_path, #trackeable_directory

Instance Method Details

#create_marionette_appObject



29
30
31
32
33
# File 'lib/generators/md/scaffold/scaffold_generator.rb', line 29

def create_marionette_app
  empty_directory File.join(apps_path, file_name.downcase)
  file = File.join(apps_path, file_name.downcase, sub_app_file_name)
  template "app#{extension}", file
end

#create_marionette_entityObject



24
25
26
27
# File 'lib/generators/md/scaffold/scaffold_generator.rb', line 24

def create_marionette_entity
  file = File.join(entities_path, singular_file_name)
  template "entity#{extension}", file
end

#create_subappObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/generators/md/scaffold/scaffold_generator.rb', line 35

def create_subapp
  return if options.submodule.empty?
  for submodule in options.submodule
    @submodule_name = submodule
    empty_directory File.join(apps_path, file_name.downcase, submodule.downcase)
    create_asset("view")
    create_asset("controller")
    create_dust_template
  end
end