require 'sasslint' module RuleImporter def self.import target_dir = File.join(SassLint.gem_root, 'lib', 'sasslint', 'rules', 'css') input_files = File.join(SassLint.gem_root, 'lib', 'sasslint', 'rules', 'js', '*.js') Dir.glob(input_files) do |js_file| rb_file_name = "#{File.basename(js_file, '.*')}.rb" rb_file = File.new(File.join(target_dir, rb_file_name), 'w+') rb_file.puts "\# This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules" rb_file.puts "\#" rb_file.puts "\#" rb_file.puts "\# Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved." rb_file.puts "\# TODO: Paste the CSSLint LICENSE here." rb_file.puts "\#" rb_file.puts "\#" File.open(js_file).each do |line| rb_file.puts "\# #{line}" end rb_file.close end end end