Class: ViewComponentGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ViewComponentGenerator
- Defined in:
- lib/generators/view_component/view_component_generator.rb
Overview
Instance Method Summary collapse
- #create_component_file ⇒ Object
- #create_preview_file ⇒ Object
- #create_system_test_file ⇒ Object
- #create_template_file ⇒ Object
- #create_test_file ⇒ Object
Instance Method Details
#create_component_file ⇒ Object
13 14 15 |
# File 'lib/generators/view_component/view_component_generator.rb', line 13 def create_component_file template "component.rb", File.join("app/frontend/components", class_path, file_name, "component.rb") end |
#create_preview_file ⇒ Object
33 34 35 36 37 |
# File 'lib/generators/view_component/view_component_generator.rb', line 33 def create_preview_file return if [:skip_preview] template "preview.rb", File.join("app/frontend/components", class_path, file_name, "preview.rb") end |
#create_system_test_file ⇒ Object
27 28 29 30 31 |
# File 'lib/generators/view_component/view_component_generator.rb', line 27 def create_system_test_file return if [:skip_system_test] template "component_system_test.rb", File.join("test/system/frontend/components", class_path, "#{file_name}_test.rb") end |
#create_template_file ⇒ Object
17 18 19 |
# File 'lib/generators/view_component/view_component_generator.rb', line 17 def create_template_file template "component.html.erb", File.join("app/frontend/components", class_path, file_name, "component.html.erb") end |
#create_test_file ⇒ Object
21 22 23 24 25 |
# File 'lib/generators/view_component/view_component_generator.rb', line 21 def create_test_file return if [:skip_test] template "component_test.rb", File.join("test/frontend/components", class_path, "#{file_name}_test.rb") end |