fresh_connection 0.4.4 → 1.0.0

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: 7b13044e5acb59fcaeb6b1feff5cd54d2b64418c
4
- data.tar.gz: afa711b9e384dd4e357690fc8b48a9573ef3256d
3
+ metadata.gz: d7a9e7d5dd0b87b0fde217b1e7bf143a49cfa46d
4
+ data.tar.gz: c4b1ffc7356829e9ec59ef63b8db8153a1f6effd
5
5
  SHA512:
6
- metadata.gz: f0c28af663d0af790985fef6c52e4e400846c04b7148025e2ef5f4558342f3206e5d2a11e652d2739c84bf7ae4f614af98b84637413b9736351b43488f7ade54
7
- data.tar.gz: a079a80c83ca388970e56c190eb7296b9ab6eec14195db44b92244f6af7c1f3c8a5fb05d72eb3b25c15aaf63052830b864a58572fb62dbac3a39fba8c22c17d4
6
+ metadata.gz: 6fe7d72244f7ce4eda98c30107879cc4c13485b1444c86687330a472874e7361d673bed2ff70946185ca95d02e3a082b1e760cb247bb320b1e59fc999cd4f94a
7
+ data.tar.gz: fbe6489aa3b4a944c3ff580971eb33b3d3ca057a52bc44f0aa1a3849f5052bb32588d7e8d4950da61918ac119c15da120082a1aafb0969335558ad8e2e07e138
data/.travis.yml CHANGED
@@ -1,12 +1,17 @@
1
1
  language: ruby
2
+ before_install:
3
+ - gem install bundler
2
4
  before_script:
3
5
  - mysql -e 'create database fresh_connection_test;'
4
6
  - mysql -e 'create database fresh_connection_test_master;'
5
7
  - mysql -e 'create database fresh_connection_test_slave;'
8
+ - bundle update
9
+ cache: bundler
6
10
  rvm:
7
11
  - 2.0.0
8
- - 2.1
9
- - 2.2
12
+ - 2.1.8
13
+ - 2.2.4
14
+ - 2.3.0
10
15
  - ruby-head
11
16
  gemfile:
12
17
  - gemfiles/rails3.gemfile
data/Appraisals CHANGED
@@ -1,19 +1,15 @@
1
1
  appraise "rails3" do
2
2
  gem "activerecord", "~> 3.2.0"
3
- gem "activesupport", "~> 3.2.0"
4
3
  end
5
4
 
6
5
  appraise "rails40" do
7
6
  gem "activerecord", "~> 4.0.0"
8
- gem "activesupport", "~> 4.0.0"
9
7
  end
10
8
 
11
9
  appraise "rails41" do
12
10
  gem "activerecord", "~> 4.1.0"
13
- gem "activesupport", "~> 4.1.0"
14
11
  end
15
12
 
16
13
  appraise "rails42" do
17
14
  gem "activerecord", "~> 4.2.0"
18
- gem "activesupport", "~> 4.2.0"
19
15
  end
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at tsukasa.oishi@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2013 tsukasaoishi
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2016 Tsukasa OISHI
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -37,7 +37,7 @@ If you want to access to the master server, use read_master.
37
37
  ```ruby
38
38
  Article.where(:id => 1).read_master
39
39
  ```
40
- It is possible to use readonly(false) instead of read_master, but it is depricated.
40
+ If you would like to use readonly(false), use version before 1.0.0.
41
41
 
42
42
  In transaction, All queries go to the master server.
43
43
 
@@ -20,13 +20,14 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.required_ruby_version = '>= 2.0'
23
- spec.add_dependency 'activerecord', '>= 3.2.0', '< 4.3'
24
- spec.add_dependency 'activesupport', '>= 3.2.0', '< 4.3'
23
+
24
+ spec.add_dependency 'activerecord', '>= 3.2.0', '< 5.0'
25
+ spec.add_dependency 'activesupport', '>= 3.2.0', '< 5.0'
25
26
  spec.add_dependency 'mysql2', '~> 0.3.18'
26
27
 
