Sha256: 88858bbd96406421504b75111f80365fa5042ae84123e6c1176d5ff38b2a0908
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true $LOAD_PATH.unshift("#{__dir__}/../lib") require 'rubocop' require 'erb_lint/cli' require 'scss_lint' require 'scss_lint/cli' require 'colorize' def parse_opts(args) options = OpenStruct.new options.auto_correct = false parser = OptionParser.new do |opts| opts.banner = 'Usage: niftany [options]' opts.on('-a', '--auto-correct', 'Correct violations') do |auto| options.auto_correct = auto end opts.on_tail('-h', '--help', 'Show this message') do puts opts exit end end parser.parse!(args) options end def rubocop_options(options) return [] unless options.auto_correct ['--auto-correct'] end def erblint_options(options) return ['--lint-all'] unless options.auto_correct ['--lint-all', '--autocorrect'] end options = parse_opts(ARGV) result = 0 puts 'Running Rubocop'.yellow rubocop = RuboCop::CLI.new.run(rubocop_options(options)) # returns integer if rubocop.zero? puts 'Rubocop OK!'.green else result = 1 puts 'Rubocop FAILED!'.red end puts 'Running ERBLint'.yellow erblint = ERBLint::CLI.new.run(erblint_options(options)) # returns boolean if erblint puts 'ERBLint OK!'.green else result = 1 puts 'ERBLint FAILED!'.red end puts 'Running SCSSLint'.yellow logger = SCSSLint::Logger.new(STDOUT) scss_lint = SCSSLint::CLI.new(logger).run(ARGV) # returns integer if scss_lint.zero? puts 'SCSSLint OK!'.green else result = 1 puts 'SCSSLint FAILED!'.red end exit result
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
niftany-0.3.0 | exe/niftany |
niftany-0.2.0 | exe/niftany |
niftany-0.1.0 | exe/niftany |