Class: Licit::Command
- Inherits:
-
Object
- Object
- Licit::Command
- Defined in:
- lib/licit/command.rb
Instance Method Summary collapse
- #check(licenser) ⇒ Object
- #find_file(probes) ⇒ Object
- #fix(licenser) ⇒ Object
- #load_config ⇒ Object
- #run ⇒ Object
Instance Method Details
#check(licenser) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/licit/command.rb', line 13 def check(licenser) has_errors = false (licenser.check_files | licenser.check_headers).each do |severity, file, | puts has_errors = true if severity == :error end exit (has_errors ? 1 : 0) end |
#find_file(probes) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/licit/command.rb', line 41 def find_file probes probes.each do |file| return file if File.exist? file end nil end |
#fix(licenser) ⇒ Object
22 23 24 25 |
# File 'lib/licit/command.rb', line 22 def fix(licenser) licenser.fix_files licenser.fix_headers end |
#load_config ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/licit/command.rb', line 27 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 config = {} YAML.load_file(config_file).each do |key, value| config[key.to_sym] = value end config end |