20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/generators/amber_component_generator.rb', line 20
def generate_component
set_view_format
set_stylesheet_format
unless ::AmberComponent::Configuration::ALLOWED_VIEWS.include? @view_format
raise ::ArgumentError, "No such view format as `#{@view_format}`"
end
unless ::AmberComponent::Configuration::ALLOWED_STYLES.include?(@stylesheet_format)
raise ::ArgumentError, "No such css/style format as `#{@stylesheet_format}`"
end
template 'component.rb.erb', "app/components/#{file_path}.rb"
template 'component_test.rb.erb', "test/components/#{file_path}_test.rb"
create_stylesheet
create_view
create_stimulus_controller
end
|