Class: Vident::Phlex::Generators::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/vident/phlex/component/component_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_component_fileObject



24
25
26
# File 'lib/generators/vident/phlex/component/component_generator.rb', line 24

def create_component_file
  template "component.rb.tt", File.join("app/components", class_path, "#{file_name}_component.rb")
end

#create_controller_fileObject



28
29
30
31
32
# File 'lib/generators/vident/phlex/component/component_generator.rb', line 28

def create_controller_file
  return if options[:skip_stimulus] || options[:skip_controller]
  ext = options[:typescript] ? "ts" : "js"
  template "controller.#{ext}.tt", File.join("app/components", class_path, "#{file_name}_component_controller.#{ext}")
end

#create_test_fileObject



34
35
36
37
# File 'lib/generators/vident/phlex/component/component_generator.rb', line 34

def create_test_file
  return if options[:skip_test]
  template "component_test.rb.tt", File.join("test/components", class_path, "#{file_name}_component_test.rb")
end