Sha256: 8eddc28bdc5ccc919400d40cf85d3b356ef4f58b393bc35efedd8f73bc6f3dca

Contents?: true

Size: 932 Bytes

Versions: 12

Compression:

Stored size: 932 Bytes

Contents

module Ecm
  module News
    module Backend
      module Generators
        class InstallGenerator < Rails::Generators::Base
          desc 'Generates the intializer'

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

          def generate_initializer
            copy_file 'initializer.rb', 'config/initializers/ecm_news_backend.rb'
          end

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

          def add_to_itsf_backend
            insert_into_itsf_backend_config(Ecm::News::Backend::Engine)
          end

          private

          def insert_into_itsf_backend_config(engine_name)
            inject_into_file 'config/initializers/001_itsf_backend.rb', after: "config.backend_engines = %w(\n" do
              "    #{engine_name}\n"
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ecm_news2_backend-1.2.6 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.2.5 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.2.4 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.2.3 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.2.2 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.2.1 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.2.0 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.1.3 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.1.1 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.1.0 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.0.1 lib/generators/ecm/news/backend/install/install_generator.rb
ecm_news2_backend-1.0.0 lib/generators/ecm/news/backend/install/install_generator.rb