Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore exercises-packed; print built filenames in single line #622

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exercises-packed
10 changes: 8 additions & 2 deletions build/pack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,20 @@ def uglifier_insane

FileUtils.mkdir_p("exercises-packed")

Dir["exercises/**/*.html"].each do |filename|
exercises = Dir["exercises/**/*.html"]
exercises.each.with_index do |filename, i|
print "\r(#{i+1}/#{exercises.length}) #{filename}\x1b[K"
packed_filename = filename.gsub(/^exercises\//, "exercises-packed/")
next if File.exist?(packed_filename) && File.mtime(packed_filename) > File.mtime(filename)

FileUtils.mkdir_p(File.dirname(packed_filename))

puts filename
cant = 0
doc = Nokogiri::HTML::Document.parse(File.read(filename))

doc.css("var").each do |var|
if var.elements.any?
puts ""
puts "-- error: JS element has children"
puts var.inner_html
exit 1
Expand All @@ -116,6 +118,7 @@ def uglifier_insane

doc.css(".graphie", "div.guess", "div.show-guess", "div.show-guess-solutionarea").each do |graphie|
if graphie.elements.any?
puts ""
puts "-- error: JS element has children"
exit 1
end
Expand All @@ -126,6 +129,7 @@ def uglifier_insane

doc.css("div.validator-function").each do |validator|
if validator.elements.any?
puts ""
puts "-- error: JS element has children"
exit 1
end
Expand Down Expand Up @@ -157,3 +161,5 @@ def uglifier_insane
f.write doc.to_html
end
end

puts ""