slurry 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/slurry +44 -3
  2. metadata +17 -3
  3. data/bin/clean +0 -10
  4. data/bin/report +0 -10
data/bin/slurry CHANGED
@@ -1,11 +1,52 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
+ require 'yaml'
4
+ require 'optparse'
3
5
  require 'slurry'
4
6
 
7
+ # Load the command line options
8
+ options = {}
9
+ OptionParser.new do |opts|
10
+ opts.banner = "Usage: vspheremonitor [options]"
5
11
 
6
- def run
7
- Slurry.funnel
12
+ opts.on("-v", "--verbose", "Be less quiet") do |v|
13
+ options[:verbose] = v
14
+ end
15
+
16
+ opts.on("-c", "--config FILE", "Specify the configuration file") do |conf|
17
+ options[:configfile] = conf
18
+ end
19
+
20
+ opts.on("-t", "--type [clean|report]", "The type of run to perform") do |t|
21
+ options[:type] = t
22
+ end
23
+
24
+ end.parse!
25
+
26
+ def run(options)
27
+
28
+ # Determine if we should load the default configuration file
29
+ if options[:configfile].nil?
30
+ configfile = 'etc/slurry.yaml'
31
+ else
32
+ configfile = options[:configfile]
33
+ end
34
+
35
+ # Load the configuration file
36
+ config = YAML::load(File.read(configfile))
37
+
38
+ # Determin what kind of run we are asked to perform
39
+ case options[:type]
40
+ when "clean" # Remove everything from the cache
41
+ Slurry.clean
42
+ when "report" # Report on the state of the cache
43
+ Slurry.report
44
+ when "liaise" # Show the json around the floor
45
+ Slurry.liaise(config[:server],config[:port])
46
+ else # Load json data from stdin
47
+ Slurry.funnel
48
+ end
8
49
 
9
50
  end
10
51
 
11
- run()
52
+ run(options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slurry
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:
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json2graphite
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  description: A tool that caches json for graphite.
31
47
  email: xaque208@gmail.com
32
48
  executables:
@@ -35,9 +51,7 @@ extensions: []
35
51
  extra_rdoc_files: []
36
52
  files:
37
53
  - Rakefile
38
- - bin/clean
39
54
  - bin/liaise
40
- - bin/report
41
55
  - bin/slurry
42
56
  - lib/slurry.rb
43
57
  - etc/slurry.yaml.sample
data/bin/clean DELETED
@@ -1,10 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'slurry'
4
-
5
-
6
- def run
7
- Slurry.clean
8
- end
9
-
10
- run()
data/bin/report DELETED
@@ -1,10 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'slurry'
4
-
5
-
6
- def run
7
- Slurry.report
8
- end
9
-
10
- run()