truth 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +40 -0
- data/LICENSE.txt +20 -0
- data/README.md +60 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bin/truth-client +11 -0
- data/bin/truth-server +1 -0
- data/lib/timeout_logic.rb +21 -0
- data/lib/truth.rb +9 -0
- data/lib/truth/client.rb +80 -0
- data/lib/truth/config.rb +89 -0
- data/lib/truth/daemon.rb +29 -0
- data/test/configs/default/config.yml +6 -0
- data/test/configs/default/data.yml +0 -0
- data/test/helper.rb +22 -0
- data/test/test_truth.rb +81 -0
- data/truth.gemspec +84 -0
- metadata +203 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem 'hiredis'
|
6
|
+
gem 'em-hiredis'
|
7
|
+
gem 'eventmachine'
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
# Add dependencies to develop your gem here.
|
12
|
+
# Include everything needed to run rake, tests, features, etc.
|
13
|
+
group :development do
|
14
|
+
gem "shoulda", ">= 0"
|
15
|
+
gem "bundler", "~> 1.0.0"
|
16
|
+
gem "jeweler", "~> 1.5.2"
|
17
|
+
gem "rcov", ">= 0"
|
18
|
+
gem 'ruby-debug'
|
19
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
columnize (0.3.2)
|
5
|
+
em-hiredis (0.0.1)
|
6
|
+
hiredis (~> 0.2.0)
|
7
|
+
eventmachine (0.12.10)
|
8
|
+
git (1.2.5)
|
9
|
+
hiredis (0.2.0)
|
10
|
+
rake-compiler (~> 0.7.1)
|
11
|
+
redis (~> 2.1.1)
|
12
|
+
jeweler (1.5.2)
|
13
|
+
bundler (~> 1.0.0)
|
14
|
+
git (>= 1.2.5)
|
15
|
+
rake
|
16
|
+
linecache (0.43)
|
17
|
+
rake (0.8.7)
|
18
|
+
rake-compiler (0.7.6)
|
19
|
+
rake
|
20
|
+
rcov (0.9.9)
|
21
|
+
redis (2.1.1)
|
22
|
+
ruby-debug (0.10.4)
|
23
|
+
columnize (>= 0.1)
|
24
|
+
ruby-debug-base (~> 0.10.4.0)
|
25
|
+
ruby-debug-base (0.10.4)
|
26
|
+
linecache (>= 0.3)
|
27
|
+
shoulda (2.11.3)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 1.0.0)
|
34
|
+
em-hiredis
|
35
|
+
eventmachine
|
36
|
+
hiredis
|
37
|
+
jeweler (~> 1.5.2)
|
38
|
+
rcov
|
39
|
+
ruby-debug
|
40
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Roman Heinrich
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
= truth
|
2
|
+
|
3
|
+
**Truth** is a command line tool to allow your Server Configuration Management
|
4
|
+
System like [Puppet] [pu] or [Chef] [ch] be controlled in ad hoc fashion
|
5
|
+
|
6
|
+
Inspiration for this gem were following articles:
|
7
|
+
|
8
|
+
* [Puppet at Loggly](http://semicomplete.com/presentations/puppet-at-loggly/puppet-at-loggly.pdf.html) (the Machine Truth slide)
|
9
|
+
* [Noah](https://github.com/lusis/Noah) (Lightweight node and service registry based on Zookeeper)
|
10
|
+
* [Ad-Hoc Configuration, Coordination and the value of change](http://lusislog.blogspot.com/2011/03/ad-hoc-configuration-coordination-and.html) by John E. Vincent
|
11
|
+
|
12
|
+
|
13
|
+
Install Truth with Rubygems:
|
14
|
+
|
15
|
+
gem install truth
|
16
|
+
|
17
|
+
Once installed, the `truth-client` command can be used to start the daemon
|
18
|
+
|
19
|
+
truth-client /etc/truth/server.yml
|
20
|
+
|
21
|
+
[pu]: http://www.puppetlabs.com/
|
22
|
+
[ch]: http://www.opscode.com/chef/
|
23
|
+
|
24
|
+
|
25
|
+
Redis 2 is used as messaging middleware because of it's simplicity and author's familiarity with it
|
26
|
+
|
27
|
+
|
28
|
+
== Contributing to truth
|
29
|
+
|
30
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
31
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
32
|
+
* Fork the project
|
33
|
+
* Start a feature/bugfix branch
|
34
|
+
* Commit and push until you are happy with your contribution
|
35
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
36
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
37
|
+
|
38
|
+
|
39
|
+
== Copyright
|
40
|
+
|
41
|
+
Copyright (c) 2011 Roman Heinrich. See LICENSE.txt for
|
42
|
+
further details.
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
# ####### Brainstorming....
|
47
|
+
# # publish servers.
|
48
|
+
#
|
49
|
+
# Playing with truth:
|
50
|
+
cat ~/.truth/config.yml
|
51
|
+
---
|
52
|
+
redis_ip: 127.0.0.1
|
53
|
+
hostname: cafe2
|
54
|
+
|
55
|
+
# > bin/truth-client ~/.truth
|
56
|
+
# > redis-cli
|
57
|
+
# .. publish truth-req.cafe2.add_info "solr_version, 222"
|
58
|
+
|
59
|
+
# > redis-cli
|
60
|
+
# .. psubscribe truth-res.cafe2.*
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "truth"
|
16
|
+
gem.homepage = "http://github.com/mindreframer/truth"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{A simple daemon for realtime server configuration}
|
19
|
+
gem.description = %Q{Uses Redis pub/sub + Eventmachine}
|
20
|
+
gem.email = "roman.heinrich@gmail.com"
|
21
|
+
gem.authors = ["Roman Heinrich"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "truth #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.6
|
data/bin/truth-client
ADDED
data/bin/truth-server
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# stolen from klarlack -- http://github.com/schoefmax/klarlack
|
2
|
+
# to get an reliable timeout that wont fail on other platforms
|
3
|
+
# or if sytem_timer is missing
|
4
|
+
Timeout = begin
|
5
|
+
# Try to use the SystemTimer gem instead of Ruby's timeout library
|
6
|
+
# when running on something that looks like Ruby 1.8.x. See:
|
7
|
+
# http://ph7spot.com/articles/system_timer
|
8
|
+
# We don't want to bother trying to load SystemTimer on jruby and
|
9
|
+
# ruby 1.9+.
|
10
|
+
if RUBY_VERSION =~ /^1\.8\./ and RUBY_PLATFORM !~ /java/
|
11
|
+
require 'system_timer'
|
12
|
+
SystemTimer
|
13
|
+
else
|
14
|
+
require 'timeout'
|
15
|
+
Timeout
|
16
|
+
end
|
17
|
+
rescue LoadError => e
|
18
|
+
$stderr.puts "Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: #{e.message}"
|
19
|
+
require 'timeout'
|
20
|
+
Timeout
|
21
|
+
end
|
data/lib/truth.rb
ADDED
data/lib/truth/client.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
module Truth
|
2
|
+
# Client contains the business logic
|
3
|
+
class Client
|
4
|
+
attr_accessor :config
|
5
|
+
def initialize(config)
|
6
|
+
self.config = config
|
7
|
+
end
|
8
|
+
|
9
|
+
# this is the entry point for the client
|
10
|
+
# channel can look like:
|
11
|
+
# truth-req.hostname.*
|
12
|
+
# truth-req.all.*
|
13
|
+
def execute_command(channel, message)
|
14
|
+
begin
|
15
|
+
response = case Client.get_command(channel)
|
16
|
+
when :add_roles
|
17
|
+
add_roles(message)
|
18
|
+
when :remove_roles
|
19
|
+
remove_roles(message)
|
20
|
+
when :add_info
|
21
|
+
add_info(message)
|
22
|
+
when :remove_info
|
23
|
+
remove_info(message)
|
24
|
+
when :set_environment
|
25
|
+
set_environment(message)
|
26
|
+
else
|
27
|
+
puts "no command for #{channel} available"
|
28
|
+
'NOT AVAILABLE'
|
29
|
+
end
|
30
|
+
rescue Exception => e
|
31
|
+
puts "ERROR: #{e}"
|
32
|
+
response = "ERROR"
|
33
|
+
end
|
34
|
+
response
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.get_command(channel)
|
38
|
+
case channel
|
39
|
+
when /add_roles$/ then :add_roles
|
40
|
+
when /remove_roles$/ then :remove_roles
|
41
|
+
when /add_info$/ then :add_info
|
42
|
+
when /remove_info$/ then :remove_info
|
43
|
+
when /set_environment$/ then :set_environment
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
#### here is the logic implementation
|
48
|
+
|
49
|
+
# add an roles array to the roles for this node
|
50
|
+
# message is a comma-separated string
|
51
|
+
def add_roles(message)
|
52
|
+
roles = message.split(',').map{|x| x.strip}
|
53
|
+
config.add_roles roles
|
54
|
+
return config.current_roles
|
55
|
+
end
|
56
|
+
|
57
|
+
# removes an roles array from the roles for this node.
|
58
|
+
# **message** is a comma-separated string
|
59
|
+
def remove_roles(message)
|
60
|
+
roles = message.split(',').map{|x| x.strip}
|
61
|
+
config.remove_roles roles
|
62
|
+
return config.current_roles
|
63
|
+
end
|
64
|
+
|
65
|
+
# add meta info to be used by your configuration management
|
66
|
+
def add_info(message)
|
67
|
+
key, value = message.split(',', 2)
|
68
|
+
config.add_info key, value.strip
|
69
|
+
end
|
70
|
+
|
71
|
+
def remove_info(message)
|
72
|
+
config.remove_info message.strip
|
73
|
+
end
|
74
|
+
|
75
|
+
# this can change the environment for this node
|
76
|
+
def set_environment(message)
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/truth/config.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
module Truth
|
2
|
+
class Config
|
3
|
+
attr_accessor :config_folder
|
4
|
+
def initialize(folder = '/etc/truth')
|
5
|
+
self.config_folder = folder
|
6
|
+
end
|
7
|
+
|
8
|
+
def redis_ip
|
9
|
+
self.config['redis_ip']
|
10
|
+
end
|
11
|
+
|
12
|
+
def environment
|
13
|
+
self.config['environment']
|
14
|
+
end
|
15
|
+
|
16
|
+
# reads the systems hostname, can be overridden in the config.yml
|
17
|
+
def hostname
|
18
|
+
self.config['hostname'] || `hostname`.strip
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def redis_client
|
23
|
+
@redis_client ||= EM::Hiredis::Client.connect(redis_ip)
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_roles(roles)
|
27
|
+
data['roles'] = (current_roles + roles).flatten.uniq
|
28
|
+
persist_data
|
29
|
+
end
|
30
|
+
|
31
|
+
def remove_roles(roles)
|
32
|
+
data['roles'] = (current_roles - roles).flatten.uniq
|
33
|
+
persist_data
|
34
|
+
end
|
35
|
+
|
36
|
+
def current_roles
|
37
|
+
data['roles'] || []
|
38
|
+
end
|
39
|
+
|
40
|
+
def data
|
41
|
+
@data ||= read_config('data.yml')
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_info(key, value)
|
45
|
+
data[key] = value
|
46
|
+
persist_data
|
47
|
+
end
|
48
|
+
|
49
|
+
def remove_info(key)
|
50
|
+
data.delete key
|
51
|
+
persist_data
|
52
|
+
end
|
53
|
+
|
54
|
+
def info(key)
|
55
|
+
data[key]
|
56
|
+
end
|
57
|
+
|
58
|
+
def data=(obj)
|
59
|
+
write_config('data.yml', obj)
|
60
|
+
end
|
61
|
+
|
62
|
+
def persist_data
|
63
|
+
write_config('data.yml', @data)
|
64
|
+
end
|
65
|
+
|
66
|
+
def config
|
67
|
+
@config ||= read_config('config.yml')
|
68
|
+
end
|
69
|
+
|
70
|
+
def full_config_path(file)
|
71
|
+
File.expand_path(File.join(config_folder,file))
|
72
|
+
end
|
73
|
+
|
74
|
+
def read_config(filename)
|
75
|
+
full_path = File.join(config_folder, filename)
|
76
|
+
raise unless File.exist?(full_path)
|
77
|
+
return YAML.load(File.read(full_path)) || {}
|
78
|
+
end
|
79
|
+
|
80
|
+
def write_config(filename, content)
|
81
|
+
full_path = File.join(config_folder, filename)
|
82
|
+
raise unless File.exist?(full_path)
|
83
|
+
content = YAML.dump(content) unless content.is_a? String
|
84
|
+
File.open(full_path, 'w') do |f|
|
85
|
+
f.puts content
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/truth/daemon.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Truth
|
2
|
+
class Daemon
|
3
|
+
def self.run(config = Config.new)
|
4
|
+
client = Client.new(config)
|
5
|
+
p "starting truth-client daemon with configs path #{config.config_folder}"
|
6
|
+
EM.run do
|
7
|
+
subscriber = config.redis_client
|
8
|
+
redis = EM::Hiredis::Client.connect
|
9
|
+
|
10
|
+
subscriber.subscribe('server.')
|
11
|
+
msg_pattern = "truth-req.#{config.hostname}.*"
|
12
|
+
all_msg_pattern = "truth-req.all.*"
|
13
|
+
subscriber.psubscribe(msg_pattern)
|
14
|
+
subscriber.psubscribe(all_msg_pattern)
|
15
|
+
puts "subscribing to patterns #{msg_pattern} and #{all_msg_pattern}"
|
16
|
+
|
17
|
+
subscriber.on(:message) do |channel, message|
|
18
|
+
p [:message, channel, message]
|
19
|
+
end
|
20
|
+
|
21
|
+
subscriber.on(:pmessage) do |key, channel, message|
|
22
|
+
p [:pmessage, key, channel, message]
|
23
|
+
res = client.execute_command(channel, message)
|
24
|
+
redis.publish "truth-res.#{config.hostname}.response", YAML.dump(res)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
File without changes
|
data/test/helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'truth'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
|
19
|
+
def configs_folder(folder='default')
|
20
|
+
File.join(File.dirname(__FILE__), 'configs', folder)
|
21
|
+
end
|
22
|
+
end
|
data/test/test_truth.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestTruth < Test::Unit::TestCase
|
4
|
+
include Truth
|
5
|
+
context 'Client' do
|
6
|
+
setup do
|
7
|
+
path = configs_folder('default')
|
8
|
+
@config = Truth::Config.new(path)
|
9
|
+
@client = Client.new(@config)
|
10
|
+
assert @client
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'get_command' do
|
14
|
+
{
|
15
|
+
"server.blade11.add_roles" => :add_roles,
|
16
|
+
"server.blade11.add_info" => :add_info,
|
17
|
+
"server.blade11.set_environment" => :set_environment
|
18
|
+
}.each do |channel, command|
|
19
|
+
should "return #{command}" do
|
20
|
+
assert_equal Client.get_command(channel), command
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
context 'Config' do
|
28
|
+
context 'config.yml' do
|
29
|
+
setup do
|
30
|
+
path = configs_folder('default')
|
31
|
+
@config = Truth::Config.new(path)
|
32
|
+
end
|
33
|
+
|
34
|
+
should "set the config_folder" do
|
35
|
+
assert_not_nil @config.config_folder, 'configs/default'
|
36
|
+
end
|
37
|
+
|
38
|
+
should "read the environment" do
|
39
|
+
assert_equal @config.environment, 'test'
|
40
|
+
end
|
41
|
+
|
42
|
+
should "read redis ip" do
|
43
|
+
assert_equal @config.redis_ip, '127.0.0.1'
|
44
|
+
end
|
45
|
+
|
46
|
+
should "read the hostname" do
|
47
|
+
assert_equal @config.hostname, 'testhost'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'data.yml' do
|
53
|
+
setup do
|
54
|
+
`cp -r #{configs_folder('default')}/ #{configs_folder('write_test')}`
|
55
|
+
path = configs_folder('write_test')
|
56
|
+
@config = Truth::Config.new(path)
|
57
|
+
end
|
58
|
+
|
59
|
+
teardown do
|
60
|
+
`rm -rf #{configs_folder('write_test')}`
|
61
|
+
end
|
62
|
+
|
63
|
+
should "read the roles" do
|
64
|
+
assert_equal @config.current_roles , []
|
65
|
+
end
|
66
|
+
|
67
|
+
should "write roles" do
|
68
|
+
@config.add_roles ['mysql_server']
|
69
|
+
assert_equal ['mysql_server'], @config.current_roles
|
70
|
+
end
|
71
|
+
|
72
|
+
should "read info" do
|
73
|
+
assert_equal @config.info('solr_version'), nil
|
74
|
+
end
|
75
|
+
|
76
|
+
should "write info" do
|
77
|
+
@config.add_info('solr_version', 33)
|
78
|
+
assert_equal @config.info('solr_version'), 33
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/truth.gemspec
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{truth}
|
8
|
+
s.version = "0.0.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Roman Heinrich"]
|
12
|
+
s.date = %q{2011-06-28}
|
13
|
+
s.description = %q{Uses Redis pub/sub + Eventmachine}
|
14
|
+
s.email = %q{roman.heinrich@gmail.com}
|
15
|
+
s.executables = ["truth-server", "truth-client"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/truth-client",
|
29
|
+
"bin/truth-server",
|
30
|
+
"lib/timeout_logic.rb",
|
31
|
+
"lib/truth.rb",
|
32
|
+
"lib/truth/client.rb",
|
33
|
+
"lib/truth/config.rb",
|
34
|
+
"lib/truth/daemon.rb",
|
35
|
+
"test/configs/default/config.yml",
|
36
|
+
"test/configs/default/data.yml",
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_truth.rb",
|
39
|
+
"truth.gemspec"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/mindreframer/truth}
|
42
|
+
s.licenses = ["MIT"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.6.2}
|
45
|
+
s.summary = %q{A simple daemon for realtime server configuration}
|
46
|
+
s.test_files = [
|
47
|
+
"test/helper.rb",
|
48
|
+
"test/test_truth.rb"
|
49
|
+
]
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_runtime_dependency(%q<hiredis>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<em-hiredis>, [">= 0"])
|
57
|
+
s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
60
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
61
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<hiredis>, [">= 0"])
|
65
|
+
s.add_dependency(%q<em-hiredis>, [">= 0"])
|
66
|
+
s.add_dependency(%q<eventmachine>, [">= 0"])
|
67
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
70
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
71
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
72
|
+
end
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<hiredis>, [">= 0"])
|
75
|
+
s.add_dependency(%q<em-hiredis>, [">= 0"])
|
76
|
+
s.add_dependency(%q<eventmachine>, [">= 0"])
|
77
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
79
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
80
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
81
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
metadata
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: truth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Roman Heinrich
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-28 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
|
+
requirement: *id001
|
34
|
+
name: hiredis
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
prerelease: false
|
46
|
+
type: :runtime
|
47
|
+
requirement: *id002
|
48
|
+
name: em-hiredis
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
prerelease: false
|
60
|
+
type: :runtime
|
61
|
+
requirement: *id003
|
62
|
+
name: eventmachine
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
prerelease: false
|
74
|
+
type: :development
|
75
|
+
requirement: *id004
|
76
|
+
name: shoulda
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ~>
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 23
|
84
|
+
segments:
|
85
|
+
- 1
|
86
|
+
- 0
|
87
|
+
- 0
|
88
|
+
version: 1.0.0
|
89
|
+
prerelease: false
|
90
|
+
type: :development
|
91
|
+
requirement: *id005
|
92
|
+
name: bundler
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 7
|
100
|
+
segments:
|
101
|
+
- 1
|
102
|
+
- 5
|
103
|
+
- 2
|
104
|
+
version: 1.5.2
|
105
|
+
prerelease: false
|
106
|
+
type: :development
|
107
|
+
requirement: *id006
|
108
|
+
name: jeweler
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
prerelease: false
|
120
|
+
type: :development
|
121
|
+
requirement: *id007
|
122
|
+
name: rcov
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
133
|
+
prerelease: false
|
134
|
+
type: :development
|
135
|
+
requirement: *id008
|
136
|
+
name: ruby-debug
|
137
|
+
description: Uses Redis pub/sub + Eventmachine
|
138
|
+
email: roman.heinrich@gmail.com
|
139
|
+
executables:
|
140
|
+
- truth-server
|
141
|
+
- truth-client
|
142
|
+
extensions: []
|
143
|
+
|
144
|
+
extra_rdoc_files:
|
145
|
+
- LICENSE.txt
|
146
|
+
- README.md
|
147
|
+
files:
|
148
|
+
- .document
|
149
|
+
- Gemfile
|
150
|
+
- Gemfile.lock
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- VERSION
|
155
|
+
- bin/truth-client
|
156
|
+
- bin/truth-server
|
157
|
+
- lib/timeout_logic.rb
|
158
|
+
- lib/truth.rb
|
159
|
+
- lib/truth/client.rb
|
160
|
+
- lib/truth/config.rb
|
161
|
+
- lib/truth/daemon.rb
|
162
|
+
- test/configs/default/config.yml
|
163
|
+
- test/configs/default/data.yml
|
164
|
+
- test/helper.rb
|
165
|
+
- test/test_truth.rb
|
166
|
+
- truth.gemspec
|
167
|
+
has_rdoc: true
|
168
|
+
homepage: http://github.com/mindreframer/truth
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
hash: 3
|
182
|
+
segments:
|
183
|
+
- 0
|
184
|
+
version: "0"
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
hash: 3
|
191
|
+
segments:
|
192
|
+
- 0
|
193
|
+
version: "0"
|
194
|
+
requirements: []
|
195
|
+
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 1.6.2
|
198
|
+
signing_key:
|
199
|
+
specification_version: 3
|
200
|
+
summary: A simple daemon for realtime server configuration
|
201
|
+
test_files:
|
202
|
+
- test/helper.rb
|
203
|
+
- test/test_truth.rb
|