rake-pipeline-web-filters-fork 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +11 -0
  4. data/.yardopts +2 -0
  5. data/Gemfile +6 -0
  6. data/README.markdown +58 -0
  7. data/README.yard +25 -0
  8. data/Rakefile +10 -0
  9. data/lib/rake-pipeline-web-filters.rb +31 -0
  10. data/lib/rake-pipeline-web-filters/cache_buster_filter.rb +42 -0
  11. data/lib/rake-pipeline-web-filters/chained_filter.rb +116 -0
  12. data/lib/rake-pipeline-web-filters/coffee_script_filter.rb +41 -0
  13. data/lib/rake-pipeline-web-filters/filter_with_dependencies.rb +27 -0
  14. data/lib/rake-pipeline-web-filters/gzip_filter.rb +59 -0
  15. data/lib/rake-pipeline-web-filters/handlebars_filter.rb +62 -0
  16. data/lib/rake-pipeline-web-filters/helpers.rb +138 -0
  17. data/lib/rake-pipeline-web-filters/iife_filter.rb +38 -0
  18. data/lib/rake-pipeline-web-filters/jade_filter.rb +61 -0
  19. data/lib/rake-pipeline-web-filters/less_filter.rb +55 -0
  20. data/lib/rake-pipeline-web-filters/markdown_filter.rb +70 -0
  21. data/lib/rake-pipeline-web-filters/minispade_filter.rb +63 -0
  22. data/lib/rake-pipeline-web-filters/neuter_filter.rb +110 -0
  23. data/lib/rake-pipeline-web-filters/sass_filter.rb +87 -0
  24. data/lib/rake-pipeline-web-filters/stylus_filter.rb +59 -0
  25. data/lib/rake-pipeline-web-filters/tilt_filter.rb +70 -0
  26. data/lib/rake-pipeline-web-filters/uglify_filter.rb +82 -0
  27. data/lib/rake-pipeline-web-filters/version.rb +9 -0
  28. data/lib/rake-pipeline-web-filters/yui_css_filter.rb +70 -0
  29. data/lib/rake-pipeline-web-filters/yui_javascript_filter.rb +59 -0
  30. data/rake-pipeline-web-filters.gemspec +33 -0
  31. data/spec/cache_buster_filter_spec.rb +108 -0
  32. data/spec/chained_filter_spec.rb +79 -0
  33. data/spec/coffee_script_filter_spec.rb +113 -0
  34. data/spec/gzip_filter_spec.rb +52 -0
  35. data/spec/handlebars_filter_spec.rb +73 -0
  36. data/spec/helpers_spec.rb +146 -0
  37. data/spec/iife_filter_spec.rb +58 -0
  38. data/spec/jade_filter_spec.rb +92 -0
  39. data/spec/less_filter_spec.rb +62 -0
  40. data/spec/markdown_filter_spec.rb +89 -0
  41. data/spec/minispade_filter_spec.rb +82 -0
  42. data/spec/neuter_filter_spec.rb +216 -0
  43. data/spec/sass_filter_spec.rb +152 -0
  44. data/spec/spec_helper.rb +28 -0
  45. data/spec/stylus_filter_spec.rb +72 -0
  46. data/spec/support/spec_helpers/file_utils.rb +33 -0
  47. data/spec/support/spec_helpers/filters.rb +37 -0
  48. data/spec/support/spec_helpers/input_helpers.rb +23 -0
  49. data/spec/support/spec_helpers/memory_file_wrapper.rb +38 -0
  50. data/spec/support/spec_helpers/memory_manifest.rb +19 -0
  51. data/spec/tilt_filter_spec.rb +82 -0
  52. data/spec/uglify_filter_spec.rb +128 -0
  53. data/spec/yui_css_filter_spec.rb +91 -0
  54. data/spec/yui_javascript_filter_spec.rb +71 -0
  55. metadata +308 -0
@@ -0,0 +1,91 @@
1
+ describe "YUICssFilter" do
2
+ YUICssFilter ||= Rake::Pipeline::Web::Filters::YUICssFilter
3
+ MemoryFileWrapper ||= Rake::Pipeline::SpecHelpers::MemoryFileWrapper
4
+ MemoryManifest ||= Rake::Pipeline::SpecHelpers::MemoryManifest
5
+
6
+ let(:css_input) { <<-HERE }
7
+ div.error {
8
+ color: red;
9
+ }
10
+ div.warning {
11
+ display: none;
12
+ }
13
+ HERE
14
+
15
+ let(:expected_css_output) {
16
+ 'div.error{color:red}div.warning{display:none}'
17
+ }
18
+
19
+ let(:expected_linebreak_css_output) {
20
+ %[div.error{color:red}\ndiv.warning{display:none}]
21
+ }
22
+
23
+ def input_file(name, content)
24
+ MemoryFileWrapper.new("/path/to/input", name, "UTF-8", content)
25
+ end
26
+
27
+ def output_file(name)
28
+ MemoryFileWrapper.new("/path/to/output", name, "UTF-8")
29
+ end
30
+
31
+ def setup_filter(filter)
32
+ filter.file_wrapper_class = MemoryFileWrapper
33
+ filter.manifest = MemoryManifest.new
34
+ filter.last_manifest = MemoryManifest.new
35
+ filter.input_files = [input_file("error.css", css_input)]
36
+ filter.output_root = "/path/to/output"
37
+ filter.rake_application = Rake::Application.new
38
+ filter
39
+ end
40
+
41
+ it "generates output" do
42
+ filter = setup_filter YUICssFilter.new
43
+
44
+ filter.output_files.should == [output_file("error.min.css")]
45
+
46
+ tasks = filter.generate_rake_tasks
47
+ tasks.each(&:invoke)
48
+
49
+ file = MemoryFileWrapper.files["/path/to/output/error.min.css"]
50
+ file.body.should == expected_css_output
51
+ file.encoding.should == "UTF-8"
52
+ end
53
+
54
+ it "skips files named .min" do
55
+ filter = setup_filter YUICssFilter.new
56
+
57
+ filter.input_files = [input_file("error.min.css", "fake-css")]
58
+
59
+ filter.output_files.should == [output_file("error.min.css")]
60
+
61
+ tasks = filter.generate_rake_tasks
62
+ tasks.each(&:invoke)
63
+
64
+ file = MemoryFileWrapper.files["/path/to/output/error.min.css"]
65
+ file.body.should == "fake-css"
66
+ file.encoding.should == "UTF-8"
67
+ end
68
+
69
+ describe "naming output files" do
70
+ it "translates .css extensions to .min.css by default" do
71
+ filter = setup_filter YUICssFilter.new
72
+ filter.output_files.first.path.should == "error.min.css"
73
+ end
74
+
75
+ it "accepts a block to customize output file names" do
76
+ filter = setup_filter(YUICssFilter.new { |input| "octopus" })
77
+ filter.output_files.first.path.should == "octopus"
78
+ end
79
+ end
80
+
81
+ it "accepts options to pass to the YUI compressor" do
82
+ filter = setup_filter(YUICssFilter.new(:line_break => 0))
83
+ filter.input_files = [input_file("error.css", css_input)]
84
+ tasks = filter.generate_rake_tasks
85
+ tasks.each(&:invoke)
86
+ file = MemoryFileWrapper.files["/path/to/output/error.min.css"]
87
+ file.body.should == expected_linebreak_css_output
88
+ end
89
+
90
+ end
91
+
@@ -0,0 +1,71 @@
1
+ describe "YUIJavaScriptFilter" do
2
+ YUIFilter ||= Rake::Pipeline::Web::Filters::YUIJavaScriptFilter
3
+ MemoryFileWrapper ||= Rake::Pipeline::SpecHelpers::MemoryFileWrapper
4
+ MemoryManifest ||= Rake::Pipeline::SpecHelpers::MemoryManifest
5
+
6
+ let(:js_input) { <<-HERE }
7
+ var name = "Truckasaurus Gates";
8
+ console.log(name);
9
+ HERE
10
+
11
+ let(:expected_js_output) {
12
+ 'var name="Truckasaurus Gates";console.log(name);'
13
+ }
14
+
15
+ let(:expected_linebreak_js_output) {
16
+ %[var name="Truckasaurus Gates";\nconsole.log(name);]
17
+ }
18
+
19
+ def input_file(name, content)
20
+ MemoryFileWrapper.new("/path/to/input", name, "UTF-8", content)
21
+ end
22
+
23
+ def output_file(name)
24
+ MemoryFileWrapper.new("/path/to/output", name, "UTF-8")
25
+ end
26
+
27
+ def setup_filter(filter)
28
+ filter.file_wrapper_class = MemoryFileWrapper
29
+ filter.manifest = MemoryManifest.new
30
+ filter.last_manifest = MemoryManifest.new
31
+ filter.input_files = [input_file("name.js", js_input)]
32
+ filter.output_root = "/path/to/output"
33
+ filter.rake_application = Rake::Application.new
34
+ filter
35
+ end
36
+
37
+ it "generates output" do
38
+ filter = setup_filter YUIFilter.new
39
+
40
+ filter.output_files.should == [output_file("name.min.js")]
41
+
42
+ tasks = filter.generate_rake_tasks
43
+ tasks.each(&:invoke)
44
+
45
+ file = MemoryFileWrapper.files["/path/to/output/name.min.js"]
46
+ file.body.should == expected_js_output
47
+ file.encoding.should == "UTF-8"
48
+ end
49
+
50
+ describe "naming output files" do
51
+ it "translates .js extensions to .min.js by default" do
52
+ filter = setup_filter YUIFilter.new
53
+ filter.output_files.first.path.should == "name.min.js"
54
+ end
55
+
56
+ it "accepts a block to customize output file names" do
57
+ filter = setup_filter(YUIFilter.new { |input| "octopus" })
58
+ filter.output_files.first.path.should == "octopus"
59
+ end
60
+ end
61
+
62
+ it "accepts options to pass to the YUI compressor" do
63
+ filter = setup_filter(YUIFilter.new(:line_break => 0))
64
+ filter.input_files = [input_file("name.js", js_input)]
65
+ tasks = filter.generate_rake_tasks
66
+ tasks.each(&:invoke)
67
+ file = MemoryFileWrapper.files["/path/to/output/name.min.js"]
68
+ file.body.should == expected_linebreak_js_output
69
+ end
70
+
71
+ end
metadata ADDED
@@ -0,0 +1,308 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-pipeline-web-filters-fork
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 6
8
+ - 0
9
+ version: 0.6.0
10
+ platform: ruby
11
+ authors:
12
+ - Yehuda Katz
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2015-04-22 00:00:00 +08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake-pipeline
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 6
30
+ version: "0.6"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rack
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :runtime
44
+ version_requirements: *id002
45
+ - !ruby/object:Gem::Dependency
46
+ name: rspec
47
+ prerelease: false
48
+ requirement: &id003 !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ type: :development
56
+ version_requirements: *id003
57
+ - !ruby/object:Gem::Dependency
58
+ name: tilt
59
+ prerelease: false
60
+ requirement: &id004 !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ type: :development
68
+ version_requirements: *id004
69
+ - !ruby/object:Gem::Dependency
70
+ name: sass
71
+ prerelease: false
72
+ requirement: &id005 !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ type: :development
80
+ version_requirements: *id005
81
+ - !ruby/object:Gem::Dependency
82
+ name: compass
83
+ prerelease: false
84
+ requirement: &id006 !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id006
93
+ - !ruby/object:Gem::Dependency
94
+ name: coffee-script
95
+ prerelease: false
96
+ requirement: &id007 !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :development
104
+ version_requirements: *id007
105
+ - !ruby/object:Gem::Dependency
106
+ name: redcarpet
107
+ prerelease: false
108
+ requirement: &id008 !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ~>
111
+ - !ruby/object:Gem::Version
112
+ segments:
113
+ - 2
114
+ - 0
115
+ version: "2.0"
116
+ type: :development
117
+ version_requirements: *id008
118
+ - !ruby/object:Gem::Dependency
119
+ name: yui-compressor
120
+ prerelease: false
121
+ requirement: &id009 !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ type: :development
129
+ version_requirements: *id009
130
+ - !ruby/object:Gem::Dependency
131
+ name: uglifier
132
+ prerelease: false
133
+ requirement: &id010 !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ segments:
138
+ - 0
139
+ version: "0"
140
+ type: :development
141
+ version_requirements: *id010
142
+ - !ruby/object:Gem::Dependency
143
+ name: less
144
+ prerelease: false
145
+ requirement: &id011 !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ segments:
150
+ - 0
151
+ version: "0"
152
+ type: :development
153
+ version_requirements: *id011
154
+ - !ruby/object:Gem::Dependency
155
+ name: json
156
+ prerelease: false
157
+ requirement: &id012 !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ type: :development
165
+ version_requirements: *id012
166
+ - !ruby/object:Gem::Dependency
167
+ name: therubyracer
168
+ prerelease: false
169
+ requirement: &id013 !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ segments:
174
+ - 0
175
+ version: "0"
176
+ type: :development
177
+ version_requirements: *id013
178
+ - !ruby/object:Gem::Dependency
179
+ name: stylus
180
+ prerelease: false
181
+ requirement: &id014 !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ segments:
186
+ - 0
187
+ version: "0"
188
+ type: :development
189
+ version_requirements: *id014
190
+ description: A collection of web filters for rake-pipeline
191
+ email:
192
+ - wycats@gmail.com
193
+ executables: []
194
+
195
+ extensions: []
196
+
197
+ extra_rdoc_files: []
198
+
199
+ files:
200
+ - .gitignore
201
+ - .rspec
202
+ - .travis.yml
203
+ - .yardopts
204
+ - Gemfile
205
+ - README.markdown
206
+ - README.yard
207
+ - Rakefile
208
+ - lib/rake-pipeline-web-filters.rb
209
+ - lib/rake-pipeline-web-filters/cache_buster_filter.rb
210
+ - lib/rake-pipeline-web-filters/chained_filter.rb
211
+ - lib/rake-pipeline-web-filters/coffee_script_filter.rb
212
+ - lib/rake-pipeline-web-filters/filter_with_dependencies.rb
213
+ - lib/rake-pipeline-web-filters/gzip_filter.rb
214
+ - lib/rake-pipeline-web-filters/handlebars_filter.rb
215
+ - lib/rake-pipeline-web-filters/helpers.rb
216
+ - lib/rake-pipeline-web-filters/iife_filter.rb
217
+ - lib/rake-pipeline-web-filters/jade_filter.rb
218
+ - lib/rake-pipeline-web-filters/less_filter.rb
219
+ - lib/rake-pipeline-web-filters/markdown_filter.rb
220
+ - lib/rake-pipeline-web-filters/minispade_filter.rb
221
+ - lib/rake-pipeline-web-filters/neuter_filter.rb
222
+ - lib/rake-pipeline-web-filters/sass_filter.rb
223
+ - lib/rake-pipeline-web-filters/stylus_filter.rb
224
+ - lib/rake-pipeline-web-filters/tilt_filter.rb
225
+ - lib/rake-pipeline-web-filters/uglify_filter.rb
226
+ - lib/rake-pipeline-web-filters/version.rb
227
+ - lib/rake-pipeline-web-filters/yui_css_filter.rb
228
+ - lib/rake-pipeline-web-filters/yui_javascript_filter.rb
229
+ - rake-pipeline-web-filters.gemspec
230
+ - spec/cache_buster_filter_spec.rb
231
+ - spec/chained_filter_spec.rb
232
+ - spec/coffee_script_filter_spec.rb
233
+ - spec/gzip_filter_spec.rb
234
+ - spec/handlebars_filter_spec.rb
235
+ - spec/helpers_spec.rb
236
+ - spec/iife_filter_spec.rb
237
+ - spec/jade_filter_spec.rb
238
+ - spec/less_filter_spec.rb
239
+ - spec/markdown_filter_spec.rb
240
+ - spec/minispade_filter_spec.rb
241
+ - spec/neuter_filter_spec.rb
242
+ - spec/sass_filter_spec.rb
243
+ - spec/spec_helper.rb
244
+ - spec/stylus_filter_spec.rb
245
+ - spec/support/spec_helpers/file_utils.rb
246
+ - spec/support/spec_helpers/filters.rb
247
+ - spec/support/spec_helpers/input_helpers.rb
248
+ - spec/support/spec_helpers/memory_file_wrapper.rb
249
+ - spec/support/spec_helpers/memory_manifest.rb
250
+ - spec/tilt_filter_spec.rb
251
+ - spec/uglify_filter_spec.rb
252
+ - spec/yui_css_filter_spec.rb
253
+ - spec/yui_javascript_filter_spec.rb
254
+ has_rdoc: true
255
+ homepage: http://github.com/wycats/rake-pipeline-web-filters
256
+ licenses: []
257
+
258
+ post_install_message:
259
+ rdoc_options: []
260
+
261
+ require_paths:
262
+ - lib
263
+ required_ruby_version: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - ">="
266
+ - !ruby/object:Gem::Version
267
+ segments:
268
+ - 0
269
+ version: "0"
270
+ required_rubygems_version: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - ">="
273
+ - !ruby/object:Gem::Version
274
+ segments:
275
+ - 0
276
+ version: "0"
277
+ requirements: []
278
+
279
+ rubyforge_project:
280
+ rubygems_version: 1.3.6
281
+ signing_key:
282
+ specification_version: 3
283
+ summary: Contributed filters for use in rake-pipeline that are useful for web projects, like asset management
284
+ test_files:
285
+ - spec/cache_buster_filter_spec.rb
286
+ - spec/chained_filter_spec.rb
287
+ - spec/coffee_script_filter_spec.rb
288
+ - spec/gzip_filter_spec.rb
289
+ - spec/handlebars_filter_spec.rb
290
+ - spec/helpers_spec.rb
291
+ - spec/iife_filter_spec.rb
292
+ - spec/jade_filter_spec.rb
293
+ - spec/less_filter_spec.rb
294
+ - spec/markdown_filter_spec.rb
295
+ - spec/minispade_filter_spec.rb
296
+ - spec/neuter_filter_spec.rb
297
+ - spec/sass_filter_spec.rb
298
+ - spec/spec_helper.rb
299
+ - spec/stylus_filter_spec.rb
300
+ - spec/support/spec_helpers/file_utils.rb
301
+ - spec/support/spec_helpers/filters.rb
302
+ - spec/support/spec_helpers/input_helpers.rb
303
+ - spec/support/spec_helpers/memory_file_wrapper.rb
304
+ - spec/support/spec_helpers/memory_manifest.rb
305
+ - spec/tilt_filter_spec.rb
306
+ - spec/uglify_filter_spec.rb
307
+ - spec/yui_css_filter_spec.rb
308
+ - spec/yui_javascript_filter_spec.rb