forked from stereobooster/html_minifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
65 lines (56 loc) · 2.06 KB
/
Rakefile
File metadata and controls
65 lines (56 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require "bundler/gem_tasks"
[:build, :install, :release].each do |task_name|
Rake::Task[task_name].prerequisites << :spec
end
require 'submodule'
Submodule::Task.new do |t|
t.branch = "gh-pages"
# Tests runner commented out because version update broke this code (tests of html-minifier are green though)
t.test do
# js = []
# js << File.open(File.expand_path("../lib/js/console.js", __FILE__), "r:UTF-8").read
# %w{htmlparser htmllint htmlminifier}.each do |i|
# js << File.open("src/#{i}.js", "r:UTF-8").read
# end
# js << File.open("tests/qunit.js", "r:UTF-8").read.gsub('}( (function() {return this;}.call()) ));', '}( this ));')
# js << File.open(File.expand_path("../spec/qunit_helper.js", __FILE__), "r:UTF-8").read
# %w{minify_test lint_test}.each do |i|
# js << File.open("tests/#{i}.js", "r:UTF-8").read
# end
# js = js.join("\n")
# js = "function globe(){#{js};return this};var global = new globe();"
# require "execjs"
# context = ExecJS.compile js
# result = context.exec "return global.QUnit.result();"
# if result["fail"] > 0 && result["assertions"].respond_to?(:each)
# puts "Failures:"
# i = 1
# result["assertions"].each do |test, details|
# puts " #{i}) #{test}"
# puts " Failure/Error: #{details[0]}"
# puts " expected: #{details[1].inspect}"
# puts " got: #{details[2].inspect}"
# i+=1
# end
# end
# # (#{result['pass_asserions']}) (#{result['fail_asserions']})
# puts "Pass: #{result['pass']}, Fail: #{result['fail']}"
# if result["fail"] > 0
# abort
# end
end
t.after_pull do
%w{htmlparser htmllint htmlminifier}.each do |i|
cp "vendor/html-minifier/src/#{i}.js", "lib/js/#{i}.js"
sh "git add lib/js/#{i}.js"
end
end
end
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new
task :default => [:spec, "submodule:test"]
#desc "Generate code coverage"
# RSpec::Core::RakeTask.new(:coverage) do |t|
# t.rcov = true
# t.rcov_opts = ["--exclude", "spec"]
# end