database_url 0.1.1 → 0.1.2

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: 87af4247427018bbd5ac82d5870048f58ca83c4e
4
- data.tar.gz: eb3191147c79c95486e1bf92c9ad48496a23c9a0
3
+ metadata.gz: 256db9f7d4254aab47bdd049378a1056b5a35842
4
+ data.tar.gz: 85089906f1ddc02b093ccc152412954727261a6a
5
5
  SHA512:
6
- metadata.gz: d1478e21ef47dd6056dbb8eb93b4ceb99fb03498c452c9a367f38cfd216405cc49ae6eba275d24c2f22825c52dd5fdeee8a6e1c9fad9a93e5a7f1be8ecf1ca6a
7
- data.tar.gz: 1fce4ae92ffdde01d6f22d4d6d42ed8b52bcb1f9b19738e838c3f170096bf65c6808d28583487dfe33c902dbf5192b5218d1d9e764ac8d13197279c1bb8f94ea
6
+ metadata.gz: 6365de408b836f969e1650deb6cc5efdedde7e2a2a1486acfd46b106e28cb3c1d7f445db0a05fb66d94d43f753544e9e361d5fba86e7f740a98c32fecb4ef0d0
7
+ data.tar.gz: def6c80427b9796fd1ea029348bb4d2c4d97b2d8e954f728bd51ff61f0682a42c42b91804e890e27ebe33784cbf082891c22c37ee4d9e8ed3554e807da8f8bcd
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.1.2 / 2017-06-12
2
+
3
+ * Enhancements
4
+
5
+ * Remove deprec warning on mysql2 - thanks @Paxa ! https://github.com/seamusabshere/database_url/pull/3
6
+
1
7
  0.1.1 / 2014-10-28
2
8
 
3
9
  * Bug fixes
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module DatabaseUrl
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -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.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: 2014-10-28 00:00:00.000000000 Z
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.2.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: