Class: BundlerDiff::CLI

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

Constant Summary collapse

DEFAULT_OPTIONS =
{
  commit: 'HEAD',
  format: :default
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = []) ⇒ CLI

Returns a new instance of CLI.



20
21
22
# File 'lib/bundler_diff/cli.rb', line 20

def initialize(args = [])
  @args = args
end

Class Method Details

.invoke(args = ARGV) ⇒ Object



16
17
18
# File 'lib/bundler_diff/cli.rb', line 16

def self.invoke(args = ARGV)
  new(args).invoke
end

Instance Method Details

#invokeObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bundler_diff/cli.rb', line 24

def invoke
  parse_options!
  set_access_token!

  gems = GemsComparator.compare(before_lockfile, after_lockfile)
  output = formatter.new.render(gems)
  output = JSON.dump(output) if @options[:escape_json]
  puts output
rescue StandardError => e
  puts e.inspect
end