emcee 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/emcee/processors/html_processor.rb +9 -84
  3. data/lib/emcee/processors/processor_includes.rb +98 -0
  4. data/lib/emcee/railtie.rb +1 -0
  5. data/lib/emcee/version.rb +1 -1
  6. data/test/compressors_test.rb +63 -19
  7. data/test/dummy/app/assets/elements/application.html +0 -2
  8. data/test/dummy/app/assets/elements/test/test3.css +3 -0
  9. data/test/dummy/app/assets/elements/test/test3.html +1 -0
  10. data/test/dummy/log/development.log +201 -0
  11. data/test/dummy/log/test.log +5815 -0
  12. data/test/dummy/tmp/cache/assets/development/sprockets/01abb54333b8d67888355b2f855692e8 +0 -0
  13. data/test/dummy/tmp/cache/assets/development/sprockets/1e24025f59396708b3bb44543bed32fc +0 -0
  14. data/test/dummy/tmp/cache/assets/development/sprockets/219d0afb67879a67bae32b4fe4c708ac +0 -0
  15. data/test/dummy/tmp/cache/assets/development/sprockets/32cae461a9446107294c8a0230f5080c +0 -0
  16. data/test/dummy/tmp/cache/assets/development/sprockets/4fd1effec4d6579ba9d4f03ed156a15b +0 -0
  17. data/test/dummy/tmp/cache/assets/development/sprockets/63ab3ecb77a01edbed6db1aca4d690fc +0 -0
  18. data/test/dummy/tmp/cache/assets/development/sprockets/6c9d8a21af4539e19a3462e79ac4d70c +0 -0
  19. data/test/dummy/tmp/cache/assets/development/sprockets/a69c3d00e22ad6c0d6ece35c9fd5f316 +0 -0
  20. data/test/dummy/tmp/cache/assets/development/sprockets/af6ba4ae23c6790e0f474b01ceee8dd9 +0 -0
  21. data/test/dummy/tmp/cache/assets/development/sprockets/c04739a2061e8e023568aabaa0e801d2 +0 -0
  22. data/test/dummy/tmp/cache/assets/development/sprockets/cf517b62bd978b748afe38d5beb317de +0 -0
  23. data/test/dummy/tmp/cache/assets/development/sprockets/df6cfcc50da209231a7d9e140e5bafdc +0 -0
  24. data/test/dummy/tmp/cache/assets/development/sprockets/e0949aa3dcdcab5f8b45d30e26f6ddd2 +0 -0
  25. data/test/dummy/tmp/cache/assets/development/sprockets/e1d520d14db311ab6347be6426dac6f5 +0 -0
  26. data/test/dummy/tmp/cache/assets/development/sprockets/ffd4adb86602a60c7fcedd5d472166d3 +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sprockets/1e24025f59396708b3bb44543bed32fc +0 -0
  28. data/test/dummy/tmp/cache/assets/test/sprockets/219d0afb67879a67bae32b4fe4c708ac +0 -0
  29. data/test/dummy/tmp/cache/assets/test/sprockets/32cae461a9446107294c8a0230f5080c +0 -0
  30. data/test/dummy/tmp/cache/assets/test/sprockets/4fd1effec4d6579ba9d4f03ed156a15b +0 -0
  31. data/test/dummy/tmp/cache/assets/test/sprockets/6c9d8a21af4539e19a3462e79ac4d70c +0 -0
  32. data/test/dummy/tmp/cache/assets/test/sprockets/a69c3d00e22ad6c0d6ece35c9fd5f316 +0 -0
  33. data/test/dummy/tmp/cache/assets/test/sprockets/af6ba4ae23c6790e0f474b01ceee8dd9 +0 -0
  34. data/test/dummy/tmp/cache/assets/test/sprockets/cf517b62bd978b748afe38d5beb317de +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sprockets/df6cfcc50da209231a7d9e140e5bafdc +0 -0
  36. data/test/dummy/tmp/cache/assets/test/sprockets/e0949aa3dcdcab5f8b45d30e26f6ddd2 +0 -0
  37. data/test/dummy/tmp/cache/assets/test/sprockets/ffd4adb86602a60c7fcedd5d472166d3 +0 -0
  38. data/test/dummy/vendor/assets/elements/test4.html +1 -0
  39. data/test/dummy/vendor/assets/elements/test4.js +1 -0
  40. data/test/processors_test.rb +74 -0
  41. metadata +8 -5
  42. data/test/dummy/tmp/cache/assets/test/sprockets/070957bfe375a537750196a12d9e6d1a +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sprockets/fb7c86cdcce596d8b3c14ce236bf73c5 +0 -0