27
- spec.add_development_dependency "bundler", "~> 1.7"
28
- spec.add_development_dependency "rake", '~> 10.0'
29
- spec.add_development_dependency 'appraisal', '~> 2.0'
28
+ spec.add_development_dependency "bundler", ">= 1.3.0", "< 2.0"
29
+ spec.add_development_dependency "rake", ">= 0.8.7"
30
+ spec.add_development_dependency 'appraisal'
30
31
  spec.add_development_dependency "minitest"
31
32
  spec.add_development_dependency "minitest-reporters"
32
33
  end
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 3.2.0"
6
- gem "activesupport", "~> 3.2.0"
7
6
 
8
7
  gemspec :path => "../"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 4.0.0"
6
- gem "activesupport", "~> 4.0.0"
7
6
 
8
7
  gemspec :path => "../"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 4.1.0"
6
- gem "activesupport", "~> 4.1.0"
7
6
 
8
7
  gemspec :path => "../"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 4.2.0"
6
- gem "activesupport", "~> 4.2.0"
7
6
 
8
7
  gemspec :path => "../"
@@ -1,10 +1,8 @@
1
- require 'active_support/core_ext/hash/keys'
2
-
3
1
  module FreshConnection
4
2
  class ConnectionFactory
5
3
  def initialize(group, modify_spec = {})
6
4
  @group = group.to_sym
7
- @modify_spec = modify_spec.symbolize_keys
5
+ @modify_spec = modify_spec
8
6
  end
9
7
 
10
8
  def new_connection
@@ -22,9 +20,8 @@ module FreshConnection
22
20
  end
23
21
 
24
22
  def build_spec
25
- config = ar_spec.config.symbolize_keys
26
- group_config = (config[@group] || {}).symbolize_keys
27
- config.merge(group_config).merge(@modify_spec)
23
+ config = ar_spec.config
24
+ config.merge(config[@group] || {}).merge(@modify_spec)
28
25
  end
29
26
 
30
27
  def ar_spec
@@ -1,4 +1,3 @@
1
- require 'active_support/deprecation'
2
1
  require "fresh_connection/extend/ar_relation/for_rails#{ActiveRecord::VERSION::MAJOR}"
3
2
 
4
3
  module FreshConnection
@@ -9,12 +8,7 @@ module FreshConnection
9
8
  end
10
9
 
11
10
  def calculate(operation, column_name, options = {})
12
- if options[:readonly] == false
13
- ActiveSupport::Deprecation.warn(":readonly key has been deprecated.", caller)
14
- end
15
-
16
- slave_access = enable_slave_access && options[:readonly] != false
17
- @klass.manage_access(slave_access) { super }
11
+ @klass.manage_access(enable_slave_access) { super }
18
12
  end
19
13
 
20
14
  def exists?(*args)
@@ -25,15 +19,6 @@ module FreshConnection
25
19
  connection.open_transactions == 0 && @read_from_master.nil?
26
20
  end
27
21
 
28
- def readonly(value = true)
29
- if value == false
30
- ActiveSupport::Deprecation.warn("readonly(false) has been deprecated. Use read_master instead", caller)
31
- read_master
32
- else
33
- super
34
- end
35
- end
36
-
37
22
  private
38
23
 
39
24
  def exec_queries
@@ -1,4 +1,4 @@
1
1
  module FreshConnection
2
- VERSION = "0.4.4"
2
+ VERSION = "1.0.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,137 +1,143 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fresh_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsukasa OISHI
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-12 00:00:00.000000000 Z
11
+ date: 2016-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.0
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.3'
22
+ version: '5.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.2.0
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.3'
32
+ version: '5.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 3.2.0
40
- - - <
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '4.3'
42
+ version: '5.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.2.0
50
- - - <
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '4.3'
52
+ version: '5.0'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: mysql2
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ~>
57
+ - - "~>"
58
58
  - !ruby/object:Gem::Version
59
59
  version: 0.3.18
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - ~>
64
+ - - "~>"
65
65
  - !ruby/object:Gem::Version
