kb-config 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -7
- data/Rakefile +7 -0
- data/lib/config/version.rb +1 -1
- data/settings.conf +1 -1
- data/spec/.gitkeep +0 -0
- data/spec/config_spec.rb +35 -0
- data/spec/spec_helper.rb +7 -0
- metadata +8 -3
data/README.md
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
# Usage
|
2
2
|
|
3
|
-
|
3
|
+
## Open command prompt
|
4
4
|
|
5
5
|
$> gem install kb-config
|
6
6
|
$> irb
|
7
7
|
|
8
|
-
|
8
|
+
## From irb
|
9
9
|
|
10
10
|
$> require 'config'
|
11
11
|
$> CONFIG = Config::Base.load_config(<path to settings file>, <array of overrides>)
|
12
12
|
|
13
|
-
|
13
|
+
## Example calls and expected results
|
14
14
|
|
15
15
|
$> CONFIG.common.paid_users_size_limit
|
16
16
|
# returns 2147483648
|
17
17
|
|
18
18
|
$> CONFIG.ftp.name
|
19
|
-
# returns
|
19
|
+
# returns "hello there, ftp uploading"
|
20
20
|
|
21
21
|
$> CONFIG.http.params
|
22
|
-
# returns [
|
22
|
+
# returns ["array", "of", "values"]
|
23
23
|
|
24
24
|
$> CONFIG.ftp.lastname
|
25
25
|
# returns nil
|
@@ -28,7 +28,7 @@
|
|
28
28
|
# returns false
|
29
29
|
|
30
30
|
$> CONFIG.ftp[:path]
|
31
|
-
# returns
|
31
|
+
# returns "/etc/var/uploads"
|
32
32
|
|
33
33
|
$> CONFIG.ftp
|
34
|
-
# returns {:name =>
|
34
|
+
# returns {:name => "hello there, ftp uploading", :path => "/etc/var/uploads", :enabled => false}
|
data/Rakefile
ADDED
data/lib/config/version.rb
CHANGED
data/settings.conf
CHANGED
data/spec/.gitkeep
ADDED
File without changes
|
data/spec/config_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Config do
|
4
|
+
before :all do
|
5
|
+
CONFIG = Config::Base.load_config(File.join(File.dirname(__FILE__), '../', 'settings.conf'), ["ubuntu", :production])
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return "2147483648" for "CONFIG.common.paid_users_size_limit"' do
|
9
|
+
CONFIG.common.paid_users_size_limit.should == "2147483648"
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should return "hello there, ftp uploading" for "CONFIG.ftp.name"' do
|
13
|
+
CONFIG.ftp.name.should == "hello there, ftp uploading"
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should return ["array", "of", "values"] for "CONFIG.http.params"' do
|
17
|
+
CONFIG.http.params.should == ["array", "of", "values"]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return "nil" for "CONFIG.ftp.lastname"' do
|
21
|
+
CONFIG.ftp.lastname.should == nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should return "nil (nil == false)" for "CONFIG.ftp.enabled"' do
|
25
|
+
CONFIG.ftp.enabled.should == nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should return "/etc/var/uploads" for "CONFIG.ftp[:path]"' do
|
29
|
+
CONFIG.ftp[:path].should == "/etc/var/uploads"
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should return "{:name => "hello there, ftp uploading", :path => "/etc/var/uploads", :enabled => false}" for "CONFIG.ftp"' do
|
33
|
+
CONFIG.ftp.should == { :name => "hello there, ftp uploading", :path => "/etc/var/uploads", :enabled => false }
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: kb-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kyle Bolton
|
@@ -25,6 +25,7 @@ extra_rdoc_files: []
|
|
25
25
|
|
26
26
|
files:
|
27
27
|
- README.md
|
28
|
+
- Rakefile
|
28
29
|
- config.gemspec
|
29
30
|
- lib/config.rb
|
30
31
|
- lib/config/base.rb
|
@@ -33,6 +34,9 @@ files:
|
|
33
34
|
- lib/config/parser.rb
|
34
35
|
- lib/config/version.rb
|
35
36
|
- settings.conf
|
37
|
+
- spec/.gitkeep
|
38
|
+
- spec/config_spec.rb
|
39
|
+
- spec/spec_helper.rb
|
36
40
|
has_rdoc: true
|
37
41
|
homepage: http://github.com/kb/config
|
38
42
|
licenses: []
|
@@ -61,5 +65,6 @@ rubygems_version: 1.6.2
|
|
61
65
|
signing_key:
|
62
66
|
specification_version: 3
|
63
67
|
summary: Library to hold configuration items for your application
|
64
|
-
test_files:
|
65
|
-
|
68
|
+
test_files:
|
69
|
+
- spec/config_spec.rb
|
70
|
+
- spec/spec_helper.rb
|