ouija 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gems ADDED
@@ -0,0 +1,2 @@
1
+ rake -v0.9.2.2
2
+ bundler -v1.1.4
@@ -0,0 +1,8 @@
1
+ .DS_Store
2
+ *.gem
3
+ .bundle/
4
+ vendor/bundle
5
+ *.swp
6
+ *.swo
7
+ .idea
8
+ ~*
data/.rvmrc ADDED
@@ -0,0 +1,4 @@
1
+ rvm --create ruby-1.9.2-p290@ouija
2
+ if [[ -s ".gems" ]] ; then
3
+ rvm gemset import .gems | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
4
+ fi
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source :rubygems
2
+
3
+ # Specify your gem's dependencies in scout-plugins.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'gem-release', '~> 0.3.1'
8
+ end
@@ -0,0 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ouija (0.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ gem-release (0.3.1)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ gem-release (~> 0.3.1)
16
+ ouija!
@@ -0,0 +1,105 @@
1
+ Ouija
2
+ =====
3
+
4
+ Ouija is a RubyGem that makes configuration clean and simple. Separate
5
+ concerns are in separate config files (yaml, currently). Configuration
6
+ is kept DRY by allowing you to declare the bulk of the settings as common
7
+ (hopefully) and then let's you override where necessary by environment and
8
+ hostname. At runtime, Ouija collapses the configuration into one graph based
9
+ on the current context -- hostname and environment (both of which can be
10
+ overridden).
11
+
12
+ Installation
13
+ ------------
14
+
15
+ gem install ouija
16
+
17
+ Overriding
18
+ ----------
19
+
20
+ Ouija collapses config settings at runtime based on current hostname and
21
+ environment. Tree structure is merged and values are overridden. Values
22
+ that are arrays are also overridden, not merged. See usage example below.
23
+
24
+ Override precedence:
25
+
26
+ `hosts` entries override
27
+
28
+ `environments` entries which override
29
+
30
+ `default` entries
31
+
32
+ Usage example
33
+ -------------
34
+
35
+ Config file `PROJECT_ROOT/config/ouija/foo.yml`
36
+
37
+ default:
38
+ output_dir: /usr/local/foo/results
39
+ logging:
40
+ log_dir: /var/log/foo
41
+ output_queues:
42
+ - 'NormalQueue'
43
+ environments:
44
+ production:
45
+ logging:
46
+ level: ERROR
47
+ output_queues:
48
+ - 'NormalQueue'
49
+ - 'SamplingQueue'
50
+ staging:
51
+ logging:
52
+ level: INFO
53
+ development:
54
+ logging:
55
+ level: DEBUG
56
+ output_queues:
57
+ - 'DevQueue'
58
+ hosts:
59
+ My-MacBook-Pro.local:
60
+ output_dir: ./results
61
+ logging:
62
+ log_dir: ./log
63
+
64
+ Driver script `PROJECT_ROOT/script/foo`
65
+
66
+ #!/usr/bin/env ruby
67
+ require 'rubygems'
68
+ require 'bundler/setup'
69
+ Bundler.require
70
+ require 'ouija'
71
+ Ouija.setup
72
+ planchette = Ouija.session('foo')
73
+ puts planchette.to_hash.inspect
74
+
75
+ Results on host with name `My-MacBook-Pro.local`
76
+
77
+ $ script/foo
78
+ {"output_dir"=>"./results", "logging"=>{"log_dir"=>"./log", "level"=>"DEBUG"}, "output_queues"=>["DevQueue"]}
79
+ $ OUIJA_ENV=staging script/foo
80
+ {"output_dir"=>"./results", "logging"=>{"log_dir"=>"./log", "level"=>"INFO"}, "output_queues"=>["NormalQueue"]}
81
+ $ OUIJA_ENV=production script/foo
82
+ {"output_dir"=>"./results", "logging"=>{"log_dir"=>"./log", "level"=>"ERROR"}, "output_queues"=>["NormalQueue", "SamplingQueue"]}
83
+
84
+ Legal stuff
85
+ -----------
86
+
87
+ Copyright (c) 2012, Rob Lewis ([kohder](http://github.com/kohder))
88
+
89
+ Permission is hereby granted, free of charge, to any person obtaining a copy
90
+ of this software and associated documentation files (the "Software"), to deal
91
+ in the Software without restriction, including without limitation the rights
92
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
93
+ copies of the Software, and to permit persons to whom the Software is
94
+ furnished to do so, subject to the following conditions:
95
+
96
+ The above copyright notice and this permission notice shall be included in
97
+ all copies or substantial portions of the Software.
98
+
99
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
100
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
101
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
102
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
104
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
105
+ THE SOFTWARE.
@@ -9,7 +9,7 @@ module Ouija
9
9
 
10
10
  def [](key)
11
11
  value = @hash[key]
12
- value.respond?(:dup) ? value.dup : value
12
+ value.respond_to?(:dup) ? value.dup : value rescue value
13
13
  end
14
14
 
15
15
  def to_hash
@@ -1,23 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Ouija
4
- class Version
5
- MAJOR, MINOR, PATCH = 0, 1, 0
6
-
7
- def self.major
8
- MAJOR
9
- end
10
-
11
- def self.minor
12
- MINOR
13
- end
14
-
15
- def self.patch
16
- PATCH
17
- end
18
-
19
- def self.current
20
- "#{major}.#{minor}.#{patch}"
21
- end
22
- end
4
+ VERSION = '0.1.1'
23
5
  end
@@ -3,7 +3,7 @@ require File.expand_path('lib/ouija/version')
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'ouija'
6
- gem.version = Ouija::Version.current
6
+ gem.version = Ouija::VERSION
7
7
  gem.platform = Gem::Platform::RUBY
8
8
  gem.author = 'Rob Lewis (kohder)'
9
9
  gem.email = 'rob@kohder.com'
@@ -14,9 +14,8 @@ Gem::Specification.new do |gem|
14
14
 
15
15
  gem.required_ruby_version = '>= 1.9.2'
16
16
 
17
- #gem.files = %x[git ls-files].split("\n")
18
- gem.files = %w{ouija.gemspec LICENSE.md lib/ouija.rb lib/ouija/ouija.rb lib/ouija/planchette.rb lib/ouija/version.rb lib/ouija/medium/yaml.rb}
19
- #gem.test_files = %x[git ls-files -- {spec}/*].split("\n")
17
+ gem.files = %x[git ls-files].split("\n")
18
+ gem.test_files = %x[git ls-files -- {spec}/*].split("\n")
20
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
21
20
  gem.require_paths = %w(lib)
22
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ouija
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-02 00:00:00.000000000Z
12
+ date: 2012-07-09 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: The Ouija configuration gem
15
15
  email: rob@kohder.com
@@ -17,13 +17,19 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - ouija.gemspec
20
+ - .gems
21
+ - .gitignore
22
+ - .rvmrc
23
+ - Gemfile
24
+ - Gemfile.lock
21
25
  - LICENSE.md
26
+ - README.md
22
27
  - lib/ouija.rb
28
+ - lib/ouija/medium/yaml.rb
23
29
  - lib/ouija/ouija.rb
24
30
  - lib/ouija/planchette.rb
25
31
  - lib/ouija/version.rb
26
- - lib/ouija/medium/yaml.rb
32
+ - ouija.gemspec
27
33
  homepage: http://github.com/kohder/ouija
28
34
  licenses:
29
35
  - MIT