Class: PuppetGhostbuster::Bin

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-ghostbuster/bin.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Bin

Returns a new instance of Bin.



3
4
5
# File 'lib/puppet-ghostbuster/bin.rb', line 3

def initialize(args)
  @args = args
end

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/puppet-ghostbuster/bin.rb', line 7

def run
  opts = PuppetGhostbuster::OptParser.build

  begin
    opts.parse!(@args)
  rescue OptionParser::InvalidOption
    puts "puppet-ghostbuster: #{$!.message}"
    puts "puppet-ghostbuster: try 'puppet-ghostbuster --help' for more information"
    return 1
  end

  if PuppetGhostbuster.configuration.display_version
    puts "puppet-ghostbuster #{PuppetGhostbuster::VERSION}"
    return 0
  end

  if @args[0].nil?
    PuppetGhostbuster.new().run
  else
    PuppetGhostbuster.new(@args[0]).run
  end

  exit 0
end