Class: Gemometer::CLI

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



10
11
12
13
14
# File 'lib/gemometer/cli.rb', line 10

def initialize(args)
  @notifier_name = args.shift
  @options = OpenStruct.new
  parse_args(args)
end

Instance Attribute Details

#notifier_nameObject (readonly)

Returns the value of attribute notifier_name.



8
9
10
# File 'lib/gemometer/cli.rb', line 8

def notifier_name
  @notifier_name
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/gemometer/cli.rb', line 8

def options
  @options
end

Class Method Details

.start(args) ⇒ Object



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

def self.start(args)
  new(args).notify
end

Instance Method Details

#notifyObject



20
21
22
23
24
25
26
27
# File 'lib/gemometer/cli.rb', line 20

def notify
  begin
    options.gems = gems
    notifier_class.new(options.to_h).notify
  rescue Gemometer::NotifyError => e
    abort(e.message)
  end
end