configloader 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.gitignore +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +16 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/configloader.gemspec +8 -5
- data/lib/config_loader.rb +2 -2
- data/spec/config_loader_spec.rb +1 -0
- data/spec/spec_helper.rb +0 -3
- metadata +14 -4
data/.bundle/config
ADDED
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.rdoc
CHANGED
@@ -44,7 +44,7 @@ If you need to create a custom config file for you Rails project, ConfigLoader w
|
|
44
44
|
db_config['port'] # 5984
|
45
45
|
db_config['database_name'] # addressbook_production
|
46
46
|
|
47
|
-
Finally, you can specify the project root too. If you don't, it will assume the project root is
|
47
|
+
Finally, you can specify the project root too. If you don't, it will assume the project root is Rails.root.
|
48
48
|
To change it, write:
|
49
49
|
|
50
50
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/configloader.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{configloader}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Vinicius Teles"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-28}
|
13
13
|
s.description = %q{If you need to create a custom config file for you project, ConfigLoader will help you to load the contents of this file.}
|
14
14
|
s.email = %q{vinicius@improveit.com.br}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,8 +17,11 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
".
|
20
|
+
".bundle/config",
|
21
|
+
".document",
|
21
22
|
".gitignore",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
22
25
|
"LICENSE",
|
23
26
|
"README.rdoc",
|
24
27
|
"Rakefile",
|
@@ -37,7 +40,7 @@ Gem::Specification.new do |s|
|
|
37
40
|
s.homepage = %q{http://github.com/viniciusteles/configloader}
|
38
41
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
42
|
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.
|
43
|
+
s.rubygems_version = %q{1.3.7}
|
41
44
|
s.summary = %q{ConfigLoader makes it easy to load the values of a custom configuration file in a Rails project.}
|
42
45
|
s.test_files = [
|
43
46
|
"spec/config_loader/map_spec.rb",
|
@@ -49,7 +52,7 @@ Gem::Specification.new do |s|
|
|
49
52
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
53
|
s.specification_version = 3
|
51
54
|
|
52
|
-
if Gem::Version.new(Gem::
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
56
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
54
57
|
else
|
55
58
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
data/lib/config_loader.rb
CHANGED
@@ -36,12 +36,12 @@ module ConfigLoader
|
|
36
36
|
# db_config['port'] # 5984
|
37
37
|
# db_config['database_name'] # addressbook_production
|
38
38
|
#
|
39
|
-
# Finally, you can specify the project root too. If you don't, it will assume the project root is
|
39
|
+
# Finally, you can specify the project root too. If you don't, it will assume the project root is Rails.root. To change it, write:
|
40
40
|
#
|
41
41
|
#
|
42
42
|
# db_config = ConfigLoader.load('database', 'production')
|
43
43
|
# db_config = ConfigLoader.load('database', 'test', '/home/user/my_special_project_root')
|
44
|
-
def self.load(file_name, running_env = Rails.env, project_root =
|
44
|
+
def self.load(file_name, running_env = Rails.env, project_root = Rails.root.to_s)
|
45
45
|
ConfigLoader::Map.new(file_name, running_env, project_root).load
|
46
46
|
end
|
47
47
|
|
data/spec/config_loader_spec.rb
CHANGED
@@ -6,6 +6,7 @@ describe "ConfigLoader" do
|
|
6
6
|
|
7
7
|
def prepare_mocks(running_env, project_root)
|
8
8
|
Rails.stub!(:env).and_return(running_env)
|
9
|
+
Rails.stub!(:root).and_return('/home/user/project')
|
9
10
|
ConfigLoader::Map.should_receive(:new).with('database', running_env, project_root).and_return(@map_mock)
|
10
11
|
@map_mock.should_receive(:load).and_return('config')
|
11
12
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Vinicius Teles
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-28 00:00:00 -03:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -41,8 +44,11 @@ extra_rdoc_files:
|
|
41
44
|
- LICENSE
|
42
45
|
- README.rdoc
|
43
46
|
files:
|
47
|
+
- .bundle/config
|
44
48
|
- .document
|
45
49
|
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
46
52
|
- LICENSE
|
47
53
|
- README.rdoc
|
48
54
|
- Rakefile
|
@@ -67,23 +73,27 @@ rdoc_options:
|
|
67
73
|
require_paths:
|
68
74
|
- lib
|
69
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
70
77
|
requirements:
|
71
78
|
- - ">="
|
72
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
73
81
|
segments:
|
74
82
|
- 0
|
75
83
|
version: "0"
|
76
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
77
86
|
requirements:
|
78
87
|
- - ">="
|
79
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
80
90
|
segments:
|
81
91
|
- 0
|
82
92
|
version: "0"
|
83
93
|
requirements: []
|
84
94
|
|
85
95
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.3.
|
96
|
+
rubygems_version: 1.3.7
|
87
97
|
signing_key:
|
88
98
|
specification_version: 3
|
89
99
|
summary: ConfigLoader makes it easy to load the values of a custom configuration file in a Rails project.
|