Sha256: d28aea77aa76b67b1bb67b067fe1069e5238e21d51d68cfc6679b400f7cfe1f9

Contents?: true

Size: 689 Bytes

Versions: 12

Compression:

Stored size: 689 Bytes

Contents

require 'rack/utils'
require 'active_support/core_ext/uri'
require 'action_dispatch/middleware/static'

module FrontEndBuilds
  module Middleware

    class AdminAssets < ::ActionDispatch::Static
      def front_end_build_asset_regex
        @_regex ||= /^\/front_end_builds\/assets\//
      end

      def requesting_feb_assets?(path)
        path.match(front_end_build_asset_regex)
      end

      def call(env)
        path = env['PATH_INFO']

        # Only call Static middleware if we know this is a request for
        # a front end build asset.
        if requesting_feb_assets?(path)
          super
        else
          @app.call(env)
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
front_end_builds-1.0.3 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-1.0.2 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-1.0.1 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-1.0.0 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.2.1 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.2.0 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.1.3 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.1.2 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.1.1 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.1.0 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.0.26 lib/front_end_builds/middleware/admin_assets.rb
front_end_builds-0.0.25 lib/front_end_builds/middleware/admin_assets.rb