emcee 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/emcee/document.rb +24 -21
- data/lib/emcee/node.rb +37 -0
- data/lib/emcee/processors/import_processor.rb +1 -5
- data/lib/emcee/processors/script_processor.rb +2 -7
- data/lib/emcee/processors/stylesheet_processor.rb +2 -7
- data/lib/emcee/resolver.rb +10 -2
- data/lib/emcee/version.rb +1 -1
- data/test/document_test.rb +9 -38
- data/test/dummy/log/development.log +0 -568
- data/test/dummy/log/test.log +1427 -118922
- data/test/dummy/tmp/cache/assets/test/sass/2505765e5337e60c61ad37feba05eaa8ae47b342/test.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/0130956d872089cd4fa2d57c1575a980 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/069d8fd6c288adff1fb286d0d6c21606 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/108bf05a6850b381294db898334ef67d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1b7d7e2b19107a97fe8848cf58c57a54 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1d7a60187eaded08c39d01faf8a23419 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2a5f4dce58244bf7ff11dbe3d7afc515 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/458351c9b3b38136f089d00567fa2ab9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/55ed67200221237d737e680c44d26a53 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/647c67d866fa7e8f94434810d4e2b4d2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/68469204e225a843ed6724382c3fe5f1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8391c1e1d3c4665ea42bedc592a7061a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8865b0f9494de13cdba1654429db7211 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/88d5d991418d69ace2337e9eadebd140 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/97b8f5f4c23ddfb02a3af691907e15bc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b531ab2f17b1bd7ad78ebb395c4730bb +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d3aec885f7ac739563d30835e6866b48 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d62af6048f647d62782174dfb26e302c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e0561b1cebd62df57d5d6ac9d2b23033 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f16d30b33e206690649697e498a2f1a8 +0 -0
- data/test/node_test.rb +32 -0
- data/test/processors_test.rb +11 -23
- data/test/resolver_test.rb +9 -13
- metadata +6 -6
- data/test/dummy/db/development.sqlite3 +0 -0
data/test/dummy/tmp/cache/assets/test/sass/2505765e5337e60c61ad37feba05eaa8ae47b342/test.scssc
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/node_test.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'emcee/node.rb'
|
3
|
+
|
4
|
+
class NodeTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@body = "<link rel=\"stylesheet\" href=\"test.css\">"
|
7
|
+
@document = Nokogiri::HTML.fragment(@body)
|
8
|
+
@parser_node = @document.children.first
|
9
|
+
@node = Emcee::Node.new(@parser_node)
|
10
|
+
end
|
11
|
+
|
12
|
+
test "should have path" do
|
13
|
+
assert_equal "test.css", @node.path.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
test "should remove itself" do
|
17
|
+
@node.remove
|
18
|
+
assert_equal 0, @document.children.length
|
19
|
+
end
|
20
|
+
|
21
|
+
test "can be replaced by a <style>" do
|
22
|
+
new_content = "/* test */"
|
23
|
+
@node.replace("style", new_content)
|
24
|
+
assert_equal "<style>/* test */</style>", @document.to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
test "can be replaced by a <script>" do
|
28
|
+
new_content = "/* test */"
|
29
|
+
@node.replace("script", new_content)
|
30
|
+
assert_equal "<script>/* test */</script>", @document.to_s
|
31
|
+
end
|
32
|
+
end
|
data/test/processors_test.rb
CHANGED
@@ -9,8 +9,8 @@ require 'emcee/document'
|
|
9
9
|
class ResolverStub
|
10
10
|
attr_reader :asset_required
|
11
11
|
|
12
|
-
def
|
13
|
-
"
|
12
|
+
def absolute_path(path)
|
13
|
+
"/#{path}"
|
14
14
|
end
|
15
15
|
|
16
16
|
def require_asset(asset)
|
@@ -42,53 +42,41 @@ class ProcessorsTest < ActiveSupport::TestCase
|
|
42
42
|
processor = Emcee::Processors::ImportProcessor.new(@resolver)
|
43
43
|
processed = processor.process(@doc).to_s
|
44
44
|
|
45
|
-
|
46
|
-
assert_equal processed, <<-EOS.strip_heredoc
|
45
|
+
correct = <<-EOS.strip_heredoc
|
47
46
|
<link rel="stylesheet" href="test.css">
|
48
47
|
<script src="test.js"></script>
|
49
48
|
<p>test</p>
|
50
49
|
EOS
|
50
|
+
|
51
|
+
assert @resolver.asset_required
|
52
|
+
assert_equal correct, processed
|
51
53
|
end
|
52
54
|
|
53
55
|
test "processing stylesheets should work" do
|
54
56
|
processor = Emcee::Processors::StylesheetProcessor.new(@resolver)
|
55
57
|
processed = processor.process(@doc).to_s
|
56
58
|
|
57
|
-
|
59
|
+
correct = <<-EOS.strip_heredoc
|
58
60
|
<link rel="import" href="test.html">
|
59
61
|
<style>/* contents */</style>
|
60
62
|
<script src="test.js"></script>
|
61
63
|
<p>test</p>
|
62
64
|
EOS
|
65
|
+
|
66
|
+
assert_equal correct, processed
|
63
67
|
end
|
64
68
|
|
65
69
|
test "processing scripts should work" do
|
66
70
|
processor = Emcee::Processors::ScriptProcessor.new(@resolver)
|
67
71
|
processed = processor.process(@doc).to_s
|
68
72
|
|
69
|
-
|
73
|
+
correct = <<-EOS.strip_heredoc
|
70
74
|
<link rel="import" href="test.html">
|
71
75
|
<link rel="stylesheet" href="test.css">
|
72
76
|
<script>/* contents */</script>
|
73
77
|
<p>test</p>
|
74
78
|
EOS
|
75
|
-
end
|
76
79
|
|
77
|
-
|
78
|
-
@body = <<-EOS.strip_heredoc
|
79
|
-
<template>
|
80
|
-
<link rel="stylesheet" href="test.css">
|
81
|
-
</template>
|
82
|
-
EOS
|
83
|
-
@doc = Emcee::Document.new(@body)
|
84
|
-
|
85
|
-
processor = Emcee::Processors::StylesheetProcessor.new(@resolver)
|
86
|
-
processed = processor.process(@doc).to_s
|
87
|
-
|
88
|
-
assert_equal processed, <<-EOS.strip_heredoc
|
89
|
-
<template>
|
90
|
-
<style>/* contents */</style>
|
91
|
-
</template>
|
92
|
-
EOS
|
80
|
+
assert_equal correct, processed
|
93
81
|
end
|
94
82
|
end
|
data/test/resolver_test.rb
CHANGED
@@ -4,22 +4,18 @@ require 'emcee/resolver.rb'
|
|
4
4
|
# Create a stub of Sprocket's Context class, so we can test if we're sending
|
5
5
|
# the correct messages to it.
|
6
6
|
class ContextStub
|
7
|
-
attr_reader :
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@assets = []
|
11
|
-
end
|
7
|
+
attr_reader :asset_required, :evaluated
|
12
8
|
|
13
9
|
def pathname
|
14
10
|
"/"
|
15
11
|
end
|
16
12
|
|
17
13
|
def require_asset(asset)
|
18
|
-
@
|
14
|
+
@asset_required = true
|
19
15
|
end
|
20
16
|
|
21
17
|
def evaluate(path, options = {})
|
22
|
-
|
18
|
+
@evaluated = true
|
23
19
|
end
|
24
20
|
end
|
25
21
|
|
@@ -29,18 +25,18 @@ class ResolverTest < ActiveSupport::TestCase
|
|
29
25
|
@resolver = Emcee::Resolver.new(@context)
|
30
26
|
end
|
31
27
|
|
32
|
-
test "should
|
33
|
-
assert_equal @resolver.
|
28
|
+
test "should resolve absolute path" do
|
29
|
+
assert_equal "/test.js", @resolver.absolute_path("test.js")
|
34
30
|
end
|
35
31
|
|
36
32
|
test "should require assets" do
|
37
|
-
|
38
|
-
|
39
|
-
end
|
33
|
+
@resolver.require_asset("/asset1")
|
34
|
+
assert @context.asset_required
|
40
35
|
end
|
41
36
|
|
42
37
|
test "should evaluate an asset" do
|
43
|
-
|
38
|
+
@resolver.evaluate("/test")
|
39
|
+
assert @context.evaluated
|
44
40
|
end
|
45
41
|
|
46
42
|
test "should indicate if asset should be inlined" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emcee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Huth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/emcee/helpers/asset_url_helper.rb
|
112
112
|
- lib/emcee/helpers/sprockets_helper.rb
|
113
113
|
- lib/emcee/loose_assets.rb
|
114
|
+
- lib/emcee/node.rb
|
114
115
|
- lib/emcee/processors/import_processor.rb
|
115
116
|
- lib/emcee/processors/script_processor.rb
|
116
117
|
- lib/emcee/processors/stylesheet_processor.rb
|
@@ -165,7 +166,6 @@ files:
|
|
165
166
|
- test/dummy/config/initializers/wrap_parameters.rb
|
166
167
|
- test/dummy/config/locales/en.yml
|
167
168
|
- test/dummy/config/routes.rb
|
168
|
-
- test/dummy/db/development.sqlite3
|
169
169
|
- test/dummy/db/test.sqlite3
|
170
170
|
- test/dummy/log/development.log
|
171
171
|
- test/dummy/log/test.log
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- test/dummy/tmp/cache/assets/test/sprockets/f16d30b33e206690649697e498a2f1a8
|
196
196
|
- test/dummy_app_integration_test.rb
|
197
197
|
- test/helpers_test.rb
|
198
|
+
- test/node_test.rb
|
198
199
|
- test/processors_test.rb
|
199
200
|
- test/resolver_test.rb
|
200
201
|
- test/test_helper.rb
|
@@ -218,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
219
|
version: '0'
|
219
220
|
requirements: []
|
220
221
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.
|
222
|
+
rubygems_version: 2.4.1
|
222
223
|
signing_key:
|
223
224
|
specification_version: 4
|
224
225
|
summary: Add web components to the Rails asset pipeline.
|
@@ -266,7 +267,6 @@ test_files:
|
|
266
267
|
- test/dummy/config/locales/en.yml
|
267
268
|
- test/dummy/config/routes.rb
|
268
269
|
- test/dummy/config.ru
|
269
|
-
- test/dummy/db/development.sqlite3
|
270
270
|
- test/dummy/db/test.sqlite3
|
271
271
|
- test/dummy/log/development.log
|
272
272
|
- test/dummy/log/test.log
|
@@ -298,7 +298,7 @@ test_files:
|
|
298
298
|
- test/dummy/tmp/cache/assets/test/sprockets/f16d30b33e206690649697e498a2f1a8
|
299
299
|
- test/dummy_app_integration_test.rb
|
300
300
|
- test/helpers_test.rb
|
301
|
+
- test/node_test.rb
|
301
302
|
- test/processors_test.rb
|
302
303
|
- test/resolver_test.rb
|
303
304
|
- test/test_helper.rb
|
304
|
-
has_rdoc:
|
File without changes
|