sprockets 3.0.0.beta.10 → 3.0.0.rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62bc83e5dba29c526fc06ee79618cac3013f5ab1
4
- data.tar.gz: 8d5716e9158a481ac8893badaddba2562b2d5e2d
3
+ metadata.gz: db0209bde9d0914d567ab73432b4081d0ee58496
4
+ data.tar.gz: 91da9e628f1837de6fef73391e211f512ceae82e
5
5
  SHA512:
6
- metadata.gz: 4e31bcaac28fe9d231373471e49c91edf25bc27775ebc80f14949258be4dea66ddf9f48340b5e44613d195ade34b96c74898fd482224fe91a0204d69cea5312a
7
- data.tar.gz: 48002bb898333ca896ec592603ef32ece5a1528d8dbc45d12618e5f80cd2cc905f758795f7d1305a6e44086fcf47f4ecdb422ca78404b70b2a454cbfd7df0473
6
+ metadata.gz: 66df808557bd8cb9f426cdde656a83231658f10ef1ccadd8865e15f513d31db1ac3d212b766e3e6c247e80c7ad45f5079f195cb5b2285d32e0237c8b70346e8e
7
+ data.tar.gz: f57cbb51a0ff274d44c0a62933eb26d8576d4d6c25dd85db79e93dbf35b219f558140b1a5bb404f8fc290625082bf2261a7a2e2d98ce74871d0f27a730b368e1
@@ -1,5 +1,4 @@
1
1
  require 'sprockets/version'
2
- require 'sprockets/autoload'
3
2
  require 'sprockets/cache'
4
3
  require 'sprockets/environment'
5
4
  require 'sprockets/errors'
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Public: Closure Compiler minifier.
3
5
  #
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Processor engine class for the CoffeeScript compiler.
3
5
  # Depends on the `coffee-script` and `coffee-script-source` gems.
@@ -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).tr('+/', '-_').tr('=', '')
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.
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Processor engine class for the Eco compiler. Depends on the `eco` gem.
3
5
  #
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Processor engine class for the EJS compiler. Depends on the `ejs` gem.
3
5
  #
@@ -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
  #
@@ -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
@@ -121,13 +121,23 @@ module Sprockets
121
121
 
122
122
  return to_enum(__method__, *args) unless block_given?
123
123
 
124
- filters = args.flatten.map { |arg| self.class.compile_match_filter(arg) }
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
- environment.logical_paths do |logical_path, filename|
128
- if filters.any? { |f| f.call(logical_path, filename) }
129
- environment.find_all_linked_assets(filename) do |asset|
130
- yield asset
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), Set.new([build_file_digest_uri(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, Set.new([build_file_digest_uri(dir)])
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
@@ -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| entry =~ /^\.|~$|^\#.*\#$/ }.sort
58
+ Dir.entries(path, :encoding => Encoding.default_internal).reject! { |entry|
59
+ entry =~ /^\.|~$|^\#.*\#$/
60
+ }.sort!
59
61
  else
60
62
  []
61
63
  end
@@ -151,12 +151,9 @@ module Sprockets
151
151
  end
152
152
 
153
153
  def path_matches(load_path, logical_name, logical_basename)
154
- candidates, deps = [], Set.new
155
- dirname = File.dirname(File.join(load_path, logical_name))
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
- result = dirname_matches(File.join(load_path, logical_name), "index")
168
- candidates.concat(result[0])
169
- deps.merge(result[1])
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, deps = self.entries_with_dependencies(dirname)
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
- return candidates, deps
184
+ candidates
184
185
  end
185
186
 
186
187
  def resolve_alternates(load_path, logical_name)
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Public: Sass CSS minifier.
3
5
  #
@@ -1,4 +1,5 @@
1
1
  require 'rack/utils'
2
+ require 'sprockets/autoload'
2
3
  require 'uri'
3
4
 
4
5
  module Sprockets
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Public: Uglifier/Uglify compressor.
3
5
  #
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "3.0.0.beta.10"
2
+ VERSION = "3.0.0.rc.1"
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'sprockets/autoload'
2
+
1
3
  module Sprockets
2
4
  # Public: YUI compressor.
3
5
  #
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.beta.10
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-23 00:00:00.000000000 Z
12
+ date: 2015-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack