Sha256: a27aadca46306d0cf6711804c0344c656b52912200b2df9a13632bc112f9825e
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 KB
Contents
#!/usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '../lib') if ENV['CODEQA_DEV'] require 'rubygems' require 'codeqa' require 'pathname' require 'optparse' options = { :silent => false, :failfast => false } ARGV.options do |opts| opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [OPTIONS] FILES" opts.separator '' opts.separator 'Specific Options:' opts.on('-s', '--silent', 'No output if no error') do options[:silent] = true end opts.on('-f', '--fail-fast', 'Fail right after the first error.') do options[:failfast] = true end opts.on('-i', '--install', 'Install a basic pre-commit hook.') do options[:install] = true end opts.separator 'Common Options:' opts.on('-h', '--help', 'Show this message.') do puts opts exit end opts.on('-v', '--version', "Show version (it's #{Codeqa::VERSION})") do puts Codeqa::VERSION exit end begin opts.parse! rescue puts opts exit end end if options[:install] Codeqa.install(ARGV.first || '.') exit end exploded_args = ARGV.map do |e| if File.directory?(e) Dir["#{e}/**/*"] else e end end files_to_check = exploded_args. flatten. map{ |e| Pathname.new(e).realpath.to_s }. reject{ |e| File.directory?(e) || Codeqa.configuration.excluded?(e) }. uniq puts "#{files_to_check.count} files to check" unless options[:silent] if options[:failfast] # all? is already lazy/fail-fast so it will stop after the first false exit 1 unless files_to_check.all?{ |e| Codeqa.check(e, options) } else exit 1 unless files_to_check.map{ |e| Codeqa.check(e, options) }.all? end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
codeqa-0.4.0.pre | bin/codeqa |
codeqa-0.3.1 | bin/codeqa |
codeqa-0.3.0 | bin/codeqa |