Sha256: 17225edfb72e830b9e6b5e0e954fddaa47eb2e32fccbee5e28544d434b397eea
Contents?: true
Size: 961 Bytes
Versions: 2
Compression:
Stored size: 961 Bytes
Contents
class EngineAssets::PublicLocator class << self attr_reader :paths # TODO: expose this as EngineAssets.register(...) def register(full_path) raise ArgumentError unless File.exist?(full_path) @paths ||= [] public_path = File.join(full_path, 'public') if File.exist?(public_path) # TODO: # * spec me # * split me into separate implementations if defined?(Rails) && Rails::VERSION::MAJOR == 3 # Rails 3 Rails.configuration.middleware.use ::ActionDispatch::Static, public_path else # Rails 2 paths << public_path end end end def locate(file_path) full_paths = (paths || []).map { |base_path| File.join(base_path, file_path) } full_paths.each do |full_path| return full_path if File.exist?(full_path) end nil end private def clear @paths = nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
engine-assets-0.5.1 | lib/engine_assets/public_locator.rb |
engine-assets-0.5.0 | lib/engine_assets/public_locator.rb |