Sha256: 7d1337b0d28b69a418aaf2d54efa0a61b1c1c0651915e68bc0d7980d8a6c047d

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

class Licit::Command

  def run
    licenser = Licit::Licenser.new load_config
    if ARGV[0] == 'fix'
      fix licenser
    else
      check licenser
    end
  end

  def check(licenser)
    (licenser.check_files | licenser.check_headers).each do |severity, file, message|
      puts message
    end
  end

  def fix(licenser)
    licenser.fix_files
    licenser.fix_headers
  end

  def load_config
    config_file = find_file ['licit.yml', 'config/licit.yml']
    unless config_file
      puts "Could not find licit.yml config file"
      exit 1
    end
    YAML.load_file(config_file).each_with_object({}) { |(k,v), h| h[k.to_sym] = v }
  end

  def find_file probes
    probes.each do |file|
      return file if File.exist? file
    end
    nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
licit-0.1 lib/licit/command.rb
licit-0.0.1 lib/licit/command.rb