Sha256: f93b1de2009fabc5044a41d43e21d15f0c9229c669a16d7fe9ab062abaece7f8
Contents?: true
Size: 791 Bytes
Versions: 1
Compression:
Stored size: 791 Bytes
Contents
require 'rack/app' class Rack::App::Bootstrap < Rack::App require 'rack/app/bootstrap/version' ASSET_VERSIONS_FOLDER = ::File.join(::File.dirname(__FILE__), 'bootstrap', 'assets') on_mounted do |options| assets_by_version(options[:version]) end def self.assets_by_version(version) version = latest_version if version.nil? asset_versions_paths = Dir.glob(::File.join(ASSET_VERSIONS_FOLDER, '*')) asset_versions_paths.find { |path| ::File.basename(path) == version } || raise("unknown bootstrap version: #{version}") mount_directory("assets/#{version}") end def self.latest_version Dir.glob(::File.join(ASSET_VERSIONS_FOLDER, '*')).map { |fp| ::File.basename(fp) }.sort_by { |version| Gem::Version.new(version) }.last end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-app-bootstrap-0.4.0 | lib/rack/app/bootstrap.rb |