docomo_css 0.4.8 → 0.5.0
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 +7 -0
- data/.gitignore +21 -3
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.rdoc +7 -2
- data/Rakefile +5 -20
- data/docomo_css.gemspec +24 -18
- data/lib/docomo_css/embeddable_style.rb +1 -1
- data/lib/docomo_css/filter.rb +23 -12
- data/lib/docomo_css/stylesheet.rb +26 -0
- data/lib/docomo_css/version.rb +1 -1
- data/test/actual_asset.html +13 -0
- data/test/docomo_css/emeddable_style_test.rb +1 -2
- data/test/docomo_css/filter_test.rb +64 -8
- data/test/docomo_css/stylesheet_test.rb +19 -1
- data/test/expected.html +3 -4
- data/test/expected_no_declare.html +24 -0
- data/test/test_helper.rb +14 -4
- metadata +131 -87
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bfca21448e7021dbccf54bc10426dd6e7430bdf5
|
4
|
+
data.tar.gz: 0a8cde4bdabec667c3e3e96d89fa9a8057f17512
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d7b67cede6bca882341d7057dca01213e4369444ebf645e44c6854c49e821165a68fa6fd838428979fd970a596dc229dd3427e14cf597e2f2223e233bf0e9cb0
|
7
|
+
data.tar.gz: 434b078bd45330d96c385f918ac15df63785019f75461521076c59c644f64bc262377dd9e0657264bd4d1316d09728b8fe5816141ba13ff381b38ec1c6802ba9
|
data/.gitignore
CHANGED
@@ -1,4 +1,22 @@
|
|
1
|
-
*.swp
|
2
|
-
pkg/*
|
3
|
-
rdoc/*
|
4
1
|
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= DocomoCss
|
1
|
+
= DocomoCss {<img src="https://travis-ci.org/milk1000cc/docomo_css.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/milk1000cc/docomo_css]
|
2
2
|
|
3
3
|
docomo_css is a CSS in-liner.
|
4
4
|
|
@@ -32,7 +32,7 @@ so you don't need to change any styling. If you were doing this manually before
|
|
32
32
|
== Requirements
|
33
33
|
|
34
34
|
* libxml 2.7 or later is required
|
35
|
-
* Rails 3
|
35
|
+
* Rails 3 or later
|
36
36
|
|
37
37
|
== Usage
|
38
38
|
|
@@ -67,6 +67,11 @@ so you don't need to change any styling. If you were doing this manually before
|
|
67
67
|
</body>
|
68
68
|
</html>
|
69
69
|
|
70
|
+
Options for the value of this docomo_css are
|
71
|
+
|
72
|
+
* mobile - always transform css when content type is application/xhtml+xml, default false
|
73
|
+
* xml_declare - add xml declaration, default true
|
74
|
+
|
70
75
|
== Author
|
71
76
|
|
72
77
|
Copyright (c) 2008 milk1000cc, released under the MIT license
|
data/Rakefile
CHANGED
@@ -1,24 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
Bundler::GemHelper.install_tasks
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
5
3
|
|
6
|
-
desc 'Default: run unit tests.'
|
7
|
-
task :default => :test
|
8
|
-
|
9
|
-
desc 'Test the docomo_css plugin.'
|
10
4
|
Rake::TestTask.new(:test) do |t|
|
11
|
-
t.libs <<
|
12
|
-
t.
|
13
|
-
t.pattern = 'test/**/*_test.rb'
|
14
|
-
t.verbose = true
|
5
|
+
t.libs << "test"
|
6
|
+
t.test_files = FileList['test/**/*_test.rb']
|
15
7
|
end
|
16
8
|
|
17
|
-
|
18
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
19
|
-
rdoc.rdoc_dir = 'rdoc'
|
20
|
-
rdoc.title = 'DocomoCss'
|
21
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
22
|
-
rdoc.rdoc_files.include('README.rdoc')
|
23
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
24
|
-
end
|
9
|
+
task :default => :test
|
data/docomo_css.gemspec
CHANGED
@@ -1,23 +1,29 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'docomo_css/version'
|
3
5
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "docomo_css"
|
8
|
+
spec.version = DocomoCss::VERSION
|
9
|
+
spec.authors = ["milk1000cc", "Paul McMahon"]
|
10
|
+
spec.email = ["info@milk1000.cc"]
|
11
|
+
spec.summary = %q{CSS inliner}
|
12
|
+
spec.description = %q{Inlines CSS so that you can use external CSS with docomo handsets.}
|
13
|
+
spec.homepage = "https://github.com/milk1000cc/docomo_css"
|
14
|
+
spec.license = "MIT"
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
17
20
|
|
18
|
-
|
21
|
+
spec.add_dependency "nokogiri"
|
22
|
+
spec.add_dependency "tiny_css"
|
23
|
+
spec.add_dependency "rails"
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "minitest"
|
28
|
+
spec.add_development_dependency "mocha"
|
23
29
|
end
|
@@ -22,7 +22,7 @@ module DocomoCss
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def inject_unsupported_styles(style)
|
25
|
-
if /^(h\d|p)$/ =~ name
|
25
|
+
if /^(h\d|p)$/ =~ name
|
26
26
|
if (h = style.split('color', 'font-size')) && !h.empty? && !children.empty?
|
27
27
|
children.wrap('<span>')
|
28
28
|
children.first.merge_style h
|
data/lib/docomo_css/filter.rb
CHANGED
@@ -6,16 +6,18 @@ require 'tiny_css'
|
|
6
6
|
module DocomoCss
|
7
7
|
class Filter
|
8
8
|
def initialize(options = {})
|
9
|
-
@options = options
|
9
|
+
@options = { :xml_declare => true, :mobile => false }.merge(options)
|
10
10
|
end
|
11
11
|
|
12
12
|
def after(controller)
|
13
13
|
return unless controller.response.content_type =~ /application\/xhtml\+xml/
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
unless @options[:mobile]
|
15
|
+
return unless controller.request.user_agent =~ /docomo/i
|
16
|
+
return if docomo_2_0_browser?(controller)
|
17
|
+
end
|
18
|
+
body = escape_character_reference controller.response.body
|
17
19
|
body = embed_css remove_xml_declare(body)
|
18
|
-
controller.response.body =
|
20
|
+
controller.response.body = unescape_character_reference body
|
19
21
|
end
|
20
22
|
|
21
23
|
def embed_css(body)
|
@@ -29,12 +31,21 @@ module DocomoCss
|
|
29
31
|
stylesheet_link_node(doc).each do |linknode|
|
30
32
|
linknode.unlink
|
31
33
|
stylesheet = DocomoCss::Stylesheet.new(linknode['href'])
|
32
|
-
|
33
|
-
|
34
|
+
if stylesheet.valid?
|
35
|
+
css = TinyCss.new.read(stylesheet.path)
|
36
|
+
else
|
37
|
+
css = stylesheet.asset_css
|
38
|
+
next unless css
|
39
|
+
css = TinyCss.new.read_string(css)
|
40
|
+
end
|
34
41
|
embed_pseudo_style(doc, extract_pseudo_style(css))
|
35
42
|
embed_style(doc, css)
|
36
43
|
end
|
37
|
-
|
44
|
+
|
45
|
+
result = ''
|
46
|
+
result << xml_declare(doc) if @options[:xml_declare]
|
47
|
+
result << doc.to_xhtml(:indent => 0, :encoding => doc.encoding)
|
48
|
+
result
|
38
49
|
end
|
39
50
|
|
40
51
|
def xml_declare(doc)
|
@@ -55,12 +66,12 @@ module DocomoCss
|
|
55
66
|
end
|
56
67
|
end
|
57
68
|
|
58
|
-
def
|
59
|
-
text.gsub
|
69
|
+
def escape_character_reference(text)
|
70
|
+
text.gsub /&(#?[\da-zA-Z]+);/, 'HTMLCSSINLINERESCAPE\1::::::::'
|
60
71
|
end
|
61
72
|
|
62
|
-
def
|
63
|
-
text.gsub /HTMLCSSINLINERESCAPE(
|
73
|
+
def unescape_character_reference(text)
|
74
|
+
text.gsub /HTMLCSSINLINERESCAPE(#?[\da-zA-Z]+)::::::::/, '&\1;'
|
64
75
|
end
|
65
76
|
|
66
77
|
def stylesheet_link_node(document)
|
@@ -3,6 +3,7 @@ module DocomoCss
|
|
3
3
|
attr_reader :path
|
4
4
|
|
5
5
|
def initialize(href)
|
6
|
+
@href = href
|
6
7
|
@path = href && path_from_href(href)
|
7
8
|
end
|
8
9
|
|
@@ -10,6 +11,18 @@ module DocomoCss
|
|
10
11
|
path && FileTest.exist?(path)
|
11
12
|
end
|
12
13
|
|
14
|
+
def asset_css
|
15
|
+
return nil unless Rails.application.config.assets.prefix
|
16
|
+
|
17
|
+
path, query = extract_path_and_query(@href)
|
18
|
+
path = path.sub(/^#{ Rails.application.config.assets.prefix }/, '').
|
19
|
+
sub(/^\//, '')
|
20
|
+
|
21
|
+
asset = Rails.application.assets.
|
22
|
+
find_asset(path, :bundle => !body_only?(query))
|
23
|
+
asset ? asset.to_s : nil
|
24
|
+
end
|
25
|
+
|
13
26
|
private
|
14
27
|
|
15
28
|
def path_from_href(href)
|
@@ -17,5 +30,18 @@ module DocomoCss
|
|
17
30
|
gsub(/\?\d+/, '')
|
18
31
|
File.join(Rails.root, 'public', base_path)
|
19
32
|
end
|
33
|
+
|
34
|
+
def extract_path_and_query(href)
|
35
|
+
if href =~ /(.+)\?(.+)/
|
36
|
+
path, query = $1, $2
|
37
|
+
else
|
38
|
+
path, query = href, ''
|
39
|
+
end
|
40
|
+
[path, query]
|
41
|
+
end
|
42
|
+
|
43
|
+
def body_only?(query)
|
44
|
+
query =~ /body=(1|t)/
|
45
|
+
end
|
20
46
|
end
|
21
47
|
end
|
data/lib/docomo_css/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="Shift_JIS"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.3) 1.0//EN" "i-xhtml_4ja_10.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=Shift_JIS" />
|
6
|
+
<link rel="stylesheet" href="/assets/actual.css?body=1" />
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div class="content">
|
10
|
+
<a href="/">TOP</a>
|
11
|
+
</div>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'tiny_css'
|
3
2
|
require File.join File.dirname(__FILE__), '..', '..', 'lib', 'docomo_css', 'embeddable_style'
|
4
3
|
|
5
|
-
class DocomoCss::EmbeddableStyleTest < Test
|
4
|
+
class DocomoCss::EmbeddableStyleTest < MiniTest::Test
|
6
5
|
|
7
6
|
def test_embed_style_in_div
|
8
7
|
doc = Nokogiri::HTML("<div>")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require File.join File.dirname(__FILE__), '..', '..', 'lib', 'docomo_css', 'filter'
|
3
3
|
|
4
|
-
class DocomoCss::FilterTest < Test
|
4
|
+
class DocomoCss::FilterTest < MiniTest::Test
|
5
5
|
def setup
|
6
6
|
@filter = DocomoCss::Filter.new
|
7
7
|
end
|
@@ -15,14 +15,16 @@ class DocomoCss::FilterTest < Test::Unit::TestCase
|
|
15
15
|
@filter.after(controller)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
assert_equal "
|
20
|
-
assert_equal "
|
18
|
+
def test_escape_character_reference
|
19
|
+
assert_equal "HTMLCSSINLINERESCAPE#123456789::::::::", @filter.escape_character_reference("�")
|
20
|
+
assert_equal "HTMLCSSINLINERESCAPE#x123def::::::::", @filter.escape_character_reference("�")
|
21
|
+
assert_equal "HTMLCSSINLINERESCAPEnbsp::::::::", @filter.escape_character_reference(" ")
|
21
22
|
end
|
22
23
|
|
23
|
-
def
|
24
|
-
assert_equal "�", @filter.
|
25
|
-
assert_equal "�", @filter.
|
24
|
+
def test_unescape_character_reference
|
25
|
+
assert_equal "�", @filter.unescape_character_reference("HTMLCSSINLINERESCAPE#123456789::::::::")
|
26
|
+
assert_equal "�", @filter.unescape_character_reference("HTMLCSSINLINERESCAPE#x123def::::::::")
|
27
|
+
assert_equal " ", @filter.unescape_character_reference("HTMLCSSINLINERESCAPEnbsp::::::::")
|
26
28
|
end
|
27
29
|
|
28
30
|
def test_pseudo_selectors
|
@@ -87,7 +89,7 @@ a:visited { color: blue; }
|
|
87
89
|
<body></body>
|
88
90
|
</html>
|
89
91
|
HTML
|
90
|
-
|
92
|
+
assert_raises RuntimeError do
|
91
93
|
@filter.embed_pseudo_style doc, css
|
92
94
|
end
|
93
95
|
end
|
@@ -191,6 +193,59 @@ a:visited { color: blue; }
|
|
191
193
|
@filter.after(controller)
|
192
194
|
end
|
193
195
|
|
196
|
+
def test_output_when_mobile_option_is_true_and_content_type_is_xhtml
|
197
|
+
request = stub('request')
|
198
|
+
response = stub("response") do
|
199
|
+
expects(:content_type).returns('application/xhtml+xml')
|
200
|
+
expects(:body).returns(File.open(File.join(File.dirname(__FILE__), '../actual.html'), 'rb'){ |f| f.read })
|
201
|
+
expects(:body=).with(File.open(File.join(File.dirname(__FILE__), '../expected.html'), 'rb'){ |f| f.read })
|
202
|
+
end
|
203
|
+
controller = stub("controller", :response => response, :request => request)
|
204
|
+
|
205
|
+
@filter = DocomoCss::Filter.new(mobile: true)
|
206
|
+
@filter.after(controller)
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_output_when_mobile_option_is_true_and_content_type_is_html
|
210
|
+
request = stub('request')
|
211
|
+
response = stub("response") do
|
212
|
+
expects(:content_type).returns('text/html')
|
213
|
+
expects(:body).never
|
214
|
+
end
|
215
|
+
controller = stub("controller", :response => response, :request => request)
|
216
|
+
|
217
|
+
@filter = DocomoCss::Filter.new(mobile: true)
|
218
|
+
@filter.after(controller)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_output_when_xml_declare_option_is_false
|
222
|
+
request = stub('request', :user_agent => 'DoCoMo/2.0 D905i(c100;TB;W24H17)')
|
223
|
+
response = stub("response") do
|
224
|
+
expects(:content_type).returns('application/xhtml+xml')
|
225
|
+
expects(:body).returns(File.open(File.join(File.dirname(__FILE__), '../actual.html'), 'rb'){ |f| f.read })
|
226
|
+
expects(:body=).with(File.open(File.join(File.dirname(__FILE__), '../expected_no_declare.html'), 'rb'){ |f| f.read })
|
227
|
+
end
|
228
|
+
controller = stub("controller", :response => response, :request => request)
|
229
|
+
|
230
|
+
@filter = DocomoCss::Filter.new(xml_declare: false)
|
231
|
+
@filter.after(controller)
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_asset_pipeline
|
235
|
+
css = open(File.expand_path('../public/actual.css', __dir__)) { |f| f.read }
|
236
|
+
mock_asset 'actual.css', false, css
|
237
|
+
|
238
|
+
request = stub('request', :user_agent => 'DoCoMo/2.0 D905i(c100;TB;W24H17)')
|
239
|
+
response = stub("response") do
|
240
|
+
expects(:content_type).returns('application/xhtml+xml')
|
241
|
+
expects(:body).returns(File.open(File.join(File.dirname(__FILE__), '../actual_asset.html'), 'rb'){ |f| f.read })
|
242
|
+
expects(:body=).with(File.open(File.join(File.dirname(__FILE__), '../expected.html'), 'rb'){ |f| f.read })
|
243
|
+
end
|
244
|
+
controller = stub("controller", :response => response, :request => request)
|
245
|
+
|
246
|
+
@filter.after(controller)
|
247
|
+
end
|
248
|
+
|
194
249
|
def test_embed_css_detects_missing_character_encoding
|
195
250
|
xml = <<-EOD
|
196
251
|
<?xml version='1.0' encoding='utf-8' ?>
|
@@ -203,6 +258,7 @@ a:visited { color: blue; }
|
|
203
258
|
</body>
|
204
259
|
</html>
|
205
260
|
EOD
|
261
|
+
xml.force_encoding 'ASCII-8BIT'
|
206
262
|
encoded_body = @filter.embed_css(xml)
|
207
263
|
assert_match "ほげ", encoded_body
|
208
264
|
assert_match '<meta content="application/xhtml+xml;charset=UTF-8" http-equiv="content-type" />', encoded_body
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require File.join File.dirname(__FILE__), '..', '..', 'lib', 'docomo_css', 'stylesheet'
|
3
3
|
|
4
|
-
class DocomoCss::StylesheetTest < Test
|
4
|
+
class DocomoCss::StylesheetTest < MiniTest::Test
|
5
5
|
def test_css_path
|
6
6
|
ActionController::Base.stubs(:asset_host => nil)
|
7
7
|
href = "/stylesheets/all.css?1274411517"
|
@@ -21,4 +21,22 @@ class DocomoCss::StylesheetTest < Test::Unit::TestCase
|
|
21
21
|
assert !DocomoCss::Stylesheet.new("/all.css?1274411517").valid?
|
22
22
|
assert DocomoCss::Stylesheet.new("/actual.css?1274411517").valid?
|
23
23
|
end
|
24
|
+
|
25
|
+
def test_asset_css
|
26
|
+
css = "div.content { background-color: #999 }"
|
27
|
+
mock_asset 'mobile/application.css', false, css
|
28
|
+
|
29
|
+
href = "/assets/mobile/application.css?body=1"
|
30
|
+
stylesheet = DocomoCss::Stylesheet.new(href)
|
31
|
+
assert_equal css, stylesheet.asset_css
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_asset_css_without_body_param
|
35
|
+
css = "div.content { background-color: #999 }"
|
36
|
+
mock_asset 'mobile/application.css', true, css
|
37
|
+
|
38
|
+
href = "/assets/mobile/application.css"
|
39
|
+
stylesheet = DocomoCss::Stylesheet.new(href)
|
40
|
+
assert_equal css, stylesheet.asset_css
|
41
|
+
end
|
24
42
|
end
|
data/test/expected.html
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=Shift_JIS" />
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
<style type="text/css"><![CDATA[
|
8
8
|
a:visited {
|
9
9
|
color: blue;
|
10
10
|
}
|
@@ -15,8 +15,7 @@ a:focus {
|
|
15
15
|
color: green;
|
16
16
|
}
|
17
17
|
|
18
|
-
]]>
|
19
|
-
</style>
|
18
|
+
]]></style>
|
20
19
|
</head>
|
21
20
|
<body>
|
22
21
|
<div class="content" style="background-color:#999">
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.3) 1.0//EN" "i-xhtml_4ja_10.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=Shift_JIS" />
|
5
|
+
|
6
|
+
<style type="text/css"><![CDATA[
|
7
|
+
a:visited {
|
8
|
+
color: blue;
|
9
|
+
}
|
10
|
+
a:link {
|
11
|
+
color: red;
|
12
|
+
}
|
13
|
+
a:focus {
|
14
|
+
color: green;
|
15
|
+
}
|
16
|
+
|
17
|
+
]]></style>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div class="content" style="background-color:#999">
|
21
|
+
<a href="/">TOP</a>
|
22
|
+
</div>
|
23
|
+
</body>
|
24
|
+
</html>
|
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,21 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'mocha'
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'mocha/mini_test'
|
4
3
|
|
5
4
|
Rails = Mocha::Mockery.instance.unnamed_mock
|
6
|
-
Rails.stubs(
|
5
|
+
Rails.stubs(
|
6
|
+
:root => File.dirname(__FILE__),
|
7
|
+
:application => Mocha::Mockery.instance.unnamed_mock)
|
7
8
|
|
8
9
|
module ActionController
|
9
10
|
Base = Mocha::Mockery.instance.unnamed_mock
|
10
11
|
Base.stubs(:asset_host => nil)
|
11
12
|
end
|
13
|
+
|
14
|
+
def mock_asset(path, bundle, css)
|
15
|
+
config = stub('config', :assets => stub('assets_conf', :prefix => '/assets'))
|
16
|
+
asset = stub('asset', to_s: css)
|
17
|
+
assets = stub('assets') do
|
18
|
+
expects(:find_asset).with(path, :bundle => bundle).returns(asset)
|
19
|
+
end
|
20
|
+
Rails.application.stubs :assets => assets, :config => config
|
21
|
+
end
|
metadata
CHANGED
@@ -1,80 +1,124 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: docomo_css
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 8
|
10
|
-
version: 0.4.8
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- milk1000cc
|
14
8
|
- Paul McMahon
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: nokogiri
|
24
|
-
|
25
|
-
|
26
|
-
none: false
|
27
|
-
requirements:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
28
18
|
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
34
21
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: tiny_css
|
38
22
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: tiny_css
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
50
35
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rails
|
54
36
|
prerelease: false
|
55
|
-
|
56
|
-
|
57
|
-
requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
58
39
|
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rails
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
66
49
|
type: :runtime
|
67
|
-
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: bundler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.6'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.6'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: minitest
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: mocha
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
68
112
|
description: Inlines CSS so that you can use external CSS with docomo handsets.
|
69
|
-
email:
|
113
|
+
email:
|
114
|
+
- info@milk1000.cc
|
70
115
|
executables: []
|
71
|
-
|
72
116
|
extensions: []
|
73
|
-
|
74
117
|
extra_rdoc_files: []
|
75
|
-
|
76
|
-
|
77
|
-
- .
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
78
122
|
- MIT-LICENSE
|
79
123
|
- README.rdoc
|
80
124
|
- Rakefile
|
@@ -86,45 +130,45 @@ files:
|
|
86
130
|
- lib/docomo_css/stylesheet.rb
|
87
131
|
- lib/docomo_css/version.rb
|
88
132
|
- test/actual.html
|
133
|
+
- test/actual_asset.html
|
89
134
|
- test/docomo_css/emeddable_style_test.rb
|
90
135
|
- test/docomo_css/filter_test.rb
|
91
136
|
- test/docomo_css/stylesheet_test.rb
|
92
137
|
- test/expected.html
|
138
|
+
- test/expected_no_declare.html
|
93
139
|
- test/public/actual.css
|
94
140
|
- test/test_helper.rb
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
141
|
+
homepage: https://github.com/milk1000cc/docomo_css
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata: {}
|
99
145
|
post_install_message:
|
100
|
-
rdoc_options:
|
101
|
-
|
102
|
-
require_paths:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
103
148
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
|
106
|
-
requirements:
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
107
151
|
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
version: "0"
|
113
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
|
-
requirements:
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
116
156
|
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
segments:
|
120
|
-
- 0
|
121
|
-
version: "0"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
122
159
|
requirements: []
|
123
|
-
|
124
|
-
|
125
|
-
rubygems_version: 1.3.7
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 2.2.2
|
126
162
|
signing_key:
|
127
|
-
specification_version:
|
163
|
+
specification_version: 4
|
128
164
|
summary: CSS inliner
|
129
|
-
test_files:
|
130
|
-
|
165
|
+
test_files:
|
166
|
+
- test/actual.html
|
167
|
+
- test/actual_asset.html
|
168
|
+
- test/docomo_css/emeddable_style_test.rb
|
169
|
+
- test/docomo_css/filter_test.rb
|
170
|
+
- test/docomo_css/stylesheet_test.rb
|
171
|
+
- test/expected.html
|
172
|
+
- test/expected_no_declare.html
|
173
|
+
- test/public/actual.css
|
174
|
+
- test/test_helper.rb
|