ronin-wrapper 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ronin/cache.rb +63 -0
- data/lib/ronin/ronin.rb +1 -0
- data/lib/ronin/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d8355d44d6b19158ab1c4dfe5fa211b56c1bdf
|
4
|
+
data.tar.gz: d0525691ae9ae8efa4c89deef572590b6044e04c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f89c7f18ea3c85153c86e9f1797a3f337f1fde90d4db615ad9b1aa65de03edac4f0cb5003925c55e0d08ea67ba0c6776b65eed1c8060f484e1193580b2593d
|
7
|
+
data.tar.gz: 366f9d4de6324358f20109dd6b8eee5f33e600fd5be27ef0abc288ed8fed5b34e35787e6c9d3661e4a2094f7bebc81d701e528cef8600a99aa59ca8a981256be
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## Ronin [](https://travis-ci.org/nmilford/ronin) [](http://badge.fury.io/rb/ronin-wrapper)
|
1
|
+
## Ronin [](https://travis-ci.org/nmilford/ronin) [](https://coveralls.io/r/nmilford/ronin) [](http://badge.fury.io/rb/ronin-wrapper)
|
2
2
|
|
3
3
|
|
4
4
|
Ronin is a tool to enable masterless configuration management.
|
data/lib/ronin/cache.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Author:: Nathan Milford (<nathan@milford.io>)
|
2
|
+
# Copyright:: Copyright (c) 2013 Nathan Milford
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
require 'ronin/config'
|
17
|
+
require 'ronin/log'
|
18
|
+
require 'json'
|
19
|
+
|
20
|
+
module Ronin
|
21
|
+
module Cache
|
22
|
+
|
23
|
+
def cache_config(config)
|
24
|
+
Ronin::Log.info("Caching configuration items from etcd (#{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}) to #{Ronin::Config[:cache_path]}/config.json.")
|
25
|
+
|
26
|
+
File.open("#{Ronin::Config[:cache_path]}/config.json", "w") do |f|
|
27
|
+
f.write(config.to_json)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
module_function :cache_config
|
31
|
+
|
32
|
+
def load_cached_config
|
33
|
+
if File.exist?("#{Ronin::Config[:cache_path]}/config.json")
|
34
|
+
Ronin::Log.info("Loading cached configuration items from #{Ronin::Config[:cache_path]}/config.json.")
|
35
|
+
@config = JSON.parse(IO.read("#{Ronin::Config[:cache_path]}/config.json"))
|
36
|
+
return @config
|
37
|
+
else
|
38
|
+
abort("Connection refused by etcd host #{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}, and no cached config found at (#{Ronin::Config[:cache_path]}/config.json)")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
module_function :load_cached_config
|
42
|
+
|
43
|
+
def cache_run_list(run_list)
|
44
|
+
Ronin::Log.info("Caching run_list from etcd (#{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}) to #{Ronin::Config[:cache_path]}/run_list.json.")
|
45
|
+
File.open("#{Ronin::Config[:cache_path]}/run_list.json", "w") do |f|
|
46
|
+
f.write(run_list.to_json)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
module_function :cache_run_list
|
50
|
+
|
51
|
+
def load_cached_run_list
|
52
|
+
if File.exist?("#{Ronin::Config[:cache_path]}/run_list.json")
|
53
|
+
Ronin::Log.info("Loading cached run list items from #{Ronin::Config[:cache_path]}/run_list.json.")
|
54
|
+
@run_list = JSON.parse(IO.read("#{Ronin::Config[:cache_path]}/run_list.json"))
|
55
|
+
return @run_list
|
56
|
+
else
|
57
|
+
abort("Connection refused by etcd host #{Ronin::Config[:etcd_host]}:#{Ronin::Config[:etcd_port]}, and no cached run list found at (#{Ronin::Config[:cache_path]}/run_list.json)")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
module_function :load_cached_run_list
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
data/lib/ronin/ronin.rb
CHANGED
data/lib/ronin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Milford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.4.4
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: coveralls
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.7.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.7.0
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: travis-lint
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +219,7 @@ files:
|
|
205
219
|
- lib/ronin/ronin.rb
|
206
220
|
- lib/ronin/util.rb
|
207
221
|
- lib/ronin/config.rb
|
222
|
+
- lib/ronin/cache.rb
|
208
223
|
- lib/ronin/puppet.rb
|
209
224
|
- lib/ronin/chef.rb
|
210
225
|
- lib/ronin/git.rb
|