emcee 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/emcee/processors/html_processor.rb +3 -1
  3. data/lib/emcee/processors/processor_includes.rb +111 -0
  4. data/lib/emcee/version.rb +1 -1
  5. data/test/dummy/log/test.log +711 -0
  6. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  7. data/test/dummy/tmp/cache/assets/test/sprockets/1e24025f59396708b3bb44543bed32fc +0 -0
  8. data/test/dummy/tmp/cache/assets/test/sprockets/219d0afb67879a67bae32b4fe4c708ac +0 -0
  9. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  10. data/test/dummy/tmp/cache/assets/test/sprockets/32cae461a9446107294c8a0230f5080c +0 -0
  11. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  12. data/test/dummy/tmp/cache/assets/test/sprockets/4fd1effec4d6579ba9d4f03ed156a15b +0 -0
  13. data/test/dummy/tmp/cache/assets/test/sprockets/6c9d8a21af4539e19a3462e79ac4d70c +0 -0
  14. data/test/dummy/tmp/cache/assets/test/sprockets/a69c3d00e22ad6c0d6ece35c9fd5f316 +0 -0
  15. data/test/dummy/tmp/cache/assets/test/sprockets/af6ba4ae23c6790e0f474b01ceee8dd9 +0 -0
  16. data/test/dummy/tmp/cache/assets/test/sprockets/cf517b62bd978b748afe38d5beb317de +0 -0
  17. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sprockets/df6cfcc50da209231a7d9e140e5bafdc +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/e0949aa3dcdcab5f8b45d30e26f6ddd2 +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/ffd4adb86602a60c7fcedd5d472166d3 +0 -0
  23. metadata +4 -35
  24. data/lib/emcee/processors/processor_base.rb +0 -57
  25. data/lib/emcee/processors/processor_imports.rb +0 -19
  26. data/lib/emcee/processors/processor_scripts.rb +0 -27
  27. data/lib/emcee/processors/processor_stylesheets.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6886fd8af5eb4a90e1f26cfb23489313d7502892
4
- data.tar.gz: 3bbd8819eb17cb1ab81b463d161886b6bfac7a3c
3
+ metadata.gz: f84512c12570cf26feb1bad8ffaf319e6c6c1ff1
4
+ data.tar.gz: b472037fa77a3734c926253b8f1583ca3492e05c
5
5
  SHA512:
6
- metadata.gz: f3bfee5e48b9344b87570d8b767516526afd709764d7c5e7df845a4e13e7278c7a18e6e638000820de9c48997084c9b3b6f2292fc2c3dc6a9202f370d63deea4
7
- data.tar.gz: 01cf8659c1ecf2b4c2fd467453c1c3773deb16abc865fbfa7d8b59ac24e6996f1647028e672efbd3c1d480834deaba9eb0aa09a660e0fb211124c2368b1e9d7d
6
+ metadata.gz: 651de8d67870c283eacb05f1edb9d6f93b0f74fcc860fe59f0470a381c3a1f644969b451f6225657d2f66339c776c0c31ee2fa814bd20d3d71f1b9569ff177ca
7
+ data.tar.gz: 82099ebba30e021ae3821d2b94b09b7b038e613962cbd7518db8b4cca40a88e92baa38efde566c6b930ea94ac47e66df90fe5f91d01021dd89806e442c54fff6
@@ -1,4 +1,4 @@
1
- require "emcee/processors/processor_base"
1
+ require "emcee/processors/processor_includes"
2
2
 
3
3
  module Emcee
4
4
  module Processors
@@ -16,6 +16,8 @@ module Emcee
16
16
  # work for us.
17
17
  #
18
18
  class HtmlProcessor < Sprockets::DirectiveProcessor
19
+ # Include methods to process different parts of the html file. These are
20
+ # split out to make unit testing easier.
19
21
  include Emcee::Processors::Includes
20
22
  protected :process_imports
21
23
  protected :process_stylesheets
@@ -0,0 +1,111 @@
1
+ module Emcee
2
+ module Processors
3
+ # This module defines methods that we will include into HtmlProcessor.
4
+ #
5
+ # Testing a class that inherits from Sprockets::DirectiveProcessor, which
6
+ # HtmlProcessor does, is difficult. Seperating out these methods makes them
7
+ # easy to unit test.
8
+ #
9
+ module Includes
10
+ # Match an html import tag.
11
+ #
12
+ # <link rel="import" href="assets/example.html">
13
+ #
14
+ IMPORT_PATTERN = /^\s*<link .*rel=["']import["'].*>$/
15
+
16
+ # Match a stylesheet link tag.
17
+ #
18
+ # <link rel="stylesheet" href="assets/example.css">
19
+ #
20
+ STYLESHEET_PATTERN = /^\s*<link .*rel=["']stylesheet["'].*>$/
21
+
22
+ # Match a script tag.
23
+ #
24
+ # <script src="assets/example.js"></script>
25
+ #
26
+ SCRIPT_PATTERN = /^\s*<script .*src=["'].+\.js["']><\/script>$/
27
+
28
+ # Match the path from the href attribute of an html import or stylesheet
29
+ # include tag. Captures the actual path.
30
+ #
31
+ # href="/assets/example.css"
32
+ #
33
+ HREF_PATH_PATTERN = /href=["'](?<path>[\w\.\/-]+)["']/
34
+
35
+ # Match the source path from a script tag. Captures the actual path.
36
+ #
37
+ # src="/assets/example.js"
38
+ #
39
+ SRC_PATH_PATTERN = /src=["'](?<path>[\w\.\/-]+)["']/
40
+
41
+ # Match the indentation whitespace of a line
42
+ #
43
+ INDENT_PATTERN = /^(?<indent>\s*)/
44
+
45
+ # Return a file's contents as text. This is split out as a method so that
46
+ # we can test the other methods in this module without actually reading from
47
+ # the filesystem.
48
+ def read_file(path)
49
+ File.read(path)
50
+ end
51
+
52
+ # Scan the body for html imports. If any are found, tell sprockets to
53
+ # require their files like we would for a directive. Then remove the
54
+ # imports and return the new body.
55
+ def process_imports(body, context, directory)
56
+ body.scan(IMPORT_PATTERN) do |import_tag|
57
+ if path = import_tag[HREF_PATH_PATTERN, :path]
58
+ absolute_path = File.absolute_path(path, directory)
59
+ context.require_asset(absolute_path)
60
+ end
61
+ end
62
+
63
+ body.gsub(IMPORT_PATTERN, "")
64
+ end
65
+
66
+ # Scan the body for external script references. If any are found, inline
67
+ # the files in place of the references and return the new body.
68
+ def process_scripts(body, directory)
69
+ to_inline = []
70
+
71
+ body.scan(SCRIPT_PATTERN) do |script_tag|
72
+ if path = script_tag[SRC_PATH_PATTERN, :path]
73
+
74
+ indent = script_tag[INDENT_PATTERN, :indent] || ""
75
+
76
+ absolute_path = File.absolute_path(path, directory)
77
+ script_contents = read_file(absolute_path)
78
+
79
+ to_inline << [script_tag, "#{indent}<script>#{script_contents}\n#{indent}</script>"]
80
+ end
81
+ end
82
+
83
+ to_inline.reduce(body) do |output, (tag, contents)|
84
+ output.gsub(tag, contents)
85
+ end
86
+ end
87
+
88
+ # Scan the body for external stylesheet references. If any are found,
89
+ # inline the files in place of the references and return the new body.
90
+ def process_stylesheets(body, directory)
91
+ to_inline = []
92
+
93
+ body.scan(STYLESHEET_PATTERN) do |stylesheet_tag|
94
+ if path = stylesheet_tag[HREF_PATH_PATTERN, :path]
95
+
96
+ indent = stylesheet_tag[INDENT_PATTERN, :indent] || ""
97
+
98
+ absolute_path = File.absolute_path(path, directory)
99
+ stylesheet_contents = read_file(absolute_path)
100
+
101
+ to_inline << [stylesheet_tag, "#{indent}<style>#{stylesheet_contents}\n#{indent}</style>"]
102
+ end
103
+ end
104
+
105
+ to_inline.reduce(body) do |output, (tag, contents)|
106
+ output.gsub(tag, contents)
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
data/lib/emcee/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Emcee
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -29458,5 +29458,716 @@ ProcessorsTest: test_processing_scripts_should_work
29458
29458
   (0.0ms) begin transaction
29459
29459
  -------------------------------------------------------
29460
29460
  ProcessorsTest: test_processing_stylesheets_should_work
29461
+ -------------------------------------------------------
29462
+  (0.0ms) rollback transaction
29463
+  (0.2ms) begin transaction
29464
+ ----------------------------------------------------------
29465
+ CompressorsTest: test_compressor_should_remove_blank_lines
29466
+ ----------------------------------------------------------
29467
+  (0.0ms) rollback transaction
29468
+  (0.1ms) begin transaction
29469
+ -----------------------------------------------------------
29470
+ CompressorsTest: test_compressor_should_remove_css_comments
29471
+ -----------------------------------------------------------
29472
+  (0.1ms) rollback transaction
29473
+  (0.1ms) begin transaction
29474
+ ------------------------------------------------------------
29475
+ CompressorsTest: test_compressor_should_remove_html_comments
29476
+ ------------------------------------------------------------
29477
+  (0.0ms) rollback transaction
29478
+  (0.1ms) begin transaction
29479
+ -----------------------------------------------------------------------------
29480
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29481
+ -----------------------------------------------------------------------------
29482
+  (0.0ms) rollback transaction
29483
+  (0.0ms) begin transaction
29484
+ ------------------------------------------------------------------------------
29485
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29486
+ ------------------------------------------------------------------------------
29487
+  (0.0ms) rollback transaction
29488
+  (0.0ms) begin transaction
29489
+ ----------------------------------------------------
29490
+ ControllersTest: test_index_should_have_html_imports
29491
+ ----------------------------------------------------
29492
+ Processing by DummyController#index as HTML
29493
+ Rendered dummy/index.html.erb within layouts/application (0.9ms)
29494
+ Completed 200 OK in 16ms (Views: 16.0ms | ActiveRecord: 0.0ms)
29495
+  (0.1ms) rollback transaction
29496
+  (0.0ms) begin transaction
29497
+ --------------------------------------
29498
+ ControllersTest: test_should_get_index
29499
+ --------------------------------------
29500
+ Processing by DummyController#index as HTML
29501
+ Completed 200 OK in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)
29502
+  (0.1ms) rollback transaction
29503
+  (0.0ms) begin transaction
29504
+ -----------------------------------------------------------------------------------
29505
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29506
+ -----------------------------------------------------------------------------------
29507
+ Processing by DummyController#index as HTML
29508
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
29509
+  (0.0ms) rollback transaction
29510
+  (0.0ms) begin transaction
29511
+ -------------------------------------------------------------------------
29512
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29513
+ -------------------------------------------------------------------------
29514
+ Processing by DummyController#assets as HTML
29515
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29516
+  (0.1ms) rollback transaction
29517
+  (0.0ms) begin transaction
29518
+ ---------------------
29519
+ EmceeTest: test_truth
29520
+ ---------------------
29521
+  (0.0ms) rollback transaction
29522
+  (0.0ms) begin transaction
29523
+ -------------------------------------
29524
+ Helpers: test_html_import_should_work
29525
+ -------------------------------------
29526
+  (0.0ms) rollback transaction
29527
+  (0.0ms) begin transaction
29528
+ ---------------------------------------------------
29529
+ ProcessorsTest: test_processing_imports_should_work
29530
+ ---------------------------------------------------
29531
+  (0.0ms) rollback transaction
29532
+  (0.0ms) begin transaction
29533
+ ---------------------------------------------------
29534
+ ProcessorsTest: test_processing_scripts_should_work
29535
+ ---------------------------------------------------
29536
+  (0.0ms) rollback transaction
29537
+  (0.0ms) begin transaction
29538
+ -------------------------------------------------------
29539
+ ProcessorsTest: test_processing_stylesheets_should_work
29540
+ -------------------------------------------------------
29541
+  (0.0ms) rollback transaction
29542
+  (0.2ms) begin transaction
29543
+ ----------------------------------------------------------
29544
+ CompressorsTest: test_compressor_should_remove_blank_lines
29545
+ ----------------------------------------------------------
29546
+  (0.0ms) rollback transaction
29547
+  (0.0ms) begin transaction
29548
+ -----------------------------------------------------------
29549
+ CompressorsTest: test_compressor_should_remove_css_comments
29550
+ -----------------------------------------------------------
29551
+  (0.0ms) rollback transaction
29552
+  (0.0ms) begin transaction
29553
+ ------------------------------------------------------------
29554
+ CompressorsTest: test_compressor_should_remove_html_comments
29555
+ ------------------------------------------------------------
29556
+  (0.0ms) rollback transaction
29557
+  (0.0ms) begin transaction
29558
+ -----------------------------------------------------------------------------
29559
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29560
+ -----------------------------------------------------------------------------
29561
+  (0.0ms) rollback transaction
29562
+  (0.0ms) begin transaction
29563
+ ------------------------------------------------------------------------------
29564
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29565
+ ------------------------------------------------------------------------------
29566
+  (0.0ms) rollback transaction
29567
+  (0.0ms) begin transaction
29568
+ ----------------------------------------------------
29569
+ ControllersTest: test_index_should_have_html_imports
29570
+ ----------------------------------------------------
29571
+ Processing by DummyController#index as HTML
29572
+ Rendered dummy/index.html.erb within layouts/application (1.0ms)
29573
+ Completed 200 OK in 16ms (Views: 15.7ms | ActiveRecord: 0.0ms)
29574
+  (0.1ms) rollback transaction
29575
+  (0.0ms) begin transaction
29576
+ --------------------------------------
29577
+ ControllersTest: test_should_get_index
29578
+ --------------------------------------
29579
+ Processing by DummyController#index as HTML
29580
+ Completed 200 OK in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)
29581
+  (0.0ms) rollback transaction
29582
+  (0.1ms) begin transaction
29583
+ -----------------------------------------------------------------------------------
29584
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29585
+ -----------------------------------------------------------------------------------
29586
+ Processing by DummyController#index as HTML
29587
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
29588
+  (0.1ms) rollback transaction
29589
+  (0.0ms) begin transaction
29590
+ -------------------------------------------------------------------------
29591
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29592
+ -------------------------------------------------------------------------
29593
+ Processing by DummyController#assets as HTML
29594
+ Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29595
+  (0.1ms) rollback transaction
29596
+  (0.0ms) begin transaction
29597
+ ---------------------
29598
+ EmceeTest: test_truth
29599
+ ---------------------
29600
+  (0.0ms) rollback transaction
29601
+  (0.0ms) begin transaction
29602
+ -------------------------------------
29603
+ Helpers: test_html_import_should_work
29604
+ -------------------------------------
29605
+  (0.0ms) rollback transaction
29606
+  (0.0ms) begin transaction
29607
+ ---------------------------------------------------
29608
+ ProcessorsTest: test_processing_imports_should_work
29609
+ ---------------------------------------------------
29610
+  (0.0ms) rollback transaction
29611
+  (0.0ms) begin transaction
29612
+ ---------------------------------------------------
29613
+ ProcessorsTest: test_processing_scripts_should_work
29614
+ ---------------------------------------------------
29615
+  (0.0ms) rollback transaction
29616
+  (0.0ms) begin transaction
29617
+ -------------------------------------------------------
29618
+ ProcessorsTest: test_processing_stylesheets_should_work
29619
+ -------------------------------------------------------
29620
+  (0.0ms) rollback transaction
29621
+  (0.2ms) begin transaction
29622
+ ----------------------------------------------------------
29623
+ CompressorsTest: test_compressor_should_remove_blank_lines
29624
+ ----------------------------------------------------------
29625
+  (0.0ms) rollback transaction
29626
+  (0.0ms) begin transaction
29627
+ -----------------------------------------------------------
29628
+ CompressorsTest: test_compressor_should_remove_css_comments
29629
+ -----------------------------------------------------------
29630
+  (0.0ms) rollback transaction
29631
+  (0.0ms) begin transaction
29632
+ ------------------------------------------------------------
29633
+ CompressorsTest: test_compressor_should_remove_html_comments
29634
+ ------------------------------------------------------------
29635
+  (0.0ms) rollback transaction
29636
+  (0.0ms) begin transaction
29637
+ -----------------------------------------------------------------------------
29638
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29639
+ -----------------------------------------------------------------------------
29640
+  (0.0ms) rollback transaction
29641
+  (0.0ms) begin transaction
29642
+ ------------------------------------------------------------------------------
29643
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29644
+ ------------------------------------------------------------------------------
29645
+  (0.0ms) rollback transaction
29646
+  (0.0ms) begin transaction
29647
+ ----------------------------------------------------
29648
+ ControllersTest: test_index_should_have_html_imports
29649
+ ----------------------------------------------------
29650
+ Processing by DummyController#index as HTML
29651
+ Rendered dummy/index.html.erb within layouts/application (0.9ms)
29652
+ Completed 200 OK in 16ms (Views: 15.5ms | ActiveRecord: 0.0ms)
29653
+  (0.1ms) rollback transaction
29654
+  (0.1ms) begin transaction
29655
+ --------------------------------------
29656
+ ControllersTest: test_should_get_index
29657
+ --------------------------------------
29658
+ Processing by DummyController#index as HTML
29659
+ Completed 200 OK in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)
29660
+  (0.0ms) rollback transaction
29661
+  (0.0ms) begin transaction
29662
+ -----------------------------------------------------------------------------------
29663
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29664
+ -----------------------------------------------------------------------------------
29665
+ Processing by DummyController#index as HTML
29666
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
29667
+  (0.0ms) rollback transaction
29668
+  (0.1ms) begin transaction
29669
+ -------------------------------------------------------------------------
29670
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29671
+ -------------------------------------------------------------------------
29672
+ Processing by DummyController#assets as HTML
29673
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29674
+  (0.1ms) rollback transaction
29675
+  (0.0ms) begin transaction
29676
+ ---------------------
29677
+ EmceeTest: test_truth
29678
+ ---------------------
29679
+  (0.0ms) rollback transaction
29680
+  (0.1ms) begin transaction
29681
+ -------------------------------------
29682
+ Helpers: test_html_import_should_work
29683
+ -------------------------------------
29684
+  (0.0ms) rollback transaction
29685
+  (0.0ms) begin transaction
29686
+ ---------------------------------------------------
29687
+ ProcessorsTest: test_processing_imports_should_work
29688
+ ---------------------------------------------------
29689
+  (0.0ms) rollback transaction
29690
+  (0.0ms) begin transaction
29691
+ ---------------------------------------------------
29692
+ ProcessorsTest: test_processing_scripts_should_work
29693
+ ---------------------------------------------------
29694
+  (0.0ms) rollback transaction
29695
+  (0.0ms) begin transaction
29696
+ -------------------------------------------------------
29697
+ ProcessorsTest: test_processing_stylesheets_should_work
29698
+ -------------------------------------------------------
29699
+  (0.0ms) rollback transaction
29700
+  (0.3ms) begin transaction
29701
+ ----------------------------------------------------------
29702
+ CompressorsTest: test_compressor_should_remove_blank_lines
29703
+ ----------------------------------------------------------
29704
+  (0.1ms) rollback transaction
29705
+  (0.0ms) begin transaction
29706
+ -----------------------------------------------------------
29707
+ CompressorsTest: test_compressor_should_remove_css_comments
29708
+ -----------------------------------------------------------
29709
+  (0.1ms) rollback transaction
29710
+  (0.0ms) begin transaction
29711
+ ------------------------------------------------------------
29712
+ CompressorsTest: test_compressor_should_remove_html_comments
29713
+ ------------------------------------------------------------
29714
+  (0.0ms) rollback transaction
29715
+  (0.0ms) begin transaction
29716
+ -----------------------------------------------------------------------------
29717
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29718
+ -----------------------------------------------------------------------------
29719
+  (0.0ms) rollback transaction
29720
+  (0.0ms) begin transaction
29721
+ ------------------------------------------------------------------------------
29722
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29723
+ ------------------------------------------------------------------------------
29724
+  (0.0ms) rollback transaction
29725
+  (0.0ms) begin transaction
29726
+ ----------------------------------------------------
29727
+ ControllersTest: test_index_should_have_html_imports
29728
+ ----------------------------------------------------
29729
+ Processing by DummyController#index as HTML
29730
+ Rendered dummy/index.html.erb within layouts/application (0.9ms)
29731
+ Completed 200 OK in 17ms (Views: 16.2ms | ActiveRecord: 0.0ms)
29732
+  (0.1ms) rollback transaction
29733
+  (0.1ms) begin transaction
29734
+ --------------------------------------
29735
+ ControllersTest: test_should_get_index
29736
+ --------------------------------------
29737
+ Processing by DummyController#index as HTML
29738
+ Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
29739
+  (0.1ms) rollback transaction
29740
+  (0.0ms) begin transaction
29741
+ -----------------------------------------------------------------------------------
29742
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29743
+ -----------------------------------------------------------------------------------
29744
+ Processing by DummyController#index as HTML
29745
+ Completed 200 OK in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)
29746
+  (0.0ms) rollback transaction
29747
+  (0.0ms) begin transaction
29748
+ -------------------------------------------------------------------------
29749
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29750
+ -------------------------------------------------------------------------
29751
+ Processing by DummyController#assets as HTML
29752
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29753
+  (0.1ms) rollback transaction
29754
+  (0.0ms) begin transaction
29755
+ ---------------------
29756
+ EmceeTest: test_truth
29757
+ ---------------------
29758
+  (0.1ms) rollback transaction
29759
+  (0.0ms) begin transaction
29760
+ -------------------------------------
29761
+ Helpers: test_html_import_should_work
29762
+ -------------------------------------
29763
+  (0.0ms) rollback transaction
29764
+  (0.0ms) begin transaction
29765
+ ---------------------------------------------------
29766
+ ProcessorsTest: test_processing_imports_should_work
29767
+ ---------------------------------------------------
29768
+  (0.0ms) rollback transaction
29769
+  (0.1ms) begin transaction
29770
+ ---------------------------------------------------
29771
+ ProcessorsTest: test_processing_scripts_should_work
29772
+ ---------------------------------------------------
29773
+  (0.0ms) rollback transaction
29774
+  (0.1ms) begin transaction
29775
+ -------------------------------------------------------
29776
+ ProcessorsTest: test_processing_stylesheets_should_work
29777
+ -------------------------------------------------------
29778
+  (0.0ms) rollback transaction
29779
+  (0.3ms) begin transaction
29780
+ ----------------------------------------------------------
29781
+ CompressorsTest: test_compressor_should_remove_blank_lines
29782
+ ----------------------------------------------------------
29783
+  (0.1ms) rollback transaction
29784
+  (0.0ms) begin transaction
29785
+ -----------------------------------------------------------
29786
+ CompressorsTest: test_compressor_should_remove_css_comments
29787
+ -----------------------------------------------------------
29788
+  (0.1ms) rollback transaction
29789
+  (0.0ms) begin transaction
29790
+ ------------------------------------------------------------
29791
+ CompressorsTest: test_compressor_should_remove_html_comments
29792
+ ------------------------------------------------------------
29793
+  (0.1ms) rollback transaction
29794
+  (0.0ms) begin transaction
29795
+ -----------------------------------------------------------------------------
29796
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29797
+ -----------------------------------------------------------------------------
29798
+  (0.0ms) rollback transaction
29799
+  (0.0ms) begin transaction
29800
+ ------------------------------------------------------------------------------
29801
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29802
+ ------------------------------------------------------------------------------
29803
+  (0.0ms) rollback transaction
29804
+  (0.0ms) begin transaction
29805
+ ----------------------------------------------------
29806
+ ControllersTest: test_index_should_have_html_imports
29807
+ ----------------------------------------------------
29808
+ Processing by DummyController#index as HTML
29809
+ Rendered dummy/index.html.erb within layouts/application (0.9ms)
29810
+ Completed 200 OK in 17ms (Views: 16.4ms | ActiveRecord: 0.0ms)
29811
+  (0.1ms) rollback transaction
29812
+  (0.1ms) begin transaction
29813
+ --------------------------------------
29814
+ ControllersTest: test_should_get_index
29815
+ --------------------------------------
29816
+ Processing by DummyController#index as HTML
29817
+ Completed 200 OK in 1ms (Views: 1.0ms | ActiveRecord: 0.0ms)
29818
+  (0.1ms) rollback transaction
29819
+  (0.1ms) begin transaction
29820
+ -----------------------------------------------------------------------------------
29821
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29822
+ -----------------------------------------------------------------------------------
29823
+ Processing by DummyController#index as HTML
29824
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
29825
+  (0.0ms) rollback transaction
29826
+  (0.1ms) begin transaction
29827
+ -------------------------------------------------------------------------
29828
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29829
+ -------------------------------------------------------------------------
29830
+ Processing by DummyController#assets as HTML
29831
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29832
+  (0.1ms) rollback transaction
29833
+  (0.0ms) begin transaction
29834
+ ---------------------
29835
+ EmceeTest: test_truth
29836
+ ---------------------
29837
+  (0.0ms) rollback transaction
29838
+  (0.1ms) begin transaction
29839
+ -------------------------------------
29840
+ Helpers: test_html_import_should_work
29841
+ -------------------------------------
29842
+  (0.1ms) rollback transaction
29843
+  (0.0ms) begin transaction
29844
+ ---------------------------------------------------
29845
+ ProcessorsTest: test_processing_imports_should_work
29846
+ ---------------------------------------------------
29847
+  (0.0ms) rollback transaction
29848
+  (0.1ms) begin transaction
29849
+ ---------------------------------------------------
29850
+ ProcessorsTest: test_processing_scripts_should_work
29851
+ ---------------------------------------------------
29852
+  (0.0ms) rollback transaction
29853
+  (0.0ms) begin transaction
29854
+ -------------------------------------------------------
29855
+ ProcessorsTest: test_processing_stylesheets_should_work
29856
+ -------------------------------------------------------
29857
+  (0.0ms) rollback transaction
29858
+  (0.2ms) begin transaction
29859
+ ----------------------------------------------------------
29860
+ CompressorsTest: test_compressor_should_remove_blank_lines
29861
+ ----------------------------------------------------------
29862
+  (0.0ms) rollback transaction
29863
+  (0.1ms) begin transaction
29864
+ -----------------------------------------------------------
29865
+ CompressorsTest: test_compressor_should_remove_css_comments
29866
+ -----------------------------------------------------------
29867
+  (0.0ms) rollback transaction
29868
+  (0.1ms) begin transaction
29869
+ ------------------------------------------------------------
29870
+ CompressorsTest: test_compressor_should_remove_html_comments
29871
+ ------------------------------------------------------------
29872
+  (0.0ms) rollback transaction
29873
+  (0.1ms) begin transaction
29874
+ -----------------------------------------------------------------------------
29875
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29876
+ -----------------------------------------------------------------------------
29877
+  (0.0ms) rollback transaction
29878
+  (0.1ms) begin transaction
29879
+ ------------------------------------------------------------------------------
29880
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29881
+ ------------------------------------------------------------------------------
29882
+  (0.0ms) rollback transaction
29883
+  (0.1ms) begin transaction
29884
+ ----------------------------------------------------
29885
+ ControllersTest: test_index_should_have_html_imports
29886
+ ----------------------------------------------------
29887
+ Processing by DummyController#index as HTML
29888
+ Rendered dummy/index.html.erb within layouts/application (1.0ms)
29889
+ Completed 200 OK in 17ms (Views: 16.6ms | ActiveRecord: 0.0ms)
29890
+  (0.1ms) rollback transaction
29891
+  (0.1ms) begin transaction
29892
+ --------------------------------------
29893
+ ControllersTest: test_should_get_index
29894
+ --------------------------------------
29895
+ Processing by DummyController#index as HTML
29896
+ Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
29897
+  (0.1ms) rollback transaction
29898
+  (0.0ms) begin transaction
29899
+ -----------------------------------------------------------------------------------
29900
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29901
+ -----------------------------------------------------------------------------------
29902
+ Processing by DummyController#index as HTML
29903
+ Completed 200 OK in 1ms (Views: 1.0ms | ActiveRecord: 0.0ms)
29904
+  (0.1ms) rollback transaction
29905
+  (0.0ms) begin transaction
29906
+ -------------------------------------------------------------------------
29907
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29908
+ -------------------------------------------------------------------------
29909
+ Processing by DummyController#assets as HTML
29910
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29911
+  (0.1ms) rollback transaction
29912
+  (0.0ms) begin transaction
29913
+ ---------------------
29914
+ EmceeTest: test_truth
29915
+ ---------------------
29916
+  (0.1ms) rollback transaction
29917
+  (0.0ms) begin transaction
29918
+ -------------------------------------
29919
+ Helpers: test_html_import_should_work
29920
+ -------------------------------------
29921
+  (0.1ms) rollback transaction
29922
+  (0.0ms) begin transaction
29923
+ ---------------------------------------------------
29924
+ ProcessorsTest: test_processing_imports_should_work
29925
+ ---------------------------------------------------
29926
+  (0.0ms) rollback transaction
29927
+  (0.0ms) begin transaction
29928
+ ---------------------------------------------------
29929
+ ProcessorsTest: test_processing_scripts_should_work
29930
+ ---------------------------------------------------
29931
+  (0.0ms) rollback transaction
29932
+  (0.0ms) begin transaction
29933
+ -------------------------------------------------------
29934
+ ProcessorsTest: test_processing_stylesheets_should_work
29935
+ -------------------------------------------------------
29936
+  (0.0ms) rollback transaction
29937
+  (0.3ms) begin transaction
29938
+ ----------------------------------------------------------
29939
+ CompressorsTest: test_compressor_should_remove_blank_lines
29940
+ ----------------------------------------------------------
29941
+  (0.1ms) rollback transaction
29942
+  (0.1ms) begin transaction
29943
+ -----------------------------------------------------------
29944
+ CompressorsTest: test_compressor_should_remove_css_comments
29945
+ -----------------------------------------------------------
29946
+  (0.1ms) rollback transaction
29947
+  (0.1ms) begin transaction
29948
+ ------------------------------------------------------------
29949
+ CompressorsTest: test_compressor_should_remove_html_comments
29950
+ ------------------------------------------------------------
29951
+  (0.1ms) rollback transaction
29952
+  (0.1ms) begin transaction
29953
+ -----------------------------------------------------------------------------
29954
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
29955
+ -----------------------------------------------------------------------------
29956
+  (0.1ms) rollback transaction
29957
+  (0.1ms) begin transaction
29958
+ ------------------------------------------------------------------------------
29959
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
29960
+ ------------------------------------------------------------------------------
29961
+  (0.1ms) rollback transaction
29962
+  (0.1ms) begin transaction
29963
+ ----------------------------------------------------
29964
+ ControllersTest: test_index_should_have_html_imports
29965
+ ----------------------------------------------------
29966
+ Processing by DummyController#index as HTML
29967
+ Rendered dummy/index.html.erb within layouts/application (1.1ms)
29968
+ Completed 200 OK in 20ms (Views: 19.2ms | ActiveRecord: 0.0ms)
29969
+  (0.1ms) rollback transaction
29970
+  (0.1ms) begin transaction
29971
+ --------------------------------------
29972
+ ControllersTest: test_should_get_index
29973
+ --------------------------------------
29974
+ Processing by DummyController#index as HTML
29975
+ Completed 200 OK in 1ms (Views: 1.1ms | ActiveRecord: 0.0ms)
29976
+  (0.1ms) rollback transaction
29977
+  (0.1ms) begin transaction
29978
+ -----------------------------------------------------------------------------------
29979
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
29980
+ -----------------------------------------------------------------------------------
29981
+ Processing by DummyController#index as HTML
29982
+ Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
29983
+  (0.1ms) rollback transaction
29984
+  (0.0ms) begin transaction
29985
+ -------------------------------------------------------------------------
29986
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
29987
+ -------------------------------------------------------------------------
29988
+ Processing by DummyController#assets as HTML
29989
+ Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 0.0ms)
29990
+  (0.1ms) rollback transaction
29991
+  (0.0ms) begin transaction
29992
+ ---------------------
29993
+ EmceeTest: test_truth
29994
+ ---------------------
29995
+  (0.0ms) rollback transaction
29996
+  (0.0ms) begin transaction
29997
+ -------------------------------------
29998
+ Helpers: test_html_import_should_work
29999
+ -------------------------------------
30000
+  (0.1ms) rollback transaction
30001
+  (0.1ms) begin transaction
30002
+ ---------------------------------------------------
30003
+ ProcessorsTest: test_processing_imports_should_work
30004
+ ---------------------------------------------------
30005
+  (0.0ms) rollback transaction
30006
+  (0.0ms) begin transaction
30007
+ ---------------------------------------------------
30008
+ ProcessorsTest: test_processing_scripts_should_work
30009
+ ---------------------------------------------------
30010
+  (0.0ms) rollback transaction
30011
+  (0.0ms) begin transaction
30012
+ -------------------------------------------------------
30013
+ ProcessorsTest: test_processing_stylesheets_should_work
30014
+ -------------------------------------------------------
30015
+  (0.0ms) rollback transaction
30016
+  (0.2ms) begin transaction
30017
+ ----------------------------------------------------------
30018
+ CompressorsTest: test_compressor_should_remove_blank_lines
30019
+ ----------------------------------------------------------
30020
+  (0.1ms) rollback transaction
30021
+  (0.0ms) begin transaction
30022
+ -----------------------------------------------------------
30023
+ CompressorsTest: test_compressor_should_remove_css_comments
30024
+ -----------------------------------------------------------
30025
+  (0.0ms) rollback transaction
30026
+  (0.0ms) begin transaction
30027
+ ------------------------------------------------------------
30028
+ CompressorsTest: test_compressor_should_remove_html_comments
30029
+ ------------------------------------------------------------
30030
+  (0.0ms) rollback transaction
30031
+  (0.0ms) begin transaction
30032
+ -----------------------------------------------------------------------------
30033
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
30034
+ -----------------------------------------------------------------------------
30035
+  (0.0ms) rollback transaction
30036
+  (0.0ms) begin transaction
30037
+ ------------------------------------------------------------------------------
30038
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
30039
+ ------------------------------------------------------------------------------
30040
+  (0.0ms) rollback transaction
30041
+  (0.0ms) begin transaction
30042
+ ----------------------------------------------------
30043
+ ControllersTest: test_index_should_have_html_imports
30044
+ ----------------------------------------------------
30045
+ Processing by DummyController#index as HTML
30046
+ Rendered dummy/index.html.erb within layouts/application (0.9ms)
30047
+ Completed 200 OK in 40ms (Views: 39.6ms | ActiveRecord: 0.0ms)
30048
+  (0.1ms) rollback transaction
30049
+  (0.0ms) begin transaction
30050
+ --------------------------------------
30051
+ ControllersTest: test_should_get_index
30052
+ --------------------------------------
30053
+ Processing by DummyController#index as HTML
30054
+ Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
30055
+  (0.1ms) rollback transaction
30056
+  (0.0ms) begin transaction
30057
+ -----------------------------------------------------------------------------------
30058
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
30059
+ -----------------------------------------------------------------------------------
30060
+ Processing by DummyController#index as HTML
30061
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
30062
+  (0.0ms) rollback transaction
30063
+  (0.0ms) begin transaction
30064
+ -------------------------------------------------------------------------
30065
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
30066
+ -------------------------------------------------------------------------
30067
+ Processing by DummyController#assets as HTML
30068
+ Completed 200 OK in 6ms (Views: 0.1ms | ActiveRecord: 0.0ms)
30069
+  (0.1ms) rollback transaction
30070
+  (0.1ms) begin transaction
30071
+ ---------------------
30072
+ EmceeTest: test_truth
30073
+ ---------------------
30074
+  (0.0ms) rollback transaction
30075
+  (0.0ms) begin transaction
30076
+ -------------------------------------
30077
+ Helpers: test_html_import_should_work
30078
+ -------------------------------------
30079
+  (0.0ms) rollback transaction
30080
+  (0.0ms) begin transaction
30081
+ ---------------------------------------------------
30082
+ ProcessorsTest: test_processing_imports_should_work
30083
+ ---------------------------------------------------
30084
+  (0.0ms) rollback transaction
30085
+  (0.1ms) begin transaction
30086
+ ---------------------------------------------------
30087
+ ProcessorsTest: test_processing_scripts_should_work
30088
+ ---------------------------------------------------
30089
+  (0.0ms) rollback transaction
30090
+  (0.0ms) begin transaction
30091
+ -------------------------------------------------------
30092
+ ProcessorsTest: test_processing_stylesheets_should_work
30093
+ -------------------------------------------------------
30094
+  (0.0ms) rollback transaction
30095
+  (0.3ms) begin transaction
30096
+ ----------------------------------------------------------
30097
+ CompressorsTest: test_compressor_should_remove_blank_lines
30098
+ ----------------------------------------------------------
30099
+  (0.1ms) rollback transaction
30100
+  (0.1ms) begin transaction
30101
+ -----------------------------------------------------------
30102
+ CompressorsTest: test_compressor_should_remove_css_comments
30103
+ -----------------------------------------------------------
30104
+  (0.0ms) rollback transaction
30105
+  (0.0ms) begin transaction
30106
+ ------------------------------------------------------------
30107
+ CompressorsTest: test_compressor_should_remove_html_comments
30108
+ ------------------------------------------------------------
30109
+  (0.0ms) rollback transaction
30110
+  (0.0ms) begin transaction
30111
+ -----------------------------------------------------------------------------
30112
+ CompressorsTest: test_compressor_should_remove_multi-line_javascript_comments
30113
+ -----------------------------------------------------------------------------
30114
+  (0.0ms) rollback transaction
30115
+  (0.0ms) begin transaction
30116
+ ------------------------------------------------------------------------------
30117
+ CompressorsTest: test_compressor_should_remove_single-line_javascript_comments
30118
+ ------------------------------------------------------------------------------
30119
+  (0.0ms) rollback transaction
30120
+  (0.0ms) begin transaction
30121
+ ----------------------------------------------------
30122
+ ControllersTest: test_index_should_have_html_imports
30123
+ ----------------------------------------------------
30124
+ Processing by DummyController#index as HTML
30125
+ Rendered dummy/index.html.erb within layouts/application (2.0ms)
30126
+ Completed 200 OK in 30ms (Views: 29.3ms | ActiveRecord: 0.0ms)
30127
+  (0.1ms) rollback transaction
30128
+  (0.0ms) begin transaction
30129
+ --------------------------------------
30130
+ ControllersTest: test_should_get_index
30131
+ --------------------------------------
30132
+ Processing by DummyController#index as HTML
30133
+ Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
30134
+  (0.1ms) rollback transaction
30135
+  (0.0ms) begin transaction
30136
+ -----------------------------------------------------------------------------------
30137
+ ControllersTest: test_the_compiled_assets_should_be_served_from_the_right_directory
30138
+ -----------------------------------------------------------------------------------
30139
+ Processing by DummyController#index as HTML
30140
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
30141
+  (0.0ms) rollback transaction
30142
+  (0.0ms) begin transaction
30143
+ -------------------------------------------------------------------------
30144
+ ControllersTest: test_the_test_files_should_get_compiled_and_concatenated
30145
+ -------------------------------------------------------------------------
30146
+ Processing by DummyController#assets as HTML
30147
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
30148
+  (0.1ms) rollback transaction
30149
+  (0.0ms) begin transaction
30150
+ ---------------------
30151
+ EmceeTest: test_truth
30152
+ ---------------------
30153
+  (0.0ms) rollback transaction
30154
+  (0.0ms) begin transaction
30155
+ -------------------------------------
30156
+ Helpers: test_html_import_should_work
30157
+ -------------------------------------
30158
+  (0.0ms) rollback transaction
30159
+  (0.1ms) begin transaction
30160
+ ---------------------------------------------------
30161
+ ProcessorsTest: test_processing_imports_should_work
30162
+ ---------------------------------------------------
30163
+  (0.0ms) rollback transaction
30164
+  (0.0ms) begin transaction
30165
+ ---------------------------------------------------
30166
+ ProcessorsTest: test_processing_scripts_should_work
30167
+ ---------------------------------------------------
30168
+  (0.0ms) rollback transaction
30169
+  (0.0ms) begin transaction
30170
+ -------------------------------------------------------
30171
+ ProcessorsTest: test_processing_stylesheets_should_work
29461
30172
  -------------------------------------------------------
