Sha256: 15814666871a6f1455602810d0b5d721c40184ae28e8f20f853e176634eaae91

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

module Coprl
  module Presenters
    module Rails
      class Railtie < ::Rails::Railtie
        # Use pom as the default scaffolding templating engine
        config.app_generators.generators do |g|
          g.template_engine :pom
        end

        BOOT = -> {
          Coprl::Presenters::App.reset!
          Coprl::Presenters::Settings.configure do |config|
            config.presenters.root = ::Rails.root.join('app')
            config.presenters.deep_freeze = false
          end
          Coprl::Presenters::App.boot!
        } unless defined?(BOOT)

        WATCH = -> {
          return unless ::Rails.env.development?

          path = ::Rails.root.join('app', '**', '*.pom')
          file_watcher = ActiveSupport::FileUpdateChecker.new(Dir[path]) do
            BOOT.call
          end

          ::Rails.application.reloaders << Reloader.new(file_watcher)

        } unless defined?(WATCH)

        config.after_initialize do
          BOOT.call
          WATCH.call
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/rails/railtie.rb