Created
June 29, 2016 17:27
-
-
Save phiggins/bab4a02141ee8231734626440f34c688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
branches = %w[ master switch-to-sassc ] | |
tmp = Pathname.new(Dir.tmpdir) | |
branches.each do |branch| | |
asset_dir = tmp + "assets_#{branch}" | |
if asset_dir.exist? | |
puts "#{asset_dir} exists, skipping" | |
next | |
end | |
FileUtils.rm_rf Rails.root + "tmp/cache" | |
FileUtils.rm_rf Rails.root + "public/assets" | |
print "precompiling #{branch}... " | |
puts(Benchmark.realtime { | |
system "git checkout #{branch} && rake assets:precompile", out: IO::NULL, err: IO::NULL | |
}) | |
FileUtils.mv (Rails.root + "public/assets"), asset_dir | |
end | |
first, second = *branches.map { |branch| | |
Dir[tmp + "assets_#{branch}" + "**" + "*.css"].sort | |
} | |
first.zip(second).each do |file1, file2| | |
puts "diffing:" | |
puts file1 | |
puts file2 | |
# Remove lines of just whitespace | |
#[file1, file2].each { |file| `sed -i "/^\s*$/d" #{file}` } | |
# Remove comments | |
#[file1, file2].each { |file| `sed -i "|^/\*|d" #{file}` } | |
css_diff = `css-diff #{file1} #{file2}` | |
if css_diff.strip == "true" | |
puts `diff --text --ignore-space-change --report-identical-files #{file1} #{file2}` | |
else | |
puts "Files are syntactically identical." | |
end | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment