Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env ruby
# frozen_string_literal: true
class String
def underscore
return self unless /[A-Z-]|::/.match?(self)
word = to_s.gsub("::", "/")
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
word.tr!("-", "_")
word.downcase!
word
end
end
less_file = File.expand_path("../app/javascript/semantic_ui/site/globals/site.variables", __dir__)
scss_file = File.expand_path("../app/javascript/stylesheets/variables.scss", __dir__)
abort("File not found #{less_file}") unless File.exist?(less_file)
abort("File not found #{scss_file}") unless File.exist?(scss_file)
less_lines = File.readlines(less_file).each
scss_lines = File.readlines(scss_file).each
i = 0
loop do
less = less_lines.next
scss = scss_lines.next
less_compare = less.strip.underscore.gsub(/(\@|\$)/, "")
scss_compare = scss.strip.underscore.gsub(/(\@|\$)/, "")
i += 1
unless less_compare == scss_compare
print "Expected '#{less.strip}' to equal '#{scss.strip}' on line: #{i}\n"
abort
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.