database_url 0.1.1 → 0.1.2
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 +6 -0
- data/lib/database_url.rb +7 -1
- data/lib/database_url/version.rb +1 -1
- data/spec/database_url_spec.rb +12 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 256db9f7d4254aab47bdd049378a1056b5a35842
|
4
|
+
data.tar.gz: 85089906f1ddc02b093ccc152412954727261a6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6365de408b836f969e1650deb6cc5efdedde7e2a2a1486acfd46b106e28cb3c1d7f445db0a05fb66d94d43f753544e9e361d5fba86e7f740a98c32fecb4ef0d0
|
7
|
+
data.tar.gz: def6c80427b9796fd1ea029348bb4d2c4d97b2d8e954f728bd51ff61f0682a42c42b91804e890e27ebe33784cbf082891c22c37ee4d9e8ed3554e807da8f8bcd
|
data/CHANGELOG
CHANGED
data/lib/database_url.rb
CHANGED
@@ -6,7 +6,13 @@ require 'cgi'
|
|
6
6
|
module DatabaseUrl
|
7
7
|
class << self
|
8
8
|
def to_active_record_hash(url = nil)
|
9
|
-
to_hash ACTIVE_RECORD_FIELD_MAP, url
|
9
|
+
result_hash = to_hash ACTIVE_RECORD_FIELD_MAP, url
|
10
|
+
|
11
|
+
if result_hash[:adapter] == 'mysql2'
|
12
|
+
result_hash[:username] = result_hash.delete(:user)
|
13
|
+
end
|
14
|
+
|
15
|
+
result_hash
|
10
16
|
end
|
11
17
|
|
12
18
|
def to_active_record_url(hash)
|
data/lib/database_url/version.rb
CHANGED
data/spec/database_url_spec.rb
CHANGED
@@ -45,6 +45,18 @@ describe DatabaseUrl do
|
|
45
45
|
encoding: 'latin1',
|
46
46
|
}
|
47
47
|
end
|
48
|
+
|
49
|
+
it "builds config hashes for mysql2 without warnings" do
|
50
|
+
ENV['DATABASE_URL'] = "mysql2://user:xxx@127.0.0.1/dbname?encoding=utf8" # should be ignored!
|
51
|
+
DatabaseUrl.to_active_record_hash(ENV['DATABASE_URL']).should == {
|
52
|
+
adapter: 'mysql2',
|
53
|
+
host: '127.0.0.1',
|
54
|
+
database: 'dbname',
|
55
|
+
username: 'user',
|
56
|
+
password: 'xxx',
|
57
|
+
encoding: 'utf8',
|
58
|
+
}
|
59
|
+
end
|
48
60
|
end
|
49
61
|
|
50
62
|
describe 'Sequel' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.8
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Convert back and forth between Heroku-style ENV['DATABASE_URL'] and Sequel/ActiveRecord-style
|
@@ -115,4 +115,3 @@ summary: Convert back and forth between Heroku-style ENV['DATABASE_URL'] and Seq
|
|
115
115
|
test_files:
|
116
116
|
- spec/database_url_spec.rb
|
117
117
|
- spec/spec_helper.rb
|
118
|
-
has_rdoc:
|