puppetdashboardmonitor 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/bin/puppetdashboardmonitor +31 -5
  2. metadata +1 -1
@@ -1,10 +1,36 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- require 'json'
4
- require 'yaml'
5
- require 'puppetdashboardmonitoring'
3
+ begin
4
+ require 'json'
5
+ require 'yaml'
6
+ require 'optparse'
7
+ require 'puppetdashboardmonitoring'
8
+ rescue LoadError
9
+ puts 'A required gem was not found'
10
+ exit
11
+ end
12
+
13
+ options = {}
14
+ OptionParser.new do |opts|
15
+ opts.banner = "Usage: puppetdashboardmonitor [options]"
16
+
17
+ opts.on("-v", "--verbose", "Be less quiet") do |v|
18
+ options[:verbose] = v
19
+ end
20
+
21
+ opts.on("-c", "--config FILE", "Specify the configuration file") do |conf|
22
+ options[:configfile] = conf
23
+ end
24
+
25
+ end.parse!
26
+
27
+ def run (options)
6
28
 
7
- def run
29
+ if options[:configfile].nil?
30
+ configfile = 'etc/dashboard.yaml'
31
+ else
32
+ configfile = options[:configfile]
33
+ end
8
34
 
9
35
  config = YAML::load(File.read('etc/dashboard.yaml'))
10
36
 
@@ -14,6 +40,6 @@ def run
14
40
 
15
41
  end
16
42
 
17
- output = run()
43
+ output = run(options)
18
44
  puts output.to_json
19
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetdashboardmonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: