Class: Ember::Generators::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
GeneratorHelpers
Defined in:
lib/generators/ember/component_generator.rb

Instance Method Summary collapse

Methods included from GeneratorHelpers

#app_path, #application_name, #class_name, #config_path, #configuration, #engine_name, #handlebars_template_path, #javascript_assets_path, #rails_engine?, #require_name

Instance Method Details

#create_component_filesObject



12
13
14
15
16
17
18
19
# File 'lib/generators/ember/component_generator.rb', line 12

def create_component_files
  dashed_file_name = file_name.gsub(/_/, '-')
  component_path = File.join(app_path, 'components', class_path, "#{dashed_file_name}.es6")
  template "component.es6", component_path

  template_path = File.join(app_path, 'templates/components', class_path, "#{dashed_file_name}.hbs")
  template "component.template.hbs", template_path
end