Sha256: 8b0b647df9ce12d73ab6737025ff1babd1726628d7bbbfa53fc67f1b368e7c10

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

module PageflowExternalLinks
  class InstallGenerator < Rails::Generators::Base
    desc 'Install the Pageflow plugin and the necessary migrations.'

    def register_plugin
      inject_into_file('config/initializers/pageflow.rb',
                       after: "Pageflow.configure do |config|\n") do

        "  config.plugin(Pageflow::#{engine_name_suffix.camelize}.plugin)\n"
      end
    end

    def mount_engine
      route("mount #{engine.name}, at: '/#{engine_name_suffix}'\n")
    end

    def install_migrations
      rake "pageflow_#{engine_name_suffix}:install:migrations"
      rake 'pageflow_external_links:install:migrations'
    end

    private

    def engine_name_suffix
      engine.engine_name.gsub(/^pageflow_/, '')
    end

    def engine
      Pageflow::ExternalLinks::Engine
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-external-links-2.6.0 lib/generators/pageflow_external_links/install/install_generator.rb
pageflow-external-links-2.5.0 lib/generators/pageflow_external_links/install/install_generator.rb
pageflow-external-links-2.4.1 lib/generators/pageflow_external_links/install/install_generator.rb
pageflow-external-links-2.4.0 lib/generators/pageflow_external_links/install/install_generator.rb
pageflow-external-links-2.3.0 lib/generators/pageflow_external_links/install/install_generator.rb
pageflow-external-links-2.2.1 lib/generators/pageflow_external_links/install/install_generator.rb