wd_sinatra_sequel 0.0.3 → 0.0.4
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/CHANGELOG.md +3 -0
- data/README.md +3 -2
- data/lib/wd_sinatra_sequel.rb +7 -8
- data/lib/wd_sinatra_sequel/version.rb +1 -1
- 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: af844175ad819319e4f37249a5eb71ffce6e4e6b
|
4
|
+
data.tar.gz: 301364bba13599d29ef028a81b4e2aeab6da588a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d21cad413f7331d1682af3cf5127adea0f9b9c7681f63ebe1b82bd7968c52cefdadeefa37442a75d24de0eedc8bb157c63646728c6a424ba026285ff01225496
|
7
|
+
data.tar.gz: a221269be0b96cff95a87034f389e6eb302c626a85d93fb048919445635ed79899944c3f2abafefed1feea5a0aa32d5cf9923bd3a64e536a1e9675d5a30af0e6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -36,12 +36,13 @@ Add an Sequel `database.yml` file in your config folder and then require this
|
|
36
36
|
gem in your `app.rb` file and connect to the DB:
|
37
37
|
|
38
38
|
require 'wd_sinatra_sequel'
|
39
|
-
|
39
|
+
WdSinatraSequel::DBConnector.set_db_connection
|
40
|
+
WdSinatraSequel::DBConnector.connect_to_db
|
40
41
|
|
41
42
|
|
42
43
|
The DB settings can be accessed via:
|
43
44
|
|
44
|
-
DBConnector::DB_CONFIG[RACK_ENV]
|
45
|
+
WdSinatraSequel::DBConnector::DB_CONFIG[RACK_ENV]
|
45
46
|
|
46
47
|
## Rake tasks
|
47
48
|
|
data/lib/wd_sinatra_sequel.rb
CHANGED
@@ -19,7 +19,8 @@ module WdSinatraSequel
|
|
19
19
|
|
20
20
|
##### DB Connection ########
|
21
21
|
module DBConnector
|
22
|
-
|
22
|
+
DB_FILE = File.join(WDSinatra::AppLoader.root_path, "config", "database.yml")
|
23
|
+
DB_CONFIG = YAML.load_file(DB_FILE)
|
23
24
|
|
24
25
|
module_function
|
25
26
|
|
@@ -33,11 +34,9 @@ module WdSinatraSequel
|
|
33
34
|
end
|
34
35
|
|
35
36
|
# Establish the DB connection
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if hash_settings && hash_settings[env]
|
40
|
-
@db_configurations = hash_settings
|
37
|
+
if File.exist?(DB_FILE)
|
38
|
+
if DB_CONFIG && DB_CONFIG[env]
|
39
|
+
@db_configurations = DB_CONFIG
|
41
40
|
@db_configuration = @db_configurations[env]
|
42
41
|
# add loggers
|
43
42
|
@db_configuration['loggers'] ||= []
|
@@ -49,10 +48,10 @@ module WdSinatraSequel
|
|
49
48
|
end
|
50
49
|
connect_to_db unless ENV['DONT_CONNECT']
|
51
50
|
else
|
52
|
-
raise "#{
|
51
|
+
raise "#{DB_FILE} doesn't have an entry for the #{env} environment"
|
53
52
|
end
|
54
53
|
else
|
55
|
-
raise "#{
|
54
|
+
raise "#{DB_FILE} file missing, can't connect to the DB"
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wd_sinatra_sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Chu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|