Sha256: 6e9b85e02df2aad23489025af96870eeebf6613b4fa75356e0637170e644508a

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

module Shipit
  class Engine < ::Rails::Engine
    isolate_namespace Shipit

    paths['app/models'] << 'app/serializers' << 'app/serializers/concerns'

    initializer 'shipit.config' do |app|
      Rails.application.routes.default_url_options[:host] = Shipit.host
      Shipit::Engine.routes.default_url_options[:host] = Shipit.host
      Pubsubstub.redis_url = Shipit.redis_url.to_s

      app.config.assets.paths << Emoji.images_path
      app.config.assets.precompile += %w(
        favicon.ico
        task.js
        shipit.js
        shipit.css
        merge_status.js
        merge_status.css
      )
      app.config.assets.precompile << proc do |path|
        path =~ %r{\Aplugins/[\-\w]+\.(js|css)\Z}
      end
      app.config.assets.precompile << proc do |path|
        path.end_with?('.svg') || (path.start_with?('emoji/') && path.end_with?('.png'))
      end

      ActionDispatch::ExceptionWrapper.rescue_responses[Shipit::TaskDefinition::NotFound.name] = :not_found

      ActiveModel::Serializer._root = false
      ActiveModel::ArraySerializer._root = false
      ActiveModel::Serializer.include(Engine.routes.url_helpers)

      if Shipit.github.oauth?
        OmniAuth::Strategies::GitHub.configure path_prefix: '/github/auth'
        app.middleware.use OmniAuth::Builder do
          provider(:github, *Shipit.github.oauth_config)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shipit-engine-0.28.1 lib/shipit/engine.rb
shipit-engine-0.28.0 lib/shipit/engine.rb
shipit-engine-0.27.1 lib/shipit/engine.rb
shipit-engine-0.27.0 lib/shipit/engine.rb
shipit-engine-0.26.0 lib/shipit/engine.rb
shipit-engine-0.25.1 lib/shipit/engine.rb
shipit-engine-0.25.0 lib/shipit/engine.rb