Class: MetadataCop::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/metadatacop/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CLI

Returns a new instance of CLI.



5
6
7
# File 'lib/metadatacop/cli.rb', line 5

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/metadatacop/cli.rb', line 3

def options
  @options
end

Instance Method Details

#run(*paths) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/metadatacop/cli.rb', line 9

def run(*paths)
  runner = Runner.new(runner_options)
  runner.run(paths)

  report_offenses(runner.offenses)

  runner.success? ? 0 : 1
rescue StandardError => e
  $stderr.puts e.message
  $stderr.puts e.backtrace
  1
end