Sha256: 9f97b8f9e19640432cee404878fa12ce9f74c7718bfa1561b1140f4e6c1a88c9

Contents?: true

Size: 888 Bytes

Versions: 1

Compression:

Stored size: 888 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sasslint-0.0.1 lib/sasslint/helpers/rule_importer.rb