asset 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/asset.gemspec +2 -2
- data/lib/assets/util.rb +6 -16
- 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: aa56707d89c8c2fa5650e219c0035d44f04c76b5
|
4
|
+
data.tar.gz: ef875488de30478045bf28906063559ddff6eb46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cef50cde999cc938a62720f83b975c3392bca36cac2227107111080dcd04d496f9720c6cbe9d60d9c0063118d2c41a71a041c49121a064ad9e0a590c85fdc2a
|
7
|
+
data.tar.gz: 7377e09d18a821d5e6e02784a3b3ad10c7bae49a1d4e09f0b26f8a67933ed3ddca6af361e97abb07c8edfab7276e6dc35d745a61a25998465753b2b10502d495
|
data/CHANGELOG.md
CHANGED
data/asset.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'asset'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2017-01-
|
3
|
+
s.version = '0.1.13'
|
4
|
+
s.date = '2017-01-27'
|
5
5
|
s.summary = "Compress and serve your CSS and JS assets automatically"
|
6
6
|
s.description = "The only thing you need for your assets."
|
7
7
|
s.authors = ["Fugroup Limited"]
|
data/lib/assets/util.rb
CHANGED
@@ -33,32 +33,22 @@ module Asset
|
|
33
33
|
|
34
34
|
# Load manifest
|
35
35
|
def self.load_manifest
|
36
|
-
|
37
|
-
|
38
|
-
Dir["#{Asset.path}/{css,js}/**/*.{css,js}"].each do |file|
|
36
|
+
Dir["#{Asset.path}/{css,js}/**/*.*"].map do |f|
|
39
37
|
# Extract type and name
|
40
|
-
|
41
|
-
|
42
|
-
# Get the modified time of the asset
|
43
|
-
modified = mtime("#{type}/#{name}")
|
38
|
+
f =~ /(js|css)\/(.+)$/; type, name = $1, $2
|
44
39
|
|
45
40
|
# Loading manifest with items
|
46
|
-
|
41
|
+
::Asset::Item.new(name, type, digest(File.read(f)), mtime("#{type}/#{name}"))
|
47
42
|
end
|
48
|
-
|
49
|
-
manifest
|
50
43
|
end
|
51
44
|
|
52
45
|
# Load bundles for js and css
|
53
46
|
def self.load_bundle(type)
|
54
|
-
#
|
55
|
-
|
56
|
-
|
57
|
-
# Get the max modified date and the keys
|
58
|
-
max, keys = a.map{|r| r.modified}.max, a.map{|r| r.key}.join
|
47
|
+
# Find keys for the cache key (digest)
|
48
|
+
keys = ::Asset.manifest.select{|r| r.type == type}.map(&:key).join
|
59
49
|
|
60
50
|
# Insert the bundle into the manifest
|
61
|
-
::Asset.manifest.insert(0, ::Asset::Item.new("bundle.#{type}", type, digest(keys),
|
51
|
+
::Asset.manifest.insert(0, ::Asset::Item.new("bundle.#{type}", type, digest(keys), Time.now.utc))
|
62
52
|
end
|
63
53
|
|
64
54
|
# Load images into memory
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fugroup Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|