bibliotech 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bibliotech/config.rb +8 -1
- data/spec/bibliotech/config_spec.rb +19 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 919a784cbc71ae6bc45f971f18a27f1af5c481e7
|
4
|
+
data.tar.gz: cf153fa187fc464dfbca7d2651d358cb339dd18b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c92e75621478014eafff6776da25d10423f92b5cf47a4561b7688358010403d5982eab03a1b53f176bf2f8528e151fe2bce2623ea93bcbe65c65189b41d0858
|
7
|
+
data.tar.gz: 8e6083d0a358b9518132518e2dd86031595bdf71b0c95ec9b0ec2f0be64710e9caeb6784f959155d19033ba29f6cff6f68c11fc3357cc4560a556fa96914d51e
|
data/lib/bibliotech/config.rb
CHANGED
@@ -203,7 +203,14 @@ module BiblioTech
|
|
203
203
|
end
|
204
204
|
|
205
205
|
def database_config
|
206
|
-
hash["database_config"] ||=
|
206
|
+
hash["database_config"] ||=
|
207
|
+
begin
|
208
|
+
db_config = YAML::load(File::read(local_get(:database_config_file)))
|
209
|
+
db_config.fetch(local_get(:database_config_env)) do
|
210
|
+
require 'pp'
|
211
|
+
raise KeyError, "No #{local_get(:database_config_env)} in #{db_config.pretty_inspect}"
|
212
|
+
end
|
213
|
+
end
|
207
214
|
end
|
208
215
|
|
209
216
|
#@group File management
|
@@ -3,26 +3,32 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
module BiblioTech
|
5
5
|
describe Config do
|
6
|
+
include FileSandbox
|
7
|
+
|
6
8
|
describe 'initialization' do
|
9
|
+
before :each do
|
10
|
+
sandbox.new :file => 'config/database.yml', :with_contents => YAML::dump(
|
11
|
+
{
|
12
|
+
"development" =>
|
13
|
+
{ "username" => 'root',
|
14
|
+
"database" => 'dev_db',
|
15
|
+
"adapter" => 'mysql',
|
16
|
+
},
|
17
|
+
"production" =>
|
18
|
+
{ "username" => 'root',
|
19
|
+
"database" => 'prod_db',
|
20
|
+
"adapter" => 'mysql2',
|
21
|
+
}
|
22
|
+
})
|
23
|
+
end
|
24
|
+
|
7
25
|
let :valise do
|
8
26
|
Valise.define do
|
9
27
|
defaults do
|
10
28
|
file "config.yaml", {
|
11
|
-
"database_config_file" => "database.yml",
|
29
|
+
"database_config_file" => "config/database.yml",
|
12
30
|
"database_config_env" => "development",
|
13
31
|
}
|
14
|
-
file "database.yml", {
|
15
|
-
"development" =>
|
16
|
-
{ "username" => 'root',
|
17
|
-
"database" => 'dev_db',
|
18
|
-
"adapter" => 'mysql',
|
19
|
-
},
|
20
|
-
"production" =>
|
21
|
-
{ "username" => 'root',
|
22
|
-
"database" => 'prod_db',
|
23
|
-
"adapter" => 'mysql2',
|
24
|
-
}
|
25
|
-
}
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibliotech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Dorn
|
@@ -128,7 +128,7 @@ rdoc_options:
|
|
128
128
|
- --main
|
129
129
|
- doc/README
|
130
130
|
- --title
|
131
|
-
- bibliotech-0.2.
|
131
|
+
- bibliotech-0.2.6 Documentation
|
132
132
|
require_paths:
|
133
133
|
- lib/
|
134
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|