dbenvy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +9 -3
- data/Rakefile +1 -0
- data/lib/dbenvy.rb +1 -1
- data/lib/dbenvy/version.rb +1 -1
- data/spec/unit/dbenvy_spec.rb +36 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4cbf40ffe72b693dd603e82176a823ad5b36d8f
|
4
|
+
data.tar.gz: 1ee3cffdba2ed2b609736d7ce19bc121af998b9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef5b63db0130967cf8bf74efdec9466453de491a48521d0df78ba844b7a60902dbbb71fe5ab4d2ce9f9cbdae05b11b1c465367ffff93590f5299d3f779810857
|
7
|
+
data.tar.gz: 99472c23d5c814e41c188ce9698ccf96231309e2b31cd6a55a9bd805800908b9ae7b373ecf1d2a893f4312178a87498ba79424bdc64e9a5745559ba93806f46e
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
[![Build Status](https://travis-ci.org/reevoo/dbenvy.svg?branch=master)](https://travis-ci.org/reevoo/dbenvy)
|
2
|
+
|
3
|
+
# DBEnvy
|
2
4
|
|
3
5
|
Load DB info from the environment
|
4
6
|
|
@@ -16,12 +18,16 @@ And then execute:
|
|
16
18
|
|
17
19
|
## Usage
|
18
20
|
|
19
|
-
Add the following to your database.yml file and set the DATABASE_URL environment variable
|
21
|
+
Add the following to your database.yml file and set the DATABASE_URL environment variable.
|
20
22
|
|
21
23
|
```
|
22
|
-
|
24
|
+
<%= DBEnvy.yaml %>
|
23
25
|
```
|
24
26
|
|
27
|
+
## Note
|
28
|
+
|
29
|
+
You do not need this in a Rails 4.1 app as loading database info from DATABASE_URL is supported out of the box
|
30
|
+
|
25
31
|
## Contributing
|
26
32
|
|
27
33
|
1. Fork it ( https://github.com/reevoo/dbenvy/fork )
|
data/Rakefile
CHANGED
data/lib/dbenvy.rb
CHANGED
data/lib/dbenvy/version.rb
CHANGED
data/spec/unit/dbenvy_spec.rb
CHANGED
@@ -56,6 +56,42 @@ describe DBEnvy do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
context 'when RAILS_ENV is not set but Rails.env is avaliable' do
|
60
|
+
module Rails
|
61
|
+
extend self
|
62
|
+
|
63
|
+
def env
|
64
|
+
nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'uses RAILS_ENV if it can' do
|
69
|
+
before do
|
70
|
+
ENV['DATABASE_URL'] = 'mysql2://reevoo:secret@db456.reevoover.com:3306/reevoo_awesome'
|
71
|
+
ENV['RAILS_ENV'] = 'ENV'
|
72
|
+
allow(Rails).to receive(:env).and_return('env')
|
73
|
+
end
|
74
|
+
|
75
|
+
specify do
|
76
|
+
expect(YAML.load(yaml)['ENV']).to_not be_nil
|
77
|
+
expect(YAML.load(yaml)['env']).to be_nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'uses Rails.env if RAILS_ENV is not set' do
|
82
|
+
before do
|
83
|
+
ENV['DATABASE_URL'] = 'mysql2://reevoo:secret@db456.reevoover.com:3306/reevoo_awesome'
|
84
|
+
ENV['RAILS_ENV'] = nil
|
85
|
+
allow(Rails).to receive(:env).and_return('env')
|
86
|
+
end
|
87
|
+
|
88
|
+
specify do
|
89
|
+
expect(YAML.load(yaml)['ENV']).to be_nil
|
90
|
+
expect(YAML.load(yaml)['env']).to_not be_nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
59
95
|
context 'when RAILS_ENV is set' do
|
60
96
|
before do
|
61
97
|
ENV['RAILS_ENV'] = 'production'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbenvy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -75,8 +75,8 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
+
- ".travis.yml"
|
78
79
|
- Gemfile
|
79
|
-
- Gemfile.lock
|
80
80
|
- LICENSE.txt
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|