Sha256: 3d0def0fbfffc1b489c9f326ec3d665fc2f0776cd57ff115e9b03c14b76b5859
Contents?: true
Size: 708 Bytes
Versions: 2
Compression:
Stored size: 708 Bytes
Contents
# frozen_string_literal: true require 'fileutils' # A Rails generator which creates a new Amber component. class AmberComponentGenerator < ::Rails::Generators::NamedBase desc 'Generate a new component' source_root ::File.expand_path('templates', __dir__) # copy rake tasks def copy_tasks template 'component.rb.erb', "app/components/#{file_path}.rb" template 'component_test.rb.erb', "test/components/#{file_path}_test.rb" template 'view.html.erb', "app/components/#{file_path}/view.html.erb" template 'style.css.erb', "app/components/#{file_path}/style.css" end def file_name name = super return name if name.end_with? '_component' "#{name}_component" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amber_component-0.0.4 | lib/generators/amber_component_generator.rb |
amber_component-0.0.3 | lib/generators/amber_component_generator.rb |