Sha256: 88b5d852957faaf86b9c643ded74896d0bdf802c58cbbe544446fbc28c4774ad

Contents?: true

Size: 957 Bytes

Versions: 9

Compression:

Stored size: 957 Bytes

Contents

module Ecm
  module Downloads
    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 'ecm_downloads_backend.rb', 'config/initializers/ecm_downloads_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::Downloads::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

9 entries across 9 versions & 1 rubygems

Version Path
ecm_downloads2_backend-2.1.0 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-2.0.2 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-2.0.1 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-2.0.0 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-1.1.1 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-1.1.0 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-1.0.3 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-1.0.2 lib/generators/ecm/downloads/backend/install/install_generator.rb
ecm_downloads2_backend-1.0.1 lib/generators/ecm/downloads/backend/install/install_generator.rb