dominate 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +7 -4
- data/lib/dominate/assets/middleware.rb +8 -2
- data/lib/dominate/dom.rb +1 -1
- data/lib/dominate/html.rb +12 -5
- data/lib/dominate/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: 0d3b1aa6fbb858cc24a4ec18c547d42e546b6b3f
|
4
|
+
data.tar.gz: 3bc383c404685b5d9ee40256fb7f48173955b1d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b9bc7d8bfea1378e6fa9d7c1d45fa4018c84ba4127ea3d297df2293579154cf09700784d6a33dd5349a009b2195309996ea81f8a6578214207f389f32d6307
|
7
|
+
data.tar.gz: 68d92c99a94802ceb21ee260be6e0ed1d77c6d9bbc801e88db3dcc82b6d55fd74b13a9bc80c3022bb22d0fea8d7c8ecb26be85081dd8ab5d502c02c0a7d81b4e
|
data/Makefile
CHANGED
@@ -14,10 +14,10 @@ define install_bs
|
|
14
14
|
echo 'RACK_ENV=development' >> .env; \
|
15
15
|
fi;
|
16
16
|
|
17
|
-
bs gem install dep
|
18
|
-
bs gem install cutest-cj
|
19
|
-
bs gem install pry
|
20
|
-
bs gem install awesome_print
|
17
|
+
bs gem list dep-cj -i || gem install dep-cj
|
18
|
+
bs gem list cutest -i || gem install cutest-cj
|
19
|
+
bs gem list pry -i || gem install pry
|
20
|
+
bs gem list awesome_print -i || bs gem install awesome_print
|
21
21
|
endef
|
22
22
|
|
23
23
|
install:
|
@@ -26,3 +26,6 @@ install:
|
|
26
26
|
|
27
27
|
test:
|
28
28
|
bs env $$(cat .env.test) cutest test/**/*_test.rb
|
29
|
+
|
30
|
+
compile:
|
31
|
+
bs env $$(cat .env.test) ruby -e "require './app'"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rack/mime'
|
2
|
+
require 'open-uri'
|
2
3
|
|
3
4
|
module Dominate
|
4
5
|
module Assets
|
@@ -87,7 +88,8 @@ module Dominate
|
|
87
88
|
"Cache-Control" => 'public, max-age=2592000, no-transform',
|
88
89
|
'Connection' => 'keep-alive',
|
89
90
|
'Age' => '25637',
|
90
|
-
'Strict-Transport-Security' => 'max-age=31536000'
|
91
|
+
'Strict-Transport-Security' => 'max-age=31536000',
|
92
|
+
'Content-Disposition' => 'inline'
|
91
93
|
})
|
92
94
|
|
93
95
|
if name == "all-#{sha}"
|
@@ -108,7 +110,11 @@ module Dominate
|
|
108
110
|
path = "#{Dominate.config.asset_path}/#{type}"
|
109
111
|
|
110
112
|
files.each do |file|
|
111
|
-
|
113
|
+
if file[/^http/]
|
114
|
+
content += open(file).string
|
115
|
+
else
|
116
|
+
content += Dominate::HTML.load_file("#{path}/#{file}")
|
117
|
+
end
|
112
118
|
end
|
113
119
|
|
114
120
|
content
|
data/lib/dominate/dom.rb
CHANGED
data/lib/dominate/html.rb
CHANGED
@@ -4,7 +4,9 @@ module Dominate
|
|
4
4
|
module HTML
|
5
5
|
extend self
|
6
6
|
|
7
|
-
|
7
|
+
IMAGE_TYPES = %w(png gif jpg jpeg)
|
8
|
+
FONT_TYPES = %w(eot woff ttf svg)
|
9
|
+
STATIC_TYPES = %w(html js css map)
|
8
10
|
VIEW_TYPES = %w(html slim haml erb md markdown mkd mab)
|
9
11
|
|
10
12
|
|
@@ -31,8 +33,7 @@ module Dominate
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def load_file path, c = {}, instance = self
|
34
|
-
|
35
|
-
html = _cache.fetch(path) {
|
36
|
+
cache = _cache.fetch(path) {
|
36
37
|
template = false
|
37
38
|
|
38
39
|
ext = path[/\.[^.]*$/][1..-1]
|
@@ -42,6 +43,8 @@ module Dominate
|
|
42
43
|
template = Tilt::PlainTemplate.new nil, 1, outvar: '@_output', default_encoding: 'UTF-8' do |t|
|
43
44
|
File.read(path)
|
44
45
|
end
|
46
|
+
elsif FONT_TYPES.include?(ext) || IMAGE_TYPES.include?(ext)
|
47
|
+
template = File.read path
|
45
48
|
else
|
46
49
|
template = Tilt.new path, 1, outvar: '@_output'
|
47
50
|
end
|
@@ -62,9 +65,13 @@ module Dominate
|
|
62
65
|
end
|
63
66
|
|
64
67
|
template
|
65
|
-
}
|
68
|
+
}
|
66
69
|
|
67
|
-
|
70
|
+
if defined? cache.render
|
71
|
+
cache.render instance, c.to_h
|
72
|
+
else
|
73
|
+
cache.to_s
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
private
|
data/lib/dominate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dominate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|