configatron 2.13.0 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -0
  3. data/.rvmrc +0 -1
  4. data/.travis.yml +5 -2
  5. data/Gemfile +5 -1
  6. data/Gemfile.lock +30 -13
  7. data/Guardfile +24 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +122 -112
  10. data/Rakefile +6 -4
  11. data/V2-README.md +243 -0
  12. data/configatron.gemspec +4 -31
  13. data/lib/configatron/core.rb +3 -94
  14. data/lib/configatron/deep_clone.rb +69 -0
  15. data/lib/configatron/errors.rb +5 -9
  16. data/lib/configatron/rails.rb +8 -8
  17. data/lib/configatron/store.rb +66 -339
  18. data/lib/configatron/version.rb +1 -1
  19. data/lib/configatron.rb +8 -16
  20. data/lib/generators/configatron/install/install_generator.rb +0 -0
  21. data/lib/generators/configatron/install/templates/configatron/defaults.rb +0 -0
  22. data/lib/generators/configatron/install/templates/configatron/development.rb +0 -0
  23. data/lib/generators/configatron/install/templates/configatron/production.rb +0 -0
  24. data/lib/generators/configatron/install/templates/configatron/test.rb +0 -0
  25. data/lib/generators/configatron/install/templates/initializers/configatron.rb +0 -0
  26. data/test/configatron/store_test.rb +191 -0
  27. data/test/configatron_test.rb +5 -0
  28. data/test/test_helper.rb +14 -0
  29. metadata +27 -54
  30. data/LICENSE +0 -21
  31. data/lib/configatron/core_ext/class.rb +0 -25
  32. data/lib/configatron/core_ext/kernel.rb +0 -8
  33. data/lib/configatron/core_ext/object.rb +0 -13
  34. data/lib/configatron/core_ext/string.rb +0 -90
  35. data/lib/configatron/proc.rb +0 -104
  36. data/spec/configatron/proc_spec.rb +0 -67
  37. data/spec/configatron/rails_spec.rb +0 -66
  38. data/spec/lib/class_spec.rb +0 -46
  39. data/spec/lib/complex.yml +0 -13
  40. data/spec/lib/configatron_spec.rb +0 -630
  41. data/spec/lib/futurama.yml +0 -6
  42. data/spec/lib/lost.yml +0 -14
  43. data/spec/lib/math.yml +0 -2
  44. data/spec/lib/merge.yml +0 -14
  45. data/spec/spec_helper.rb +0 -4
  46. data/spec/support/rails.rb +0 -7
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 726b6ffdc130933ec1a38572f833537dd560c343
4
+ data.tar.gz: 2e905aedd57354e7bbda54a5e450d2288ac00493
5
+ SHA512:
6
+ metadata.gz: 19ec11d3152a002763a48ce31ad2eaf63b1413c991d4e50116d60298ca042e870065f86118266c6def811cbe2554dda330ca269cf4637eaa39f938c93fe098fb
7
+ data.tar.gz: f4dddffa04bbad1beb942302ca9366e47b6db9f7fbe53e96b402aa01bdcd6b1e0dfe6e29574c7da3e15223d200fcbcec1e4ae99477db8fe36da216171a23fda2
data/.gitignore CHANGED
File without changes
data/.rvmrc CHANGED
@@ -1,2 +1 @@
1
- # rvm use ruby-2.0.0-preview1
2
1
  rvm use 2.0.0
data/.travis.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.2
3
4
  - 1.9.3
4
- - 2.0.0
5
+ - jruby-19mode
6
+ - rbx-19mode
7
+ - ruby-head
5
8
 
6
- script: bundle exec rspec
9
+ script: bundle exec rake
data/Gemfile CHANGED
@@ -4,4 +4,8 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rake'
7
- gem 'rspec'
7
+ gem "minitest-colorize"
8
+ gem "terminal-notifier-guard"
9
+ gem 'rb-fsevent'
10
+ gem "guard"
11
+ gem 'guard-minitest'
data/Gemfile.lock CHANGED
@@ -1,28 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- configatron (2.13.0)
5
- yamler (>= 0.1.0)
4
+ configatron (3.0.0.rc1)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
- diff-lcs (1.1.3)
9
+ coderay (1.0.8)
10
+ guard (1.6.2)
11
+ listen (>= 0.6.0)
12
+ lumberjack (>= 1.0.2)
13
+ pry (>= 0.9.10)
14
+ terminal-table (>= 1.4.3)
15
+ thor (>= 0.14.6)
16
+ guard-minitest (0.5.0)
17
+ guard (>= 0.4)
18
+ listen (0.7.2)
19
+ lumberjack (1.0.2)
20
+ method_source (0.8.1)
21
+ minitest (2.12.1)
22
+ minitest-colorize (0.0.4)
23
+ minitest (~> 2.0)
24
+ pry (0.9.11.4)
25
+ coderay (~> 1.0.5)
26
+ method_source (~> 0.8)
27
+ slop (~> 3.4)
11
28
  rake (0.9.2.2)
12
- rspec (2.8.0)
13
- rspec-core (~> 2.8.0)
14
- rspec-expectations (~> 2.8.0)
15
- rspec-mocks (~> 2.8.0)
16
- rspec-core (2.8.0)
17
- rspec-expectations (2.8.0)
18
- diff-lcs (~> 1.1.2)
19
- rspec-mocks (2.8.0)
20
- yamler (0.1.0)
29
+ rb-fsevent (0.9.3)
30
+ slop (3.4.3)
31
+ terminal-notifier-guard (1.5.3)
32
+ terminal-table (1.4.5)
33
+ thor (0.17.0)
21
34
 
22
35
  PLATFORMS
23
36
  ruby
24
37
 
25
38
  DEPENDENCIES
26
39
  configatron!
40
+ guard
41
+ guard-minitest
42
+ minitest-colorize
27
43
  rake
28
- rspec
44
+ rb-fsevent
45
+ terminal-notifier-guard
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'minitest' do
5
+ # with Minitest::Unit
6
+ watch(%r|^test/(.*)\/?(.*)_test\.rb|)
7
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
8
+ watch(%r|^test/test_helper\.rb|) { "test" }
9
+
10
+ # with Minitest::Spec
11
+ # watch(%r|^spec/(.*)_spec\.rb|)
12
+ # watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
13
+ # watch(%r|^spec/spec_helper\.rb|) { "spec" }
14
+
15
+ # Rails 3.2
16
+ # watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
17
+ # watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
18
+ # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
19
+
20
+ # Rails
21
+ # watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/functional/#{m[1]}_test.rb" }
22
+ # watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
23
+ # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
24
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Mark Bates
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,222 +1,232 @@
1
- # Configatron [![Build Status](https://travis-ci.org/markbates/configatron.png?branch=master)](https://travis-ci.org/markbates/configatron)
1
+ # Configatron
2
2
 
3
3
  Configatron makes configuring your applications and scripts incredibly easy. No longer is a there a need to use constants or global variables. Now you can use a simple and painless system to configure your life. And, because it's all Ruby, you can do any crazy thing you would like to!
4
4
 
5
+ ## IMPORTANT NOTES ON V3
6
+
7
+ V3 is still a work in progress. It is also a complete rewrite of the library. Because V3 is a rewrite there is a lot that has been thrown out, modified, etc... There is a good chance that some feature or method that you were using doesn't exist, or works differently now. Hopefully you'll find these changes for the best. If not, you know how to submit a Pull Request. :)
8
+
9
+ One of the more important changes to V3 is that it now resembles more a `Hash` style interface. You can use `[]`, `fetch`, `each`, etc...
10
+
5
11
  ## Installation
6
12
 
7
- Installation of Configatron is easy, as it is just a RubyGem:
13
+ Add this line to your application's Gemfile:
8
14
 
9
15
  ```ruby
10
- $ sudo gem install configatron
16
+ gem 'configatron', '3.0.0.rc1'
11
17
  ```
12
18
 
13
- If you'd like to live on the bleedin' edge you can install the development version from GitHub:
19
+ And then execute:
14
20
 
21
+ ```bash
22
+ $ bundle
15
23
  ```
16
- $ sudo gem install markbates-configatron --source=http://gems.github.com
24
+
25
+ Or install it yourself as:
26
+
27
+ ```bash
28
+ $ gem install configatron --pre
17
29
  ```
18
30
 
31
+ ## Usage
32
+
19
33
  Once installed you just need to require it:
20
34
 
21
35
  ```ruby
22
- require 'configatron'
36
+ require 'configatron'
23
37
  ```
24
38
 
25
- ## Examples
26
-
27
39
  ### Simple
28
40
 
29
41
  ```ruby
30
- configatron.email = 'me@example.com'
31
- configatron.database_url = "postgres://localhost/mack_framework_rocks"
42
+ configatron.email = 'me@example.com'
43
+ configatron.database.url = "postgres://localhost/foo"
32
44
  ```
33
45
 
34
46
  Now, anywhere in your code you can do the following:
35
47
 
36
48
  ```ruby
37
- configatron.email # => "me@example.com"
38
- configatron.database_url # => "postgres://localhost/mack_framework_rocks"
49
+ configatron.email # => "me@example.com"
50
+ configatron.database.url # => "postgres://localhost/foo"
39
51
  ```
40
52
 
41
53
  Viola! Simple as can be.
42
54
 
43
- Now you're saying, what if I want to have a 'default' set of options, but then override them later, based on other information? Simple again. Let's use our above example. We've configured our @database_url@ option to be @postgres://localhost/mack_framework_rocks@. The problem with that is that is our production database url, not our development url. Fair enough, all you have to do is redeclare it:
55
+ Now you're saying, what if I want to have a 'default' set of options, but then override them later, based on other information? Simple again. Let's use our above example. We've configured our `database.url` option to be @postgres://localhost/foo@. The problem with that is that is our production database url, not our development url. Fair enough, all you have to do is redeclare it:
44
56
 
45
57
  ```ruby
46
- configatron.database_url = "postgres://localhost/mack_framework_rocks_development"
58
+ configatron.database.url = "postgres://localhost/foo_development"
47
59
  ```
48
60
 
49
61
  becomes:
50
62
 
51
63
  ```ruby
52
- configatron.email # => "me@example.com"
53
- configatron.database_url # => "postgres://localhost/mack_framework_rocks_development"
64
+ configatron.email # => "me@example.com"
65
+ configatron.database.url # => "postgres://localhost/foo_development"
54
66
  ```
55
67
 
56
68
  Notice how our other configuration parameters haven't changed? Cool, eh?
57
69
 
58
70
  ### Hash/YAML
59
71
 
60
- You can configure configatron from a hash as well (this is really only useful in testing or for data driven configurat, it's not recommended for actual configuration):
72
+ You can configure Configatron from a hash as well (this is really only useful in testing or for data driven configuration, it's not recommended for actual configuration):
61
73
 
62
74
  ```ruby
63
- configatron.configure_from_hash({:email => {:pop => {:address => 'pop.example.com', :port => 110}}, :smtp => {:address => 'smtp.example.com'}})####
64
- configatron.email.pop.address # => 'pop.example.com'
65
- configatron.email.pop.port # => 110
66
- # and so on...
75
+ configatron.configure_from_hash(email: {pop: {address: 'pop.example.com', port: 110}}, smtp: {address: 'smtp.example.com'})
76
+
77
+ configatron.email.pop.address # => 'pop.example.com'
78
+ configatron.email.pop.port # => 110
79
+ # and so on...
67
80
  ```
68
81
 
69
82
  #### YAML
70
83
 
71
- Support for YAML has been deprecated and will be removed in version 2.9 of Configatron. Please switch to Ruby based configuration of Configatron. Trust me, it's a lot nicer and easier to use. Why would you _not_ want to?
84
+ YAML is terrible and should be driven from the face of the Earth. Because of this Configatron V3 does not support it. Sorry.
72
85
 
73
86
  ### Namespaces
74
87
 
75
88
  The question that should be on your lips is what I need to have namespaced configuration parameters. It's easy! Configatron allows you to create namespaces.
76
89
 
77
90
  ```ruby
78
- configatron.website_url = "http://www.mackframework.com"
79
- configatron.email.pop.address = "pop.example.com"
80
- configatron.email.pop.port = 110
81
- configatron.email.smtp.address = "smtp.example.com"
82
- configatron.email.smtp.port = 25
91
+ configatron.website_url = "http://www.example.com"
92
+ configatron.email.pop.address = "pop.example.com"
93
+ configatron.email.pop.port = 110
94
+ configatron.email.smtp.address = "smtp.example.com"
95
+ configatron.email.smtp.port = 25
96
+
97
+ configatron.to_h # => {:website_url=>"http://www.example.com", :email=>{:pop=>{:address=>"pop.example.com", :port=>110}, :smtp=>{:address=>"smtp.example.com", :port=>25}}}
83
98
  ```
84
99
 
85
- becomes:
100
+ Configatron allows you to nest namespaces to your hearts content! Just keep going, it's that easy.
101
+
102
+ Of course you can update a single parameter n levels deep as well:
86
103
 
87
104
  ```ruby
88
- configatron.email.pop.address # => "pop.example.com"
89
- configatron.email.smtp.address # => "smtp.example.com"
90
- configatron.website_url # => "http://www.mackframework.com"
105
+ configatron.email.pop.address = "pop2.example.com"
106
+
107
+ configatron.email.pop.address # => "pop2.example.com"
108
+ configatron.email.smtp.address # => "smtp.example.com"
91
109
  ```
92
- ####onfigatron allows you to nest namespaces to your hearts content! Just keep going, it's that easy.
93
110
 
94
- Of course you can update a single parameter n levels deep as well:
111
+ Configatron will also let you use a block to clean up your configuration. For example the following two ways of setting values are equivalent:
95
112
 
96
113
  ```ruby
97
- configatron.email.pop.address = "pop2.example.com"
114
+ configatron.email.pop.address = "pop.example.com"
115
+ configatron.email.pop.port = 110
98
116
 
99
- configatron.email.pop.address # => "pop2.example.com"
100
- configatron.email.smtp.address # => "smtp.example.com"
117
+ configatron.email.pop do |pop|
118
+ pop.address = "pop.example.com"
119
+ pop.port = 110
120
+ end
101
121
  ```
102
122
 
103
123
  ### Temp Configurations
104
124
 
105
- Sometimes in testing, or other situations, you want to temporarily change some settings. You can do this with the @temp@ method:
125
+ Sometimes in testing, or other situations, you want to temporarily change some settings. You can do this with the `temp` method:
106
126
 
107
127
  ```ruby
108
- configatron.one = 1
109
- configatron.letters.a = 'A'
110
- configatron.letters.b = 'B'
111
- configatron.temp do
112
- configatron.letters.b = 'bb'
113
- configatron.letters.c = 'c'
114
- configatron.one # => 1
115
- configatron.letters.a # => 'A'
116
- configatron.letters.b # => 'bb'
117
- configatron.letters.c # => 'c'
118
- end
128
+ configatron.one = 1
129
+ configatron.letters.a = 'A'
130
+ configatron.letters.b = 'B'
131
+ configatron.temp do
132
+ configatron.letters.b = 'bb'
133
+ configatron.letters.c = 'c'
119
134
  configatron.one # => 1
120
135
  configatron.letters.a # => 'A'
121
- configatron.letters.b # => 'B'
122
- configatron.letters.c # => nil
136
+ configatron.letters.b # => 'bb'
137
+ configatron.letters.c # => 'c'
138
+ end
139
+ configatron.one # => 1
140
+ configatron.letters.a # => 'A'
141
+ configatron.letters.b # => 'B'
142
+ configatron.letters.c # => {}
123
143
  ```
124
144
 
125
- You can also pass in an optional Hash to the @temp@:
145
+ ### nil
146
+
147
+ Even if parameters haven't been set, you can still call them, but you'll get a `Configatron::Store` object back. The `Configatron::Store` class, however, will respond true to `.nil?` or `.blank?` if there are no parameters configured on it.
126
148
 
127
149
  ```ruby
128
- configatron.one = 1
129
- configatron.letters.a = 'A'
130
- configatron.letters.b = 'B'
131
- configatron.temp(:letters => {:b => 'bb', :c => 'c'}) do
132
- ####one == 1
133
- configatron.letters.a # => 'A'
134
- configatron.letters.b # => 'bb'
135
- configatron.letters.c # => 'c'
136
- end
137
- configatron.one == 1
138
- configatron.letters.a # => 'A'
139
- configatron.letters.b # => 'B'
140
- configatron.letters.c # => nil
150
+ configatron.i.dont.exist.nil? # => true
151
+ configatron.i.dont.exist.blank? # => true
152
+ configatron.i.dont.exist # => Configatron::Store
141
153
  ```
142
154
 
143
- ### Delayed and Dynamic Configurations
144
-
145
- There are times when you want to refer to one configuration setting in another configuration setting. Let's look at a fairly contrived example:
155
+ You can use `.has_key?` to determine if a key already exists.
146
156
 
147
157
  ```ruby
148
- configatron.memcached.servers = ['127.0.0.1:11211']
149
- configatron.page_caching.servers = configatron.memcached.servers
150
- configatron.object_caching.servers = configatron.memcached.servers
151
-
152
- if Rails.env == 'production'
153
- configatron.memcached.servers = ['192.168.0.1:11211']
154
- configatron.page_caching.servers = configatron.memcached.servers
155
- configatron.object_caching.servers = configatron.memcached.servers
156
- elsif Rails.env == 'staging'
157
- configatron.memcached.servers = ['192.168.0.2:11211']
158
- configatron.page_caching.servers = configatron.memcached.servers
159
- configatron.object_caching.servers = configatron.memcached.servers
160
- end
158
+ configatron.i.dont.has_key?(:exist) # => false
161
159
  ```
162
160
 
163
- Now, we could've written that slightly differently, but it helps to illustrate the point. With Configatron you can create `Delayed` and `Dynamic` settings.
161
+ ### Kernel
164
162
 
165
- #### Delayed
163
+ The `configatron` "helper" method is store in the `Kernel` module. Some people didn't like that in the V2 of Configatron, so in V3, while that hasn't changed, you don't have to use it.
166
164
 
167
- With `Delayed` settings execution of the setting doesn't happen until the first time it is executed.
165
+ Instead of requiring `configatron` simply require `configatron/core`, but then you'll have to set up your own `Configatron::Store` object.
166
+
167
+ Example:
168
168
 
169
169
  ```ruby
170
- configatron.memcached.servers = ['127.0.0.1:11211']
171
- configatron.page_caching.servers = Configatron::Delayed.new {configatron.memcached.servers}
172
- configatron.object_caching.servers = Configatron::Delayed.new {configatron.memcached.servers}
170
+ require 'configatron/core'
171
+
172
+ store = Configatron::Store.new
173
+ store.foo = 'FOO'
173
174
 
174
- if Rails.env == 'production'
175
- configatron.memcached.servers = ['192.168.0.1:11211']
176
- elsif Rails.env == 'staging'
177
- configatron.memcached.servers = ['192.168.0.2:11211']
178
- end
175
+ store.to_h #= {foo: 'FOO'}
179
176
  ```
180
177
 
181
- Execution occurs once and after that the result of that execution is returned. So in our case the first time someone calls the setting `configatron.page_caching.servers` it will find the `configatron.memcached.servers` setting and return that. After that point if the `configatron.memcached.servers` setting is changed, the original settings are returned by `configatron.page_caching.servers`.
178
+ ### Locking
182
179
 
183
- #### Dynamic
180
+ Once you have setup all of your configurations you can call the `lock!` method to lock your settings and raise an error should anyone try to change settings or access an unset setting later.
184
181
 
185
- `Dynamic` settings are very similar to `Delayed` settings, but with one big difference. Every time you call a `Dynamic` setting is executed. Take this example:
182
+ Example:
186
183
 
187
184
  ```ruby
188
- configatron.current.time = Configatron::Dynamic.new {Time.now}
189
- ```
185
+ configatron.foo = 'FOO'
186
+ configatron.lock!
190
187
 
191
- Each time you call `configatron.current.time` it will return a new value to you. While this seems a bit useless, it is pretty useful if you have ever changing configurations.
188
+ configatron.foo # => 'FOO'
192
189
 
193
- ### Misc.
190
+ configatron.bar # => raises Configatron::UndefinedKeyError
191
+ configatron.bar = 'BAR' # => raises Configatron::LockedError
192
+ ```
194
193
 
195
- Even if parameters haven't been set, you can still call them, but you'll get a @Configatron::Store@ object back. The Configatron::Store class, however, will respond true to @.nil?@ if there are no parameters configured on it.
194
+ ## Rails
196
195
 
197
- ```ruby
198
- configatron.i.dont.exist.nil? # => true
199
- configatron.i.dont.exist # => Configatron::Store
196
+ Configatron works great with Rails. Use the built-in generate to generate an initializer file and a series of environment files for you to use to configure your applications.
197
+
198
+ ``` bash
199
+ $ rails generate configatron:install
200
200
  ```
201
201
 
202
- If you want to get back an actual @nil@ then you can use the @retrieve@ method:
202
+ Configatron will read in the `config/configatron/defaults.rb` file first and then the environment specific file, such as `config/configatron/development.rb`. Settings in the environment file will merge into and replace the settings in the `defaults.rb` file.
203
+
204
+ ### Example
203
205
 
204
206
  ```ruby
205
- configatron.i.do.exist = [:some, :array]
206
- configatron.i.dont.retrieve(:exist, nil) # => nil
207
- configatron.i.do.retrieve(:exist, :foo) # => [:some, :array]
207
+ # config/configatron/defaults.rb
208
+ configatron.letters.a = 'A'
209
+ configatron.letters.b = 'B'
208
210
  ```
209
211
 
210
- You can set 'default' values for parameters. If there is already a setting, it won't be replaced. This is useful if you've already done your 'configuration' and you call a library, that needs to have parameters set. The library can set its defaults, without worrying that it might have overridden your custom settings.
212
+ ```ruby
213
+ # config/configatron/development.rb
214
+ configatron.letters.b = 'BB'
215
+ configatron.letters.c = 'C'
216
+ ```
211
217
 
212
218
  ```ruby
213
- configatron.set_default(:name, 'Mark Bates')
214
- configatron.name # => 'Mark Bates'
215
- configatron.set_default(:name, 'Me')
216
- configatron.name # => 'Mark Bates'
219
+ configatron.to_h # => {:letters=>{:a=>"A", :b=>"BB", :c=>"C"}}
217
220
  ```
218
221
 
219
- Enjoy!
222
+ ## Contributing
223
+
224
+ 1. Fork it
225
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
226
+ 3. Write Tests!
227
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
228
+ 5. Push to the branch (`git push origin my-new-feature`)
229
+ 6. Create new Pull Request
220
230
 
221
231
  ## Contributors
222
232
 
data/Rakefile CHANGED
@@ -1,7 +1,9 @@
1
- require 'bundler'
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+
2
4
  Bundler::GemHelper.install_tasks
3
5
 
4
- desc "Run tests"
5
- task :default do
6
- system "bundle exec rspec"
6
+ Rake::TestTask.new(:default) do |t|
7
+ t.libs << "test"
8
+ t.test_files = FileList["test/**/*_test.rb"]
7
9
  end