22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/generators/solidus_admin/component/component_generator.rb', line 22
def create_component_files
template "component.html.erb", destination(".html.erb")
unless options["html"]
say_status :inline, destination(".html.erb"), :blue
@inline_html = File.read(destination(".html.erb"))
shell.mute { remove_file(destination(".html.erb")) }
end
template "component.rb", destination(".rb")
template "component.yml", destination(".yml") if options["i18n"]
template "component.js", destination(".js") if options["js"]
template "component_spec.rb", destination("_spec.rb", root: "spec/components") if options["spec"]
if options["preview"]
preview_destination_path = destination("_preview.rb", root: "spec/components/previews")
template "component_preview.rb", preview_destination_path
template "component_preview_overview.html.erb", preview_destination_path.sub(/\.rb/, '/overview.html.erb')
end
end
|