Sha256: 4048a23f15f53e39e0fe8c0605fec89f19a4fe45fa69695ada1dba82d8f88289

Contents?: true

Size: 987 Bytes

Versions: 4

Compression:

Stored size: 987 Bytes

Contents

module StrongPresenter
  class Railtie < Rails::Railtie

    config.after_initialize do |app|
      app.config.paths.add 'app/presenters', eager_load: true

      if Rails.env.test?
        require 'strong_presenter/test_case'
        require 'strong_presenter/test/rspec_integration' if defined?(RSpec) and RSpec.respond_to?(:configure)
        require 'strong_presenter/test/minitest_integration' if defined?(MiniTest::Rails)
      end
    end

    [:action_controller, :action_mailer, :active_model_serializers].each do |klass|
      initializer "strong_presenter.setup_#{klass}" do |app|
        ActiveSupport.on_load klass do
          StrongPresenter.send "setup_#{klass}", self
        end
      end
    end

    console do
      require 'action_controller/test_case'
      ApplicationController.new.view_context
      StrongPresenter::ViewContext.build
    end

    rake_tasks do
      Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
strong_presenter-0.2.2 lib/strong_presenter/railtie.rb
strong_presenter-0.2.1 lib/strong_presenter/railtie.rb
strong_presenter-0.2.0 lib/strong_presenter/railtie.rb
strong_presenter-0.1.0 lib/strong_presenter/railtie.rb