sprockets 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sprockets might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sprockets/cache/file_store.rb +7 -4
- data/lib/sprockets/path_utils.rb +3 -1
- data/lib/sprockets/uri_tar.rb +2 -4
- data/lib/sprockets/utils.rb +24 -11
- data/lib/sprockets/version.rb +1 -1
- 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: 395f97699c07aab98cec80882a5e7f3737aaaa6c
|
4
|
+
data.tar.gz: 30beb1d71c6bfa3c26472dc5d9e30a0e9d6a077f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f9e96886a62cc1704af19e305beb4e6b1ae49cabcd2c23d3464d91694c1798920e9aba2658a1725e1628a0689d11ea83d03839e5254de21d81a9d13d1423da
|
7
|
+
data.tar.gz: 576f6ecb35fa61eeef7f14c22a8de476f916cd704865185abfd11170375df51058df781b4db57d98f463704ad6cf48b5f7a0af130648bfa5b26d8bac89d4eb2f
|
data/CHANGELOG.md
CHANGED
@@ -36,7 +36,6 @@ module Sprockets
|
|
36
36
|
# (default: 1000).
|
37
37
|
def initialize(root, max_size = DEFAULT_MAX_SIZE, logger = self.class.default_logger)
|
38
38
|
@root = root
|
39
|
-
@size = find_caches.inject(0) { |n, (_, stat)| n + stat.size }
|
40
39
|
@max_size = max_size
|
41
40
|
@gc_size = max_size * 0.75
|
42
41
|
@logger = logger
|
@@ -107,11 +106,11 @@ module Sprockets
|
|
107
106
|
# Write data
|
108
107
|
PathUtils.atomic_write(path) do |f|
|
109
108
|
f.write(raw)
|
110
|
-
@size
|
109
|
+
@size = size + f.size unless exists
|
111
110
|
end
|
112
111
|
|
113
112
|
# GC if necessary
|
114
|
-
gc! if
|
113
|
+
gc! if size > @max_size
|
115
114
|
|
116
115
|
value
|
117
116
|
end
|
@@ -120,7 +119,7 @@ module Sprockets
|
|
120
119
|
#
|
121
120
|
# Returns String.
|
122
121
|
def inspect
|
123
|
-
"#<#{self.class} size=#{
|
122
|
+
"#<#{self.class} size=#{size}/#{@max_size}>"
|
124
123
|
end
|
125
124
|
|
126
125
|
private
|
@@ -138,6 +137,10 @@ module Sprockets
|
|
138
137
|
}.sort_by { |_, stat| stat.mtime.to_i }
|
139
138
|
end
|
140
139
|
|
140
|
+
def size
|
141
|
+
@size ||= compute_size(find_caches)
|
142
|
+
end
|
143
|
+
|
141
144
|
def compute_size(caches)
|
142
145
|
caches.inject(0) { |sum, (_, stat)| sum + stat.size }
|
143
146
|
end
|
data/lib/sprockets/path_utils.rb
CHANGED
@@ -55,7 +55,9 @@ module Sprockets
|
|
55
55
|
if File.directory?(path)
|
56
56
|
entries = Dir.entries(path, :encoding => Encoding.default_internal)
|
57
57
|
entries.reject! { |entry|
|
58
|
-
entry
|
58
|
+
entry.start_with?(".".freeze) ||
|
59
|
+
(entry.start_with?("#".freeze) && entry.end_with?("#".freeze)) ||
|
60
|
+
entry.end_with?("~".freeze)
|
59
61
|
}
|
60
62
|
entries.sort!
|
61
63
|
else
|
data/lib/sprockets/uri_tar.rb
CHANGED
@@ -14,10 +14,8 @@ module Sprockets
|
|
14
14
|
@env = env
|
15
15
|
uri = uri.to_s
|
16
16
|
if uri.include?("://".freeze)
|
17
|
-
|
18
|
-
@scheme
|
19
|
-
@scheme << "://".freeze
|
20
|
-
@path = uri_array.join("".freeze)
|
17
|
+
@scheme, _, @path = uri.partition("://".freeze)
|
18
|
+
@scheme << "://".freeze
|
21
19
|
else
|
22
20
|
@scheme = "".freeze
|
23
21
|
@path = uri
|
data/lib/sprockets/utils.rb
CHANGED
@@ -74,16 +74,19 @@ module Sprockets
|
|
74
74
|
def string_end_with_semicolon?(str)
|
75
75
|
i = str.size - 1
|
76
76
|
while i >= 0
|
77
|
-
c = str[i]
|
77
|
+
c = str[i].ord
|
78
78
|
i -= 1
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
|
80
|
+
# Need to compare against the ordinals because the string can be UTF_8 or UTF_32LE encoded
|
81
|
+
# 0x0A == "\n"
|
82
|
+
# 0x20 == " "
|
83
|
+
# 0x09 == "\t"
|
84
|
+
# 0x3B == ";"
|
85
|
+
unless c == 0x0A || c == 0x20 || c == 0x09
|
86
|
+
return c === 0x3B
|
85
87
|
end
|
86
88
|
end
|
89
|
+
|
87
90
|
true
|
88
91
|
end
|
89
92
|
|
@@ -95,11 +98,21 @@ module Sprockets
|
|
95
98
|
#
|
96
99
|
# Returns buf String.
|
97
100
|
def concat_javascript_sources(buf, source)
|
98
|
-
if
|
99
|
-
buf <<
|
100
|
-
|
101
|
+
if source.bytesize > 0
|
102
|
+
buf << source
|
103
|
+
|
104
|
+
# If the source contains non-ASCII characters, indexing on it becomes O(N).
|
105
|
+
# This will lead to O(N^2) performance in string_end_with_semicolon?, so we should use 32 bit encoding to make sure indexing stays O(1)
|
106
|
+
source = source.encode(Encoding::UTF_32LE) unless source.ascii_only?
|
107
|
+
|
108
|
+
if !string_end_with_semicolon?(source)
|
109
|
+
buf << ";\n"
|
110
|
+
elsif source[source.size - 1].ord != 0x0A
|
111
|
+
buf << "\n"
|
112
|
+
end
|
101
113
|
end
|
102
|
-
|
114
|
+
|
115
|
+
buf
|
103
116
|
end
|
104
117
|
|
105
118
|
# Internal: Prepends a leading "." to an extension if its missing.
|
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.6.
|
4
|
+
version: 3.6.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: 2016-
|
12
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|