Sha256: 18255bf4117dc454c3b3dd491b93ad8ec23347908632f527a52672f84934c636

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

module RailsViewComponent
  module Generators
    class InstallGenerator < Rails::Generators::Base

      source_root File.expand_path('../templates', __FILE__)
      def copy
        {
          "rails_view_component_builder.rb" => "lib/rails_view_component",
          "rails_view_component_helper.rb"  => "lib/rails_view_component",
          "rails_view_component_model.rb"   => "lib/rails_view_component",
          "RailsViewComponent.hx"           =>
                                        "lib/rails_view_component/haxe",
          "haxe_compile.hxml"               => "./",
        }.each{|file,dir|
          copy_file file, "#{dir}/#{file}"
        }
        
        inject_into_file "app/helpers/application_helper.rb",
            after: "module ApplicationHelper\n" do <<RUBY
        include RailsViewComponentHelper
RUBY
        end

        inject_into_file "config/application.rb",
            after: "class Application < Rails::Application\n" do <<RUBY
    config.autoload_paths += [
      "\#{config.root}/app/rails_view_components",
      "\#{config.root}/lib/rails_view_component",
    ]

RUBY
            end

      end
    
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_view_component-1.0.4 lib/generators/rails_view_component/install_generator.rb
rails_view_component-1.0.3 lib/generators/rails_view_component/install_generator.rb
rails_view_component-1.0.2 lib/generators/rails_view_component/install_generator.rb
rails_view_component-1.0.1 lib/generators/rails_view_component/install_generator.rb
rails_view_component-1.0.0 lib/generators/rails_view_component/install_generator.rb