Sha256: a928021221578e89ed8510a86989a943a0876d6ba08af0e68cd2400a067d4c9d

Contents?: true

Size: 969 Bytes

Versions: 8

Compression:

Stored size: 969 Bytes

Contents

module Ecm
  module Core
    module Backend
      module Generators
        class InstallGenerator < Rails::Generators::Base
          desc 'Installs the initializer, routes and itsf_backend integration'

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

          def generate_initializer
            copy_file 'initializer.rb', 'config/initializers/ecm_core_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::Core::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

8 entries across 8 versions & 1 rubygems

Version Path
ecm_core-0.4.0 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.3.0 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.2.2 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.2.1 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.2.0 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.1.0 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.0.4 lib/generators/ecm/core/backend/install/install_generator.rb
ecm_core-0.0.3 lib/generators/ecm/core/backend/install/install_generator.rb