fog_tracker 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -1
- data/LICENSE.TXT +10 -0
- data/lib/fog_tracker/tracker.rb +14 -0
- data/lib/fog_tracker/util/hash_symbolize_keys.rb +18 -0
- data/lib/fog_tracker/version.rb +1 -1
- data/spec/lib/fog_tracker/tracker_spec.rb +3 -3
- metadata +21 -19
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--no-private --protected lib/**/*.rb
|
1
|
+
--no-private --protected lib/**/*.rb - LICENSE.TXT
|
data/LICENSE.TXT
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
----------------
|
2
|
+
*MIT License*
|
3
|
+
|
4
|
+
Copyright (c) 2012 Benton Roberts
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
9
|
+
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/fog_tracker/tracker.rb
CHANGED
@@ -23,6 +23,7 @@ module FogTracker
|
|
23
23
|
@log = options[:logger] || FogTracker.default_logger
|
24
24
|
@error_proc = options[:error_callback]
|
25
25
|
@running = false
|
26
|
+
validate_accounts # Make sure account data are OK
|
26
27
|
# Create a Hash that maps account names to AccountTrackers
|
27
28
|
create_trackers
|
28
29
|
end
|
@@ -123,5 +124,18 @@ module FogTracker
|
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|
127
|
+
# Changes Strings to Symbols in Account keys
|
128
|
+
def validate_accounts
|
129
|
+
@accounts.each do |name, account|
|
130
|
+
account.symbolize_keys(recursive = false)
|
131
|
+
raise "Account #{name} defines no service" if not account[:service]
|
132
|
+
raise "Account #{name} defines no provider" if not account[:provider]
|
133
|
+
raise "Account #{name} defines no credentials" if not account[:credentials]
|
134
|
+
account[:exclude_resources] = account[:exclude_resources].map do |r|
|
135
|
+
r.to_sym
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
126
140
|
end
|
127
141
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Turns all String keys in hash into Symbols -- but ONLY IF
|
2
|
+
# there's not already an existing symbol matching the String key
|
3
|
+
class Hash
|
4
|
+
def symbolize_keys(recurse = true)
|
5
|
+
keys_do_delete = Array.new
|
6
|
+
each do |k,v|
|
7
|
+
if (k.instance_of? String) and (not has_key? k.to_sym)
|
8
|
+
keys_do_delete << k
|
9
|
+
end
|
10
|
+
v.symbolize_keys(true) if (recurse && v.instance_of?(Hash))
|
11
|
+
end
|
12
|
+
keys_do_delete.each do |k|
|
13
|
+
store(k.to_sym, fetch(k))
|
14
|
+
delete k
|
15
|
+
end
|
16
|
+
self
|
17
|
+
end
|
18
|
+
end
|
data/lib/fog_tracker/version.rb
CHANGED
@@ -3,16 +3,16 @@ module FogTracker
|
|
3
3
|
|
4
4
|
ACCOUNTS = {
|
5
5
|
"fake account 1" => {
|
6
|
-
|
6
|
+
'provider' => 'AWS',
|
7
7
|
:service => 'Compute',
|
8
8
|
:credentials => {
|
9
9
|
:aws_access_key_id => 'X',
|
10
10
|
:aws_secret_access_key => 'X'
|
11
|
-
},
|
11
|
+
}, 'exclude_resources' => [ 'spot_requests' ]
|
12
12
|
},
|
13
13
|
"fake account 2" => {
|
14
14
|
:provider => 'AWS',
|
15
|
-
|
15
|
+
'service' => 'Compute',
|
16
16
|
:credentials => {
|
17
17
|
:aws_access_key_id => 'X',
|
18
18
|
:aws_secret_access_key => 'X'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement: &
|
16
|
+
requirement: &70195351793220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70195351793220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70195351791880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70195351791880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70195351791000 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70195351791000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70195351805900 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70195351805900
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard
|
60
|
-
requirement: &
|
60
|
+
requirement: &70195351804740 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70195351804740
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70195351803720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70195351803720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ruby_gntp
|
82
|
-
requirement: &
|
82
|
+
requirement: &70195351802740 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70195351802740
|
91
91
|
description: This gem peridically polls mutiple cloud computing services using the
|
92
92
|
fog gem, asynchronously updating the state of the resulting collections of Fog Resources.
|
93
93
|
email:
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- .yardopts
|
102
102
|
- Gemfile
|
103
103
|
- Guardfile
|
104
|
+
- LICENSE.TXT
|
104
105
|
- README.md
|
105
106
|
- Rakefile
|
106
107
|
- bin/fog_tracker
|
@@ -112,6 +113,7 @@ files:
|
|
112
113
|
- lib/fog_tracker/extensions/fog_model.rb
|
113
114
|
- lib/fog_tracker/query/query_processor.rb
|
114
115
|
- lib/fog_tracker/tracker.rb
|
116
|
+
- lib/fog_tracker/util/hash_symbolize_keys.rb
|
115
117
|
- lib/fog_tracker/util/string_underscore.rb
|
116
118
|
- lib/fog_tracker/version.rb
|
117
119
|
- lib/tasks/rspec.rake
|
@@ -138,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
140
|
version: '0'
|
139
141
|
segments:
|
140
142
|
- 0
|
141
|
-
hash: -
|
143
|
+
hash: -2147885570777585373
|
142
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
145
|
none: false
|
144
146
|
requirements:
|
@@ -147,10 +149,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
149
|
version: '0'
|
148
150
|
segments:
|
149
151
|
- 0
|
150
|
-
hash: -
|
152
|
+
hash: -2147885570777585373
|
151
153
|
requirements: []
|
152
154
|
rubyforge_project: fog_tracker
|
153
|
-
rubygems_version: 1.8.
|
155
|
+
rubygems_version: 1.8.15
|
154
156
|
signing_key:
|
155
157
|
specification_version: 3
|
156
158
|
summary: Tracks the state of cloud computing resources across multiple accounts with
|