Sha256: 2fe2aa4f592c801a1d751288a99db46d7cf73bf3628c795b7635692359671377

Contents?: true

Size: 951 Bytes

Versions: 17

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

module Cmor::Seo::Frontend
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc "Generates the initializer"

      source_root File.expand_path("../templates", __FILE__)

      attr_reader :base_controller_class_name

      def initialize(*args)
        super
        @base_controller_class_name = ENV.fetch("BASE_CONTROLLER_CLASS_NAME") { "::ApplicationController" }
      end

      def generate_initializer
        template "initializer.rb", "config/initializers/cmor_seo_frontend.rb"
      end

      def generate_routes
        route File.read(File.join(File.expand_path("../templates", __FILE__), "routes.source"))
      end

      def mount_application_view_helper
        inject_into_file "app/controllers/application_controller.rb", before: "end\n" do
          "  view_helper Cmor::Seo::Frontend::ApplicationViewHelper, as: :seo_helper\n"
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
cmor_seo_frontend-0.0.60.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.59.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.58.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.57.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.56.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.55.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.54.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.53.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.52.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.51.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.50.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.49.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.48.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.44.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.43.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.42.pre lib/generators/cmor/seo/frontend/install/install_generator.rb
cmor_seo_frontend-0.0.41.pre lib/generators/cmor/seo/frontend/install/install_generator.rb