mooconfig 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -9
- data/lib/mooconfig/version.rb +1 -1
- data/lib/mooconfig.rb +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -2,26 +2,31 @@
|
|
2
2
|
Doing configuration with MongoDB
|
3
3
|
|
4
4
|
- - -
|
5
|
+
#Install gem?
|
6
|
+
gem install mooconfig
|
7
|
+
|
5
8
|
#The how?
|
6
9
|
|
7
10
|
##Preliminaries
|
8
|
-
|
9
|
-
|
11
|
+
MongoDB (http://www.mongodb.org/)
|
12
|
+
See Gemfile for dependancies
|
10
13
|
|
11
14
|
##Usage
|
12
|
-
|
15
|
+
host = 'localhost'; port = 21017; db='foo'
|
13
16
|
|
14
17
|
###Init
|
15
|
-
|
18
|
+
mconf = MooConfig::Config.new( host, port, db )
|
16
19
|
###Set configuration
|
17
|
-
|
18
|
-
|
20
|
+
mconf.set!( { "a" => true, "b" => { "b1" => "1", "b2" => 1234, "b3" => [ "z", 3, "e" ] }, "c" => "asdf" } ) # default config
|
21
|
+
|
22
|
+
mconf.set!( { "a" => false, "b" => { "b1" => "1", "b2" => 1234, "b3" => [ "z", 3, "e" ] }, "c" => "asdf" }, "production" )
|
23
|
+
|
19
24
|
###Get configuration
|
20
|
-
|
25
|
+
puts "production configuration: #{mconf.get( "production" )['a']} \n default configuration: #{mconf.get['a']}"
|
21
26
|
|
22
27
|
##Test
|
23
|
-
|
24
|
-
|
28
|
+
via guard and guardminitest
|
29
|
+
see test folder
|
25
30
|
|
26
31
|
#License
|
27
32
|
##The MIT License
|
data/lib/mooconfig/version.rb
CHANGED
data/lib/mooconfig.rb
CHANGED
@@ -4,8 +4,8 @@ module MooConfig
|
|
4
4
|
|
5
5
|
class Config
|
6
6
|
DEFAULT_CONFIG_ID = 'default'
|
7
|
-
def initialize( host, port, db )
|
8
|
-
@cCollection = Mongo::Connection.new( host, port ).db( db ).collection(
|
7
|
+
def initialize( host, port, db, conf_collection='config' )
|
8
|
+
@cCollection = Mongo::Connection.new( host, port ).db( db ).collection( conf_collection )
|
9
9
|
rescue => err
|
10
10
|
puts "Config::initialize something is wrong with mongo details [host:#{host}, port:#{port}, db:#{db}]"
|
11
11
|
raise err
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mooconfig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- ronbee
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-29 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Keeping and managing configuration via MongoDB. Light implementation.
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements: []
|
55
55
|
|
56
56
|
rubyforge_project: mooconfig
|
57
|
-
rubygems_version: 1.8.
|
57
|
+
rubygems_version: 1.8.6
|
58
58
|
signing_key:
|
59
59
|
specification_version: 3
|
60
60
|
summary: Doing config with mongodb
|