29462
30173
   (0.0ms) rollback transaction
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emcee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.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-03-25 00:00:00.000000000 Z
11
+ date: 2014-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: railties
14
+ name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
- - !ruby/object:Gem::Dependency
28
- name: sprockets-rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: sqlite3
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +38,6 @@ dependencies:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '4.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '4.0'
69
41
  description: Add web components to the rails asset pipeline
70
42
  email:
71
43
  - andrew@legion.io
@@ -82,10 +54,7 @@ files:
82
54
  - lib/emcee/helpers/sprockets/compressing_helpers.rb
83
55
  - lib/emcee/helpers/sprockets/view_helpers.rb
84
56
  - lib/emcee/processors/html_processor.rb
85
- - lib/emcee/processors/processor_base.rb
86
- - lib/emcee/processors/processor_imports.rb
87
- - lib/emcee/processors/processor_scripts.rb
88
- - lib/emcee/processors/processor_stylesheets.rb
57
+ - lib/emcee/processors/processor_includes.rb
89
58
  - lib/emcee/railtie.rb
90
59
  - lib/emcee/version.rb
91
60
  - lib/generators/emcee/install/install_generator.rb
@@ -1,57 +0,0 @@
1
- require "emcee/processors/processor_imports"
2
- require "emcee/processors/processor_scripts"
3
- require "emcee/processors/processor_stylesheets"
4
-
5
- module Emcee
6
- module Processors
7
- # This module has method definition that we will include into HtmlProcessor.
8
- #
9
- # We seperate these out to make them easier to test. Testing a class that inherits
10
- # from Sprockets::DirectiveProcessor (which our HtmlProcessor does) is not
11
- # straightforward.
12
- #
13
- module Includes
14
- # Match an html import tag.
15
- #
16
- # <link rel="import" href="assets/example.html">
17
- #
18
- IMPORT_PATTERN = /^\s*<link .*rel=["']import["'].*>$/
19
-
20
- # Match a stylesheet link tag.
21
- #
22
- # <link rel="stylesheet" href="assets/example.css">
23
- #
24
- STYLESHEET_PATTERN = /^\s*<link .*rel=["']stylesheet["'].*>$/
25
-
26
- # Match a script tag.
27
- #
28
- # <script src="assets/example.js"></script>
29
- #
30
- SCRIPT_PATTERN = /^\s*<script .*src=["'].+\.js["']><\/script>$/
31
-
32
- # Match the path from the href attribute of an html import or stylesheet
33
- # include tag. Captures the actual path.
34
- #
35
- # href="/assets/example.css"
36
- #
37
- HREF_PATH_PATTERN = /href=["'](?<path>[\w\.\/-]+)["']/
38
-
39
- # Match the source path from a script tag. Captures the actual path.
40
- #
41
- # src="/assets/example.js"
42
- #
43
- SRC_PATH_PATTERN = /src=["'](?<path>[\w\.\/-]+)["']/
44
-
45
- # Match the indentation whitespace of a line
46
- #
47
- INDENT_PATTERN = /^(?<indent>\s*)/
48
-
49
- # Return a file's contents as text. This is split out as a method so that
50
- # we can test the other methods in this module without actually reading from
51
- # the filesystem.
52
- def read_file(path)
53
- File.read(path)
54
- end
55
- end
56
- end
57
- end
@@ -1,19 +0,0 @@
1
- module Emcee
2
- module Processors
3
- module Includes
4
- # Scan the body for html imports. If any are found, tell sprockets to
5
- # require their files like we would for a directive. Then remove the
6
- # imports and return the new body.
7
- def process_imports(body, context, directory)
8
- body.scan(IMPORT_PATTERN) do |import_tag|
9
- if path = import_tag[HREF_PATH_PATTERN, :path]
10
- absolute_path = File.absolute_path(path, directory)
11
- context.require_asset(absolute_path)
12
- end
13
- end
14
-
15
- body.gsub(IMPORT_PATTERN, "")
16
- end
17
- end
18
- end
19
- end
@@ -1,27 +0,0 @@
1
- module Emcee
2
- module Processors
3
- module Includes
4
- # Scan the body for external script references. If any are found, inline
5
- # the files in place of the references and return the new body.
6
- def process_scripts(body, directory)
7
- to_inline = []
8
-
9
- body.scan(SCRIPT_PATTERN) do |script_tag|
10
- if path = script_tag[SRC_PATH_PATTERN, :path]
11
-
12
- indent = script_tag[INDENT_PATTERN, :indent] || ""
13
-
14
- absolute_path = File.absolute_path(path, directory)
15
- script_contents = read_file(absolute_path)
16
-
17
- to_inline << [script_tag, "#{indent}<script>#{script_contents}\n#{indent}</script>"]
18
- end
19
- end
20
-
21
- to_inline.reduce(body) do |output, (tag, contents)|
22
- output.gsub(tag, contents)
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,27 +0,0 @@
1
- module Emcee
2
- module Processors
3
- module Includes
4
- # Scan the body for external stylesheet references. If any are found,
5
- # inline the files in place of the references and return the new body.
6
- def process_stylesheets(body, directory)
7
- to_inline = []
8
-
9
- body.scan(STYLESHEET_PATTERN) do |stylesheet_tag|
10
- if path = stylesheet_tag[HREF_PATH_PATTERN, :path]
11
-
12
- indent = stylesheet_tag[INDENT_PATTERN, :indent] || ""
13
-
14
- absolute_path = File.absolute_path(path, directory)
15
- stylesheet_contents = read_file(absolute_path)
16
-
17
- to_inline << [stylesheet_tag, "#{indent}<style>#{stylesheet_contents}\n#{indent}</style>"]
18
- end
19
- end
20
-
21
- to_inline.reduce(body) do |output, (tag, contents)|
22
- output.gsub(tag, contents)
23
- end
24
- end
25
- end
26
- end
27
- end