sprockets 3.0.0.beta.10 → 3.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sprockets.rb +0 -1
- data/lib/sprockets/closure_compressor.rb +2 -0
- data/lib/sprockets/coffee_script_processor.rb +2 -0
- data/lib/sprockets/digest_utils.rb +4 -1
- data/lib/sprockets/eco_processor.rb +2 -0
- data/lib/sprockets/ejs_processor.rb +2 -0
- data/lib/sprockets/legacy.rb +6 -0
- data/lib/sprockets/loader.rb +2 -2
- data/lib/sprockets/manifest.rb +15 -5
- data/lib/sprockets/path_dependency_utils.rb +11 -2
- data/lib/sprockets/path_utils.rb +3 -1
- data/lib/sprockets/resolve.rb +12 -11
- data/lib/sprockets/sass_compressor.rb +2 -0
- data/lib/sprockets/sass_processor.rb +1 -0
- data/lib/sprockets/uglifier_compressor.rb +2 -0
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets/yui_compressor.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db0209bde9d0914d567ab73432b4081d0ee58496
|
4
|
+
data.tar.gz: 91da9e628f1837de6fef73391e211f512ceae82e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66df808557bd8cb9f426cdde656a83231658f10ef1ccadd8865e15f513d31db1ac3d212b766e3e6c247e80c7ad45f5079f195cb5b2285d32e0237c8b70346e8e
|
7
|
+
data.tar.gz: f57cbb51a0ff274d44c0a62933eb26d8576d4d6c25dd85db79e93dbf35b219f558140b1a5bb404f8fc290625082bf2261a7a2e2d98ce74871d0f27a730b368e1
|
data/lib/sprockets.rb
CHANGED
@@ -111,7 +111,10 @@ module Sprockets
|
|
111
111
|
#
|
112
112
|
# Returns urlsafe base64 String.
|
113
113
|
def pack_urlsafe_base64digest(bin)
|
114
|
-
pack_base64digest(bin)
|
114
|
+
str = pack_base64digest(bin)
|
115
|
+
str.tr!('+/'.freeze, '-_'.freeze)
|
116
|
+
str.tr!('='.freeze, ''.freeze)
|
117
|
+
str
|
115
118
|
end
|
116
119
|
|
117
120
|
# Internal: Maps digest class to the named information hash algorithm name.
|
data/lib/sprockets/legacy.rb
CHANGED
@@ -291,6 +291,12 @@ module Sprockets
|
|
291
291
|
end
|
292
292
|
end
|
293
293
|
|
294
|
+
def self.simple_logical_path?(str)
|
295
|
+
str.is_a?(String) &&
|
296
|
+
!PathUtils.absolute_path?(str) &&
|
297
|
+
str !~ /\*|\*\*|\?|\[|\]|\{|\}/
|
298
|
+
end
|
299
|
+
|
294
300
|
# Deprecated: Filter logical paths in environment. Useful for selecting what
|
295
301
|
# files you want to compile.
|
296
302
|
#
|
data/lib/sprockets/loader.rb
CHANGED
@@ -26,7 +26,7 @@ module Sprockets
|
|
26
26
|
def load(uri)
|
27
27
|
filename, params = parse_asset_uri(uri)
|
28
28
|
if params.key?(:id)
|
29
|
-
asset = cache.fetch(['asset-uri', uri]) do
|
29
|
+
asset = cache.fetch(['asset-uri', VERSION, uri]) do
|
30
30
|
load_asset_by_id_uri(uri, filename, params)
|
31
31
|
end
|
32
32
|
else
|
@@ -55,7 +55,7 @@ module Sprockets
|
|
55
55
|
asset = load_asset_by_uri(uri, filename, params)
|
56
56
|
|
57
57
|
if id && asset[:id] != id
|
58
|
-
raise VersionNotFound, "could not find specified id: #{id}"
|
58
|
+
raise VersionNotFound, "could not find specified id: #{uri}##{id}"
|
59
59
|
end
|
60
60
|
|
61
61
|
asset
|
data/lib/sprockets/manifest.rb
CHANGED
@@ -121,13 +121,23 @@ module Sprockets
|
|
121
121
|
|
122
122
|
return to_enum(__method__, *args) unless block_given?
|
123
123
|
|
124
|
-
filters = args.flatten.
|
124
|
+
paths, filters = args.flatten.partition { |arg| self.class.simple_logical_path?(arg) }
|
125
|
+
filters = filters.map { |arg| self.class.compile_match_filter(arg) }
|
125
126
|
|
126
127
|
environment = self.environment.cached
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
|
129
|
+
paths.each do |path|
|
130
|
+
environment.find_all_linked_assets(path) do |asset|
|
131
|
+
yield asset
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
if filters.any?
|
136
|
+
environment.logical_paths do |logical_path, filename|
|
137
|
+
if filters.any? { |f| f.call(logical_path, filename) }
|
138
|
+
environment.find_all_linked_assets(filename) do |asset|
|
139
|
+
yield asset
|
140
|
+
end
|
131
141
|
end
|
132
142
|
end
|
133
143
|
end
|
@@ -41,7 +41,7 @@ module Sprockets
|
|
41
41
|
#
|
42
42
|
# Returns an Array of entry names and a Set of dependency URIs.
|
43
43
|
def entries_with_dependencies(path)
|
44
|
-
return entries(path),
|
44
|
+
return entries(path), file_digest_dependency_set(path)
|
45
45
|
end
|
46
46
|
|
47
47
|
# Internal: List directory filenames and associated Stats under a
|
@@ -53,7 +53,16 @@ module Sprockets
|
|
53
53
|
#
|
54
54
|
# Returns an Array of filenames and a Set of dependency URIs.
|
55
55
|
def stat_directory_with_dependencies(dir)
|
56
|
-
return stat_directory(dir).to_a,
|
56
|
+
return stat_directory(dir).to_a, file_digest_dependency_set(dir)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Internal: Returns a set of dependencies for a particular path.
|
60
|
+
#
|
61
|
+
# path - String directory path
|
62
|
+
#
|
63
|
+
# Returns a Set of dependency URIs.
|
64
|
+
def file_digest_dependency_set(path)
|
65
|
+
Set.new([build_file_digest_uri(path)])
|
57
66
|
end
|
58
67
|
|
59
68
|
# Internal: List directory filenames and associated Stats under an entire
|
data/lib/sprockets/path_utils.rb
CHANGED
@@ -55,7 +55,9 @@ module Sprockets
|
|
55
55
|
# Returns an empty `Array` if the directory does not exist.
|
56
56
|
def entries(path)
|
57
57
|
if File.directory?(path)
|
58
|
-
Dir.entries(path, :encoding => Encoding.default_internal).reject { |entry|
|
58
|
+
Dir.entries(path, :encoding => Encoding.default_internal).reject! { |entry|
|
59
|
+
entry =~ /^\.|~$|^\#.*\#$/
|
60
|
+
}.sort!
|
59
61
|
else
|
60
62
|
[]
|
61
63
|
end
|
data/lib/sprockets/resolve.rb
CHANGED
@@ -151,12 +151,9 @@ module Sprockets
|
|
151
151
|
end
|
152
152
|
|
153
153
|
def path_matches(load_path, logical_name, logical_basename)
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
result = dirname_matches(dirname, logical_basename)
|
158
|
-
candidates.concat(result[0])
|
159
|
-
deps.merge(result[1])
|
154
|
+
dirname = File.dirname(File.join(load_path, logical_name))
|
155
|
+
candidates = dirname_matches(dirname, logical_basename)
|
156
|
+
deps = file_digest_dependency_set(dirname)
|
160
157
|
|
161
158
|
result = resolve_alternates(load_path, logical_name)
|
162
159
|
result[0].each do |fn|
|
@@ -164,23 +161,27 @@ module Sprockets
|
|
164
161
|
end
|
165
162
|
deps.merge(result[1])
|
166
163
|
|
167
|
-
|
168
|
-
|
169
|
-
|
164
|
+
dirname = File.join(load_path, logical_name)
|
165
|
+
if directory? dirname
|
166
|
+
result = dirname_matches(dirname, "index")
|
167
|
+
candidates.concat(result)
|
168
|
+
end
|
169
|
+
|
170
|
+
deps.merge(file_digest_dependency_set(dirname))
|
170
171
|
|
171
172
|
return candidates.select { |fn, _| file?(fn) }, deps
|
172
173
|
end
|
173
174
|
|
174
175
|
def dirname_matches(dirname, basename)
|
175
176
|
candidates = []
|
176
|
-
entries
|
177
|
+
entries = self.entries(dirname)
|
177
178
|
entries.each do |entry|
|
178
179
|
name, type, _, _ = parse_path_extnames(entry)
|
179
180
|
if basename == name
|
180
181
|
candidates << [File.join(dirname, entry), type]
|
181
182
|
end
|
182
183
|
end
|
183
|
-
|
184
|
+
candidates
|
184
185
|
end
|
185
186
|
|
186
187
|
def resolve_alternates(load_path, logical_name)
|
data/lib/sprockets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|