Class: Vident::Phlex::Generators::ComponentGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Vident::Phlex::Generators::ComponentGenerator
- Defined in:
- lib/generators/vident/phlex/component/component_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_component_file ⇒ Object
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_file ⇒ Object
28 29 30 31 32 |
# File 'lib/generators/vident/phlex/component/component_generator.rb', line 28 def create_controller_file return if [:skip_stimulus] || [:skip_controller] ext = [:typescript] ? "ts" : "js" template "controller.#{ext}.tt", File.join("app/components", class_path, "#{file_name}_component_controller.#{ext}") end |
#create_test_file ⇒ Object
34 35 36 37 |
# File 'lib/generators/vident/phlex/component/component_generator.rb', line 34 def create_test_file return if [:skip_test] template "component_test.rb.tt", File.join("test/components", class_path, "#{file_name}_component_test.rb") end |