bibliotech 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9552ff1e32b9c14d8cbde2fe7281c62f52c195d
4
- data.tar.gz: 4609e1b88f0e2e79e27b2a0464d46e3b23b8ecf8
3
+ metadata.gz: 919a784cbc71ae6bc45f971f18a27f1af5c481e7
4
+ data.tar.gz: cf153fa187fc464dfbca7d2651d358cb339dd18b
5
5
  SHA512:
6
- metadata.gz: 0d056aff58cc52edb9c3bf9384cba9d97b2070d2279ce18af055d340b58c6686e464181ad9784cf00fee5ad00e21fcb42eb027935cf861d160f6635d66aa6cb7
7
- data.tar.gz: 9dda9ab623eb889499d02ae8b49ceb5d876ad13ba0d98391d86ecab47fd6439d4d763a7c93042118a60ed991c46145f0fa0a6b428b482281184f3c469bcc54e5
6
+ metadata.gz: 8c92e75621478014eafff6776da25d10423f92b5cf47a4561b7688358010403d5982eab03a1b53f176bf2f8528e151fe2bce2623ea93bcbe65c65189b41d0858
7
+ data.tar.gz: 8e6083d0a358b9518132518e2dd86031595bdf71b0c95ec9b0ec2f0be64710e9caeb6784f959155d19033ba29f6cff6f68c11fc3357cc4560a556fa96914d51e
@@ -203,7 +203,14 @@ module BiblioTech
203
203
  end
204
204
 
205
205
  def database_config
206
- hash["database_config"] ||= valise.contents(local_get(:database_config_file))[local_get(:database_config_env)]
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.5
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.5 Documentation
131
+ - bibliotech-0.2.6 Documentation
132
132
  require_paths:
133
133
  - lib/
134
134
  required_ruby_version: !ruby/object:Gem::Requirement