@@ -1 +1,2 @@
1
+ <script src="test4.js"></script>
1
2
  <p>test4</p>
@@ -0,0 +1 @@
1
+ var life = "is good";
@@ -0,0 +1,74 @@
1
+ require 'test_helper'
2
+
3
+ # Testing a class that inherits from Sprockets::DirectiveProcessor is difficult,
4
+ # so we've split out the methods we want to test into a module, and we'll include
5
+ # them here in a stub class.
6
+ class ProcessorStub
7
+ include Emcee::Processors::Includes
8
+
9
+ private
10
+ def read_file(path)
11
+ "/* contents */"
12
+ end
13
+ end
14
+
15
+ # Create a stub of Sprocket's Context class, so we can test if we're 'requiring'
16
+ # assets correctly.
17
+ class ContextStub
18
+ attr_reader :assets
19
+
20
+ def initialize
21
+ @assets = []
22
+ end
23
+
24
+ def require_asset(asset)
25
+ @assets << asset
26
+ end
27
+ end
28
+
29
+ class ProcessorsTest < ActiveSupport::TestCase
30
+ setup do
31
+ @processor = ProcessorStub.new
32
+ @context = ContextStub.new
33
+ @directory = "/dir"
34
+ @body = %Q{
35
+ <link rel="import" href="test.html">
36
+ <link rel="stylesheet" href="test.css">
37
+ <script src="test.js"></script>
38
+ <p>test</p>
39
+ }
40
+ end
41
+
42
+ test "processing imports should work" do
43
+ processed = @processor.process_imports(@body, @context, @directory)
44
+ assert_equal 1, @context.assets.length
45
+ assert_equal "/dir/test.html", @context.assets[0]
46
+
47
+ assert_equal processed, %q{
48
+
49
+ <link rel="stylesheet" href="test.css">
50
+ <script src="test.js"></script>
51
+ <p>test</p>
52
+ }
53
+ end
54
+
55
+ test "processing stylesheets should work" do
56
+ processed = @processor.process_stylesheets(@body, @directory)
57
+ assert_equal processed, %q{
58
+ <link rel="import" href="test.html">
59
+ <style>/* contents */</style>
60
+ <script src="test.js"></script>
61
+ <p>test</p>
62
+ }
63
+ end
64
+
65
+ test "processing scripts should work" do
66
+ processed = @processor.process_scripts(@body, @directory)
67
+ assert_equal processed, %q{
68
+ <link rel="import" href="test.html">
69
+ <link rel="stylesheet" href="test.css">
70
+ <script>/* contents */</script>
71
+ <p>test</p>
72
+ }
73
+ end
74
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emcee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Huth
@@ -53,6 +53,7 @@ files:
53
53
  - lib/emcee/helpers/sprockets_compressing.rb
54
54
  - lib/emcee/helpers/sprockets_view.rb
55
55
  - lib/emcee/processors/html_processor.rb
56
+ - lib/emcee/processors/processor_includes.rb
56
57
  - lib/emcee/railtie.rb
57
58
  - lib/emcee/version.rb
58
59
  - lib/generators/emcee/install/install_generator.rb
@@ -64,6 +65,7 @@ files:
64
65
  - test/dummy/Rakefile
65
66
  - test/dummy/app/assets/elements/application.html
66
67
  - test/dummy/app/assets/elements/test/test2.html
