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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdc6b1775102883bb73d1df58558de222513bbf8
4
- data.tar.gz: 82b46f7100cba0e521ba1295fd1ef3f420f0ed11
3
+ metadata.gz: b6d8355d44d6b19158ab1c4dfe5fa211b56c1bdf
4
+ data.tar.gz: d0525691ae9ae8efa4c89deef572590b6044e04c
5
5
  SHA512:
6
- metadata.gz: 2fcfb230bb3273079f56f57b1d03a42b6cd589c56a2e23fcaa2864ae9dfe4bf83d48b4e3351bc74ee5b6934eb489b53b3a94e14ba87295fc4a8ee87802220984
7
- data.tar.gz: ded1b2e82e6743935a3d65a02f67302359c39848fb43f1acc57d8120b63aa9ad378fcdcf0ee852bd89e19166b5ff767b07ca8b5d749e136c1fd3ce105d211762
6
+ metadata.gz: 78f89c7f18ea3c85153c86e9f1797a3f337f1fde90d4db615ad9b1aa65de03edac4f0cb5003925c55e0d08ea67ba0c6776b65eed1c8060f484e1193580b2593d
7
+ data.tar.gz: 366f9d4de6324358f20109dd6b8eee5f33e600fd5be27ef0abc288ed8fed5b34e35787e6c9d3661e4a2094f7bebc81d701e528cef8600a99aa59ca8a981256be
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Ronin [![Build Status](https://api.travis-ci.org/nmilford/ronin.png)](https://travis-ci.org/nmilford/ronin) [![Gem Version](https://badge.fury.io/rb/ronin-wrapper.png)](http://badge.fury.io/rb/ronin-wrapper)
1
+ ## Ronin [![Build Status](https://api.travis-ci.org/nmilford/ronin.png)](https://travis-ci.org/nmilford/ronin) [![Coverage Status](https://coveralls.io/repos/nmilford/ronin/badge.png)](https://coveralls.io/r/nmilford/ronin) [![Gem Version](https://badge.fury.io/rb/ronin-wrapper.png)](http://badge.fury.io/rb/ronin-wrapper)
2
2
 
3
3
 
4
4
  Ronin is a tool to enable masterless configuration management.
@@ -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
@@ -17,6 +17,7 @@ require 'ronin/artifact_runner'
17
17
  require 'ronin/run_list'
18
18
  require 'ronin/config'
19
19
  require 'ronin/puppet'
20
+ require 'ronin/cache'
20
21
  require 'ronin/chef'
21
22
  require 'ronin/util'
22
23
  require 'ronin/log'
data/lib/ronin/version.rb CHANGED
@@ -15,5 +15,5 @@
15
15
  # limitations under the License.
16
16
 
17
17
  module Ronin
18
- VERSION = '0.1.0'
18
+ VERSION = '0.1.1'
19
19
  end
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.0
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-02 00:00:00.000000000 Z
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