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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 221114d9a95c40764d02f786475739c0d97d5c79
4
- data.tar.gz: a69c298b432e604e46fa502fadffb16ae2097eb9
3
+ metadata.gz: 0d3b1aa6fbb858cc24a4ec18c547d42e546b6b3f
4
+ data.tar.gz: 3bc383c404685b5d9ee40256fb7f48173955b1d1
5
5
  SHA512:
6
- metadata.gz: 086713340ee8435820e4ca1c1fae36ad9002cca30f7f7cf27967c37657c3c56003cba63cbbe71fef185bb62ec6ab9ecb0114ba794505ca235e9b1ece485bc51f
7
- data.tar.gz: d7b1be90668b397a9f98f7208607f70be651bc1aacc4962fad690939d6d1abf79a6bf3215eb0e7ac5b50c787028d08c65985457cb49d97263ab58ca1baf3d0f2
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
- content += Dominate::HTML.load_file "#{path}/#{file}"
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
@@ -18,7 +18,7 @@ module Dominate
18
18
  def load_html
19
19
  load_layout if config.layout
20
20
 
21
- inner_html = doc.inner_html
21
+ inner_html = doc.to_s
22
22
 
23
23
  updated_html = inner_html.gsub(PARTIAL_REGEX_WITHIN) do |m|
24
24
  match = m.strip.match(PARTIAL_REGEX)
@@ -4,7 +4,9 @@ module Dominate
4
4
  module HTML
5
5
  extend self
6
6
 
7
- STATIC_TYPES = %w(html js css eot woff ttf svg)
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
- c[:moo] = 'cow'
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
- }.render instance, c.to_h
68
+ }
66
69
 
67
- html
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
@@ -1,3 +1,3 @@
1
1
  module Dominate
2
- VERSION = "0.9.2"
2
+ VERSION = "0.10.0"
3
3
  end
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.9.2
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-10 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri