Module: Dassets
- Defined in:
- lib/dassets/server.rb,
lib/dassets.rb,
lib/dassets/cache.rb,
lib/dassets/config.rb,
lib/dassets/engine.rb,
lib/dassets/source.rb,
lib/dassets/version.rb,
lib/dassets/asset_file.rb,
lib/dassets/file_store.rb,
lib/dassets/source_file.rb,
lib/dassets/source_proxy.rb,
lib/dassets/server/request.rb,
lib/dassets/server/response.rb
Overview
Rack middleware for serving Dassets asset files
Defined Under Namespace
Modules: SourceFiles
Classes: AssetFile, Config, Engine, FileStore, MemCache, NoCache, NullFileStore, NullSourceFile, NullSourceProxy, Server, Source, SourceFile, SourceProxy
Constant Summary
collapse
- AssetFileError =
Class.new(RuntimeError)
- VERSION =
"0.15.3"
Class Method Summary
collapse
Class Method Details
.[](digest_path) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/dassets.rb', line 33
def self.[](digest_path)
asset_file(digest_path).tap do |af|
if af.fingerprint.nil?
msg =
+"error digesting `#{digest_path}`.\n\nMake sure Dassets has " \
"either a combination or source file for this digest path. If " \
"this path is for a combination, make sure Dassets has either " \
"a combination or source file for each digest path of the " \
"combination.\n\n"
msg << "\nCombination digest paths:"
msg << (Dassets.combinations.keys.empty? ? " (none)\n\n" : "\n\n")
Dassets.combinations.keys.sort.each do |key|
bullet = "#{key} => "
values = Dassets.combinations[key].sort
msg << (
["#{bullet}#{values.first}"] +
(values[1..-1] || []).map{ |v| "#{" " * bullet.size}#{v}" }
).join("\n")
msg << "\n\n"
end
msg << "\nSource file digest paths:"
msg << (Dassets.source_files.keys.empty? ? " (none)\n\n" : "\n\n")
msg << Dassets.source_files.keys.sort.join("\n")
raise AssetFileError, msg
end
end
end
|
.asset_file(digest_path) ⇒ Object
29
30
31
|
# File 'lib/dassets.rb', line 29
def self.asset_file(digest_path)
@asset_files[digest_path] ||= AssetFile.new(digest_path)
end
|
.combinations ⇒ Object
68
69
70
|
# File 'lib/dassets.rb', line 68
def self.combinations
config.combinations
end
|
.config ⇒ Object
11
12
13
|
# File 'lib/dassets.rb', line 11
def self.config
@config ||= Config.new
end
|
15
16
17
|
# File 'lib/dassets.rb', line 15
def self.configure(&block)
block.call(config)
end
|
.init ⇒ Object
19
20
21
22
|
# File 'lib/dassets.rb', line 19
def self.init
@asset_files ||= {}
@source_files = SourceFiles.new(config.sources)
end
|
.reset ⇒ Object
24
25
26
27
|
# File 'lib/dassets.rb', line 24
def self.reset
@asset_files = {}
config.reset
end
|
.source_files ⇒ Object
64
65
66
|
# File 'lib/dassets.rb', line 64
def self.source_files
@source_files
end
|