asset 0.1.10 → 0.1.11
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 +4 -4
- data/CHANGELOG.md +5 -1
- data/asset.gemspec +2 -2
- data/lib/assets/router.rb +2 -3
- data/lib/assets/util.rb +16 -13
- 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: 90fde4e9a5059373b6ef73bda578b175b836926f
|
4
|
+
data.tar.gz: 84e13b7340c9056da1b4751009ae0d2af6c42be8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2129596f7a05b2f64f047b37e329da0924fcc4ceb629bf49bc43de4a4bb7e5b98ff6f5a43a68aff5fc0d30d855ab24891edd248ed06aa44f31e180d78e2e24f
|
7
|
+
data.tar.gz: 25b0ed903309dc2da7c5a16ae40facbdf8fd532f81adc4de29de49cf8ce3e076f2755da85607d9e99eb038a3888e3bc2ebafd1e6a820d07be34984c58d8461f1
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
**Version 0.1.11** - *2017-01-25*
|
2
|
+
|
3
|
+
- Assets and images now follow symlinks
|
4
|
+
|
1
5
|
**Version 0.1.10** - *2017-01-22*
|
2
6
|
|
3
|
-
- Included rubyracer as dependency, fixed Uglifier
|
7
|
+
- Included rubyracer as dependency, fixed Uglifier now working
|
4
8
|
- Refactored router, now 404 only if item not found
|
5
9
|
|
6
10
|
**Version 0.1.9** - *2017-01-19*
|
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.11'
|
4
|
+
s.date = '2017-01-25'
|
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/router.rb
CHANGED
@@ -24,9 +24,8 @@ module Asset
|
|
24
24
|
# Extract type and path
|
25
25
|
type, path = $2, $3
|
26
26
|
|
27
|
-
# Extract digest key
|
28
|
-
path =~ /-([a-f0-9]{32})\.(css|js)$/
|
29
|
-
path.gsub!("-#{@key}", '') if (@key = $1)
|
27
|
+
# Extract digest key and remove from path
|
28
|
+
path.gsub!("-#{@key = $1}", '') if path =~ /-([a-f0-9]{32})\.(css|js)$/
|
30
29
|
|
31
30
|
# Find the item
|
32
31
|
item = ::Asset.manifest.find{|i| i.path == path and i.type == type}
|
data/lib/assets/util.rb
CHANGED
@@ -6,6 +6,9 @@ module Asset
|
|
6
6
|
# Load the manifest
|
7
7
|
::Asset.manifest = load_manifest
|
8
8
|
|
9
|
+
# Insert bundles
|
10
|
+
%w[css js].each{|type| load_bundle(type)}
|
11
|
+
|
9
12
|
# Load the bundle
|
10
13
|
::Asset.bundle = YAML.load_file(File.join(::Asset.path, 'manifest.yml'))
|
11
14
|
|
@@ -31,11 +34,11 @@ module Asset
|
|
31
34
|
# Load manifest
|
32
35
|
def self.load_manifest
|
33
36
|
manifest = []
|
34
|
-
|
37
|
+
|
38
|
+
Dir["#{Asset.path}/{css,js}/**{,/*/**}/*.{css,js}"].each do |file|
|
35
39
|
# Extract type and name
|
36
40
|
file =~ /(js|css)\/(.+)$/; type, name = $1, $2
|
37
41
|
|
38
|
-
# Get the modified time
|
39
42
|
# Get the modified time of the asset
|
40
43
|
modified = mtime("#{type}/#{name}")
|
41
44
|
|
@@ -43,25 +46,25 @@ module Asset
|
|
43
46
|
manifest << ::Asset::Item.new(name, type, digest(File.read(file)), modified)
|
44
47
|
end
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
manifest
|
50
|
+
end
|
51
|
+
|
52
|
+
# Load bundles for js and css
|
53
|
+
def self.load_bundle(type)
|
54
|
+
# Insert the bundle
|
55
|
+
a = ::Asset.manifest.select{|r| r.type == type}
|
51
56
|
|
52
|
-
# Insert the js bundle
|
53
|
-
js = manifest.select{|r| r.type == 'js'}
|
54
57
|
# Get the max modified date and the keys
|
55
|
-
max, keys =
|
56
|
-
manifest.insert(0, ::Asset::Item.new('bundle.js', 'js', digest(keys), max))
|
58
|
+
max, keys = a.map{|r| r.modified}.max, a.map{|r| r.key}.join
|
57
59
|
|
58
|
-
manifest
|
60
|
+
# Insert the bundle into the manifest
|
61
|
+
::Asset.manifest.insert(0, ::Asset::Item.new("bundle.#{type}", type, digest(keys), max))
|
59
62
|
end
|
60
63
|
|
61
64
|
# Load images into memory
|
62
65
|
def self.load_images
|
63
66
|
# Store the path and the timestamp
|
64
|
-
images = Dir["#{::Asset.path}/images
|
67
|
+
images = Dir["#{::Asset.path}/images/**{,/*/**}/*.*"].map do |i|
|
65
68
|
i =~ /\/images\/(.+)/; [$1, mtime("images/#{$1}").to_i]
|
66
69
|
end
|
67
70
|
Hash[*images.flatten]
|
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.11
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|