68
+ - test/dummy/app/assets/elements/test/test3.css
67
69
  - test/dummy/app/assets/elements/test/test3.html
68
70
  - test/dummy/app/assets/elements/test1.html
69
71
  - test/dummy/app/assets/javascripts/application.js
@@ -122,7 +124,6 @@ files:
122
124
  - test/dummy/tmp/cache/assets/development/sprockets/e1d520d14db311ab6347be6426dac6f5
123
125
  - test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
124
126
  - test/dummy/tmp/cache/assets/development/sprockets/ffd4adb86602a60c7fcedd5d472166d3
125
- - test/dummy/tmp/cache/assets/test/sprockets/070957bfe375a537750196a12d9e6d1a
126
127
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
127
128
  - test/dummy/tmp/cache/assets/test/sprockets/1e24025f59396708b3bb44543bed32fc
128
129
  - test/dummy/tmp/cache/assets/test/sprockets/219d0afb67879a67bae32b4fe4c708ac
@@ -139,11 +140,12 @@ files:
139
140
  - test/dummy/tmp/cache/assets/test/sprockets/df6cfcc50da209231a7d9e140e5bafdc
140
141
  - test/dummy/tmp/cache/assets/test/sprockets/e0949aa3dcdcab5f8b45d30e26f6ddd2
141
142
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
142
- - test/dummy/tmp/cache/assets/test/sprockets/fb7c86cdcce596d8b3c14ce236bf73c5
143
143
  - test/dummy/tmp/cache/assets/test/sprockets/ffd4adb86602a60c7fcedd5d472166d3
144
144
  - test/dummy/vendor/assets/elements/test4.html
145
+ - test/dummy/vendor/assets/elements/test4.js
145
146
  - test/emcee_test.rb
146
147
  - test/helpers_test.rb
148
+ - test/processors_test.rb
147
149
  - test/test_helper.rb
148
150
  homepage: https://github.com/ahuth/emcee
149
151
  licenses:
@@ -174,6 +176,7 @@ test_files:
174
176
  - test/controllers_test.rb
175
177
  - test/dummy/app/assets/elements/application.html
176
178
  - test/dummy/app/assets/elements/test/test2.html
179
+ - test/dummy/app/assets/elements/test/test3.css
177
180
  - test/dummy/app/assets/elements/test/test3.html
178
181
  - test/dummy/app/assets/elements/test1.html
179
182
  - test/dummy/app/assets/javascripts/application.js
@@ -234,7 +237,6 @@ test_files:
234
237
  - test/dummy/tmp/cache/assets/development/sprockets/e1d520d14db311ab6347be6426dac6f5
235
238
  - test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
236
239
  - test/dummy/tmp/cache/assets/development/sprockets/ffd4adb86602a60c7fcedd5d472166d3
237
- - test/dummy/tmp/cache/assets/test/sprockets/070957bfe375a537750196a12d9e6d1a
238
240
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
239
241
  - test/dummy/tmp/cache/assets/test/sprockets/1e24025f59396708b3bb44543bed32fc
240
242
  - test/dummy/tmp/cache/assets/test/sprockets/219d0afb67879a67bae32b4fe4c708ac
@@ -251,9 +253,10 @@ test_files:
251
253
  - test/dummy/tmp/cache/assets/test/sprockets/df6cfcc50da209231a7d9e140e5bafdc
252
254
  - test/dummy/tmp/cache/assets/test/sprockets/e0949aa3dcdcab5f8b45d30e26f6ddd2
253
255
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
254
- - test/dummy/tmp/cache/assets/test/sprockets/fb7c86cdcce596d8b3c14ce236bf73c5
255
256
  - test/dummy/tmp/cache/assets/test/sprockets/ffd4adb86602a60c7fcedd5d472166d3
256
257
  - test/dummy/vendor/assets/elements/test4.html
258
+ - test/dummy/vendor/assets/elements/test4.js
257
259
  - test/emcee_test.rb
258
260
  - test/helpers_test.rb
261
+ - test/processors_test.rb
259
262
  - test/test_helper.rb