66
66
  version: 0.3.18
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: bundler
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - ~>
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: '1.7'
73
+ version: 1.3.0
74
+ - - "<"
75
+ - !ruby/object:Gem::Version
76
+ version: '2.0'
74
77
  type: :development
75
78
  prerelease: false
76
79
  version_requirements: !ruby/object:Gem::Requirement
77
80
  requirements:
78
- - - ~>
81
+ - - ">="
79
82
  - !ruby/object:Gem::Version
80
- version: '1.7'
83
+ version: 1.3.0
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '2.0'
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: rake
83
89
  requirement: !ruby/object:Gem::Requirement
84
90
  requirements:
85
- - - ~>
91
+ - - ">="
86
92
  - !ruby/object:Gem::Version
87
- version: '10.0'
93
+ version: 0.8.7
88
94
  type: :development
89
95
  prerelease: false
90
96
  version_requirements: !ruby/object:Gem::Requirement
91
97
  requirements:
92
- - - ~>
98
+ - - ">="
93
99
  - !ruby/object:Gem::Version
94
- version: '10.0'
100
+ version: 0.8.7
95
101
  - !ruby/object:Gem::Dependency
96
102
  name: appraisal
97
103
  requirement: !ruby/object:Gem::Requirement
98
104
  requirements:
99
- - - ~>
105
+ - - ">="
100
106
  - !ruby/object:Gem::Version
101
- version: '2.0'
107
+ version: '0'
102
108
  type: :development
103
109
  prerelease: false
104
110
  version_requirements: !ruby/object:Gem::Requirement
105
111
  requirements:
106
- - - ~>
112
+ - - ">="
107
113
  - !ruby/object:Gem::Version
108
- version: '2.0'
114
+ version: '0'
109
115
  - !ruby/object:Gem::Dependency
110
116
  name: minitest
111
117
  requirement: !ruby/object:Gem::Requirement
112
118
  requirements:
113
- - - '>='
119
+ - - ">="
114
120
  - !ruby/object:Gem::Version
115
121
  version: '0'
116
122
  type: :development
117
123
  prerelease: false
118
124
  version_requirements: !ruby/object:Gem::Requirement
119
125
  requirements:
120
- - - '>='
126
+ - - ">="
121
127
  - !ruby/object:Gem::Version
122
128
  version: '0'
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: minitest-reporters
125
131
  requirement: !ruby/object:Gem::Requirement
126
132
  requirements:
127
- - - '>='
133
+ - - ">="
128
134
  - !ruby/object:Gem::Version
129
135
  version: '0'
130
136
  type: :development
131
137
  prerelease: false
132
138
  version_requirements: !ruby/object:Gem::Requirement
133
139
  requirements:
134
- - - '>='
140
+ - - ">="
135
141
  - !ruby/object:Gem::Version
136
142
  version: '0'
137
143
  description: https://github.com/tsukasaoishi/fresh_connection
@@ -141,9 +147,10 @@ executables: []
141
147
  extensions: []
142
148
  extra_rdoc_files: []
143
149
  files:
144
- - .gitignore
145
- - .travis.yml
150
+ - ".gitignore"
151
+ - ".travis.yml"
146
152
  - Appraisals
153
+ - CODE_OF_CONDUCT.md
147
154
  - Gemfile
148
155
  - LICENSE.txt
149
156
  - README.md
@@ -181,17 +188,17 @@ require_paths:
181
188
  - lib
182
189
  required_ruby_version: !ruby/object:Gem::Requirement
183
190
  requirements:
184
- - - '>='
191
+ - - ">="
185
192
  - !ruby/object:Gem::Version
186
193
  version: '2.0'
187
194
  required_rubygems_version: !ruby/object:Gem::Requirement
188
195
  requirements:
189
- - - '>='
196
+ - - ">="
190
197
  - !ruby/object:Gem::Version
191
198
  version: '0'
192
199
  requirements: []
193
200
  rubyforge_project:
194
- rubygems_version: 2.0.14
201
+ rubygems_version: 2.5.1
195
202
  signing_key:
196
203
  specification_version: 4
197
204
  summary: FreshConnection supports to connect with Mysql slave servers via Load Balancers.