configatron 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +9 -12
- data/lib/configatron/store.rb +2 -1
- data/lib/configatron/version.rb +1 -1
- data/test/configatron/store_test.rb +16 -0
- metadata +3 -3
- data/.rvmrc +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f474cf450b19844154759cec03c3423912555cb8
|
4
|
+
data.tar.gz: 038d893595745eaf98f6d0b31daf04c795a83bdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d40cf23c2fa1fe15c29311d08d6a92d2afaba80a84e7b09010b7326147bc28221b66ef1bf037e562be42b1bca03a5b21b7aec9d7e094bac2e6c45da4ac3723e
|
7
|
+
data.tar.gz: bb9ec9e8ebb599af692f84e24e89bac8505709bcc52f52b46ccc644c113630c5c1dde64223df3561417debb2133748e07688c83813acae78f0087910fd490b03
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
data/README.md
CHANGED
@@ -3,10 +3,6 @@
|
|
3
3
|
|
4
4
|
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!
|
5
5
|
|
6
|
-
## IMPORTANT NOTES ON V3
|
7
|
-
|
8
|
-
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. :)
|
9
|
-
|
10
6
|
One of the more important changes to V3 is that it now resembles more a `Hash` style interface. You can use `[]`, `fetch`, `each`, etc...
|
11
7
|
|
12
8
|
## Installation
|
@@ -14,7 +10,7 @@ One of the more important changes to V3 is that it now resembles more a `Hash` s
|
|
14
10
|
Add this line to your application's Gemfile:
|
15
11
|
|
16
12
|
```ruby
|
17
|
-
gem 'configatron'
|
13
|
+
gem 'configatron'
|
18
14
|
```
|
19
15
|
|
20
16
|
And then execute:
|
@@ -51,7 +47,7 @@ configatron.email # => "me@example.com"
|
|
51
47
|
configatron.database.url # => "postgres://localhost/foo"
|
52
48
|
```
|
53
49
|
|
54
|
-
|
50
|
+
Voila! Simple as can be.
|
55
51
|
|
56
52
|
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:
|
57
53
|
|
@@ -246,19 +242,20 @@ configatron.to_h # => {:letters=>{:a=>"A", :b=>"BB", :c=>"C"}}
|
|
246
242
|
* Kurtis Rainbolt-Greene
|
247
243
|
* Rob Sanheim
|
248
244
|
* Greg Brockman
|
245
|
+
* Jérémy Lecour
|
249
246
|
* Cody Maggard
|
250
247
|
* Jean-Denis Vauguet
|
251
248
|
* Torsten Schönebaum
|
252
|
-
* Mat Brown
|
253
249
|
* Simon Menke
|
254
|
-
* chatgris
|
255
250
|
* Gleb Pomykalov
|
251
|
+
* chatgris
|
252
|
+
* Mat Brown
|
256
253
|
* Casper Gripenberg
|
257
|
-
*
|
254
|
+
* Dan Pickett
|
258
255
|
* Artiom Diomin
|
259
256
|
* Tim Riley
|
260
|
-
*
|
257
|
+
* mattelacchiato
|
261
258
|
* joe miller
|
262
259
|
* Brandon Dimcheff
|
263
|
-
*
|
264
|
-
* Josh
|
260
|
+
* Rick Fletcher
|
261
|
+
* Josh Nichol
|
data/lib/configatron/store.rb
CHANGED
@@ -47,7 +47,7 @@ class Configatron
|
|
47
47
|
@attributes.empty?
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def key?(key)
|
51
51
|
val = self[key.to_sym]
|
52
52
|
!val.is_a?(Configatron::Store)
|
53
53
|
end
|
@@ -98,6 +98,7 @@ class Configatron
|
|
98
98
|
|
99
99
|
alias :[]= :store
|
100
100
|
alias :blank? :nil?
|
101
|
+
alias :has_key? :key?
|
101
102
|
|
102
103
|
def_delegator :@attributes, :values
|
103
104
|
def_delegator :@attributes, :keys
|
data/lib/configatron/version.rb
CHANGED
@@ -77,6 +77,22 @@ describe Configatron::Store do
|
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
|
+
context "key?" do
|
81
|
+
|
82
|
+
it "returns true if there is a key" do
|
83
|
+
store.key?(:foo).must_equal false
|
84
|
+
store.foo = "bar"
|
85
|
+
store.key?(:foo).must_equal true
|
86
|
+
end
|
87
|
+
|
88
|
+
it "returns false if the key is a Configatron::Store" do
|
89
|
+
store.key?(:foo).must_equal false
|
90
|
+
store.foo = Configatron::Store.new
|
91
|
+
store.key?(:foo).must_equal false
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
80
96
|
context "has_key?" do
|
81
97
|
|
82
98
|
it "returns true if there is a key" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Bates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -32,7 +32,7 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- ".gitignore"
|
35
|
-
- ".
|
35
|
+
- ".ruby-version"
|
36
36
|
- ".travis.yml"
|
37
37
|
- Gemfile
|
38
38
|
- Gemfile.lock
|
data/.rvmrc
DELETED