overwatch 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,19 +1,34 @@
1
1
  # Installation
2
2
 
3
- gem install overwatch-cli
3
+ gem install overwatch
4
4
 
5
-
5
+ # Configuration
6
+
7
+ Configuration of `overwatch` can be done in one of two ways: command-line options, and a config file in the YAML format. If no config options are specified, the `overwatch` executable will look for a file called `.overwatchrc` in the `HOME_DIR` of the user that is executing the command. Parameters that can be configured in the config file are:
8
+
9
+ * Server
10
+ * Port
11
+ * API key
12
+
13
+ Even if an option is specified in the config file, it can be overridden with a command-line argument. Options ommitted will use the default values.
14
+
15
+ ## Example configuration file
16
+
17
+ server: overwatch.example.com
18
+ port: 9090
19
+ key: asdf1234asdf1234asdf1234asdf234
20
+
6
21
  # Usage
7
22
 
8
23
  I'm going to assume you've got overwatch-collection running somewhere on your local machine for the purpose of this documention.
9
-
24
+
10
25
  ## Help!
11
26
 
12
27
  All commands provide a contextual help menu. Apped `--selp` to the end of any command or subcommand to bring up its specific help menu.
13
28
 
14
29
  ## Main command
15
30
 
16
- When you install `overwatch-cli` via RubyGems, an executable, `overwatch`, is installed somewhere in your $PATH (the exact location is entirely dependent upon your Ruby/Gems setup).
31
+ When you install `overwatch` via RubyGems, an executable, `overwatch`, is installed somewhere in your $PATH (the exact location is entirely dependent upon your Ruby/Gems setup).
17
32
 
18
33
  #### Usage:
19
34
  overwatch [OPTIONS] SUBCOMMAND [ARGS] ...
@@ -30,6 +45,14 @@ When you install `overwatch-cli` via RubyGems, an executable, `overwatch`, is in
30
45
  snapshot Snapshots
31
46
 
32
47
 
48
+ #### Options
49
+ -c, --config CONFIG Overwatch config file
50
+ -k, --key KEY API key (default: nil)
51
+ -s, --server SERVER collection server (default: "localhost")
52
+ -p, --port PORT collection port (default: "9001")
53
+ -f, --format [FORMAT] format (choices: pretty, json, text) (default: "pretty")
54
+
55
+
33
56
  ## Subcommands
34
57
 
35
58
  ### overwatch run
@@ -43,14 +66,6 @@ When you install `overwatch-cli` via RubyGems, an executable, `overwatch`, is in
43
66
  SUBCOMMAND subcommand name
44
67
  [ARGS] ... subcommand arguments
45
68
 
46
- #### Options
47
-
48
- -k, --key KEY API key (default: nil)
49
- -s, --server SERVER collection server (default: "localhost")
50
- -p, --port PORT collection port (default: "9001")
51
- -f, --format [FORMAT] format (choices: pretty, json, text) (default: "pretty")
52
-
53
-
54
69
  ### overwatch resource
55
70
 
56
71
  #### Usage
@@ -71,24 +86,12 @@ When you install `overwatch-cli` via RubyGems, an executable, `overwatch`, is in
71
86
  delete delete an existing resource
72
87
  regenerate regenerate a resource's API key
73
88
 
74
- #### Options
75
-
76
- -s, --server SERVER overwatch-collection server (default: "localhost")
77
- -p, --port PORT overwatch-collection port (default: "9001")
78
- -f, --format [FORMAT] format (choices: pretty, json, text) (default: "pretty")
79
-
80
89
  ### overwatch resource list
81
90
 
82
91
  #### Usage
83
92
 
84
93
  overwatch resource list [OPTIONS]
85
94
 
86
- #### Options
87
-
88
- -s, --server SERVER overwatch-collection server (default: "localhost")
89
- -p, --port PORT overwatch-collection port (default: "9001")
90
- -f, --format [FORMAT] format (choices: pretty, json, text) (default: "pretty")
91
-
92
95
  #### Examples:
93
96
 
94
97
  Pretty format:
@@ -124,9 +127,6 @@ Plaintext format for easy piping/grepping/awking:
124
127
  #### Options
125
128
 
126
129
  -a, --attributes list all resource attributes
127
- -s, --server SERVER overwatch-collection server (default: "localhost")
128
- -p, --port PORT overwatch-collection port (default: "9001")
129
- -f, --format [FORMAT] format (choices: pretty, json, text) (default: "pretty")
130
130
 
131
131
  #### Example
132
132
 
@@ -15,13 +15,39 @@ module Overwatch
15
15
  puts "Overwatch v#{Overwatch::VERSION} (Codename: Snickelfritz)"
16
16
  exit(0)
17
17
  end
18
+
19
+ option ['-c', '--config'], "CONFIG", "config file"
20
+ option ['--dry-run'], :flag, "Dry run"
21
+ option ["-s", "--server"], "SERVER", "collection server"
22
+ option ["-p", "--port"], "PORT", "collection port"
23
+ option ["-f", "--format"], "[FORMAT]", "format (choices: pretty, json, text)"
24
+ option ["-k", "--key"], "KEY", "API key"
25
+
26
+ def config=(file)
27
+ YAML.load_file(File.expand_path(file))
28
+ end
29
+
30
+ def default_config
31
+ YAML.load_file(File.expand_path("~/.overwatchrc"))
32
+ end
18
33
 
34
+ def default_server
35
+ config['server'] || 'localhost'
36
+ end
37
+
38
+ def default_port
39
+ config['port'] || '9001'
40
+ end
41
+
42
+ def default_key
43
+ config['key'] || nil
44
+ end
45
+
46
+ def default_format
47
+ config['format'] || 'pretty'
48
+ end
49
+
19
50
  subcommand "run", "Run the client" do
20
- option ["-k", "--key"], "KEY", "API key", :default => nil
21
- option ["-s", "--server"], "SERVER", "collection server", :default => "localhost"
22
- option ["-p", "--port"], "PORT", "collection port", :default => "9001"
23
- option ["-f", "--format"], "[FORMAT]", "format (choices: pretty, json, text)", :default => "pretty"
24
-
25
51
  unless Ohai::Config[:plugin_path].include?(Overwatch.plugin_path)
26
52
  Ohai::Config[:plugin_path] << Overwatch.plugin_path
27
53
  end
@@ -41,9 +67,6 @@ module Overwatch
41
67
  end
42
68
 
43
69
  subcommand "resource", "Resources" do
44
- option ["-s", "--server"], "SERVER", "collection server", :default => "localhost"
45
- option ["-p", "--port"], "PORT", "collection port", :default => "9001"
46
- option ["-f", "--format"], "[FORMAT]", "format (choices: pretty, json, text)", :default => "pretty"
47
70
 
48
71
  subcommand "list", "list all resources" do
49
72
  def execute
@@ -1,3 +1,3 @@
1
1
  module Overwatch
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: overwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
16
- requirement: &70099985810320 !ruby/object:Gem::Requirement
16
+ requirement: &70112145225220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70099985810320
24
+ version_requirements: *70112145225220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &70099985807460 !ruby/object:Gem::Requirement
27
+ requirement: &70112145222840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70099985807460
35
+ version_requirements: *70112145222840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: clamp
38
- requirement: &70099985791040 !ruby/object:Gem::Requirement
38
+ requirement: &70112145221540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70099985791040
46
+ version_requirements: *70112145221540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: formatador
49
- requirement: &70099985790200 !ruby/object:Gem::Requirement
49
+ requirement: &70112145219940 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.2.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70099985790200
57
+ version_requirements: *70112145219940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hirb
60
- requirement: &70099985789020 !ruby/object:Gem::Requirement
60
+ requirement: &70112145218420 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.4.5
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70099985789020
68
+ version_requirements: *70112145218420
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70099985787780 !ruby/object:Gem::Requirement
71
+ requirement: &70112145217220 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.6.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70099985787780
79
+ version_requirements: *70112145217220
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: spork
82
- requirement: &70099985786240 !ruby/object:Gem::Requirement
82
+ requirement: &70112145216160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.9.0.rc8
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70099985786240
90
+ version_requirements: *70112145216160
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: watchr
93
- requirement: &70099985784720 !ruby/object:Gem::Requirement
93
+ requirement: &70112145213420 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0.7'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70099985784720
101
+ version_requirements: *70112145213420
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: json_spec
104
- requirement: &70099985782820 !ruby/object:Gem::Requirement
104
+ requirement: &70112145212060 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 0.5.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70099985782820
112
+ version_requirements: *70112145212060
113
113
  description: overwatch is the command-line interface to the Overwatch monitoring suite
114
114
  email:
115
115
  - dan@appliedawesome.com
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  segments:
148
148
  - 0
149
- hash: -3947530879652547069
149
+ hash: -2779688634827524436
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  segments:
157
157
  - 0
158
- hash: -3947530879652547069
158
+ hash: -2779688634827524436
159
159
  requirements: []
160
160
  rubyforge_project: overwatch
161
161
  rubygems_version: 1.8.6