Sha256: 1f3f49bdaaff04e4b2ace1048d666fe2711bd0a1f07eb5bf49dad4fd1f109e72
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true require 'fileutils' module ::AmberComponent module Generators # A Rails generator which installs the `amber_component` # library in a Rails project. class InstallGenerator < ::Rails::Generators::Base desc 'Install the AmberComponent gem' source_root ::File.expand_path('templates', __dir__) # copy rake tasks def copy_tasks copy_file 'application_component.rb', 'app/components/application_component.rb' copy_file 'application_component_test_case.rb', 'test/application_component_test_case.rb' append_file 'test/test_helper.rb', "require_relative 'application_component_test_case'" require_components_css_in 'app/assets/stylesheets/application.css' require_components_css_in 'app/assets/stylesheets/application.scss' require_components_css_in 'app/assets/stylesheets/application.sass' require_components_css_in 'app/assets/stylesheets/application.css.scss' require_components_css_in 'app/assets/stylesheets/application.css.sass' require_components_css_in 'app/assets/stylesheets/application.scss.sass' require_components_css_in 'app/assets/stylesheets/application.sass.scss' end private # @param file_name [String] # @return [void] def require_components_css_in(file_name) return unless ::File.exist? file_name inject_into_file file_name, after: "*= require_tree .\n" do " *= require_tree ./../../components\n" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amber_component-1.0.0 | lib/generators/amber_component/install_generator.rb |
amber_component-0.0.5 | lib/generators/amber_component/install_generator.rb |