octoshark 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +7 -59
- data/.ruby-version +1 -1
- data/Appraisals +4 -10
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/README.md +1 -2
- data/gemfiles/rails5.1.gemfile +0 -2
- data/gemfiles/rails5.2.gemfile +0 -2
- data/gemfiles/rails6.0.gemfile +0 -2
- data/gemfiles/rails6.1.gemfile +0 -2
- data/gemfiles/rails7.0.gemfile +0 -2
- data/gemfiles/{rails3.0.gemfile → rails7.1.gemfile} +1 -3
- data/lib/octoshark/active_record_extensions.rb +2 -2
- data/lib/octoshark/connection_pools_manager.rb +1 -0
- data/lib/octoshark/version.rb +1 -1
- data/octoshark.gemspec +1 -1
- data/spec/support/config.yml.github +0 -2
- data/spec/support/config.yml.template +0 -2
- metadata +9 -14
- data/gemfiles/rails3.1.gemfile +0 -9
- data/gemfiles/rails3.2.gemfile +0 -9
- data/gemfiles/rails4.0.gemfile +0 -9
- data/gemfiles/rails4.1.gemfile +0 -9
- data/gemfiles/rails4.2.gemfile +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '098b8a529ace3b8a925536484b3c3de41d7eea6336ec601228173b8000d55ec6'
|
4
|
+
data.tar.gz: f9570b710a2a4c00371e840f12a74258ee60f5d1f42cbf3934e4d2ff57f8cb40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62600a72c3ce6590beb8dfe0638bcaf00fc0cfea95afe146b9c1c97d4d2b1ad8ae96e533af6361ca8acb75abc3a50db0bbb03e3dee9532ce9812b341024cf539
|
7
|
+
data.tar.gz: aca0193931b046f9918a5a0b4a076c945aabb8f99133465b8619cda3e5b5064cc0d7d74fc3a8b15c2c3ee200d1aa8d39f1291ab93228143d546ccc2076c4eba1
|
data/.github/workflows/build.yml
CHANGED
@@ -9,63 +9,6 @@ on:
|
|
9
9
|
- master
|
10
10
|
|
11
11
|
jobs:
|
12
|
-
legacy:
|
13
|
-
runs-on: ubuntu-18.04
|
14
|
-
services:
|
15
|
-
mysql:
|
16
|
-
image: mysql:5.5
|
17
|
-
env:
|
18
|
-
MYSQL_ROOT_PASSWORD: pass
|
19
|
-
ports:
|
20
|
-
- "3306:3306"
|
21
|
-
options: >-
|
22
|
-
--health-cmd="mysqladmin ping"
|
23
|
-
--health-interval=10s
|
24
|
-
--health-timeout=5s
|
25
|
-
--health-retries=3
|
26
|
-
|
27
|
-
name: ruby-${{ matrix.ruby }} ${{ matrix.gemfile }}
|
28
|
-
strategy:
|
29
|
-
matrix:
|
30
|
-
include:
|
31
|
-
- gemfile: rails3.0
|
32
|
-
ruby: 2.4
|
33
|
-
- gemfile: rails3.1
|
34
|
-
ruby: 2.4
|
35
|
-
- gemfile: rails3.2
|
36
|
-
ruby: 2.4
|
37
|
-
|
38
|
-
- gemfile: rails4.0
|
39
|
-
ruby: 2.4
|
40
|
-
- gemfile: rails4.1
|
41
|
-
ruby: 2.4
|
42
|
-
- gemfile: rails4.2
|
43
|
-
ruby: 2.4
|
44
|
-
|
45
|
-
env:
|
46
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
47
|
-
BUNDLE_PATH_RELATIVE_TO_CWD: true
|
48
|
-
|
49
|
-
steps:
|
50
|
-
- uses: actions/checkout@master
|
51
|
-
|
52
|
-
- name: Set up Ruby
|
53
|
-
uses: ruby/setup-ruby@v1
|
54
|
-
with:
|
55
|
-
ruby-version: ${{ matrix.ruby }}
|
56
|
-
bundler: default
|
57
|
-
bundler-cache: true
|
58
|
-
|
59
|
-
- name: Set up database
|
60
|
-
run: |
|
61
|
-
cp spec/support/config.yml.github spec/support/config.yml
|
62
|
-
bundle exec rake db:create
|
63
|
-
|
64
|
-
- name: Run tests
|
65
|
-
run: |
|
66
|
-
bundle exec rspec spec
|
67
|
-
|
68
|
-
|
69
12
|
latest:
|
70
13
|
runs-on: ubuntu-latest
|
71
14
|
services:
|
@@ -101,10 +44,15 @@ jobs:
|
|
101
44
|
- gemfile: rails6.1
|
102
45
|
ruby: 3.0
|
103
46
|
|
104
|
-
- gemfile: rails7.0
|
105
|
-
ruby: 2.7
|
106
47
|
- gemfile: rails7.0
|
107
48
|
ruby: 3.0
|
49
|
+
- gemfile: rails7.0
|
50
|
+
ruby: 3.1
|
51
|
+
|
52
|
+
- gemfile: rails7.1
|
53
|
+
ruby: 3.1
|
54
|
+
- gemfile: rails7.1
|
55
|
+
ruby: 3.2
|
108
56
|
|
109
57
|
env:
|
110
58
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.2
|
data/Appraisals
CHANGED
@@ -1,29 +1,23 @@
|
|
1
1
|
appraise "rails5.1" do
|
2
2
|
gem "activerecord", "~> 5.1.0"
|
3
|
-
gem "mysql2", "~> 0.5.2"
|
4
|
-
gem "sqlite3", "~> 1.4.1"
|
5
3
|
end
|
6
4
|
|
7
5
|
appraise "rails5.2" do
|
8
6
|
gem "activerecord", "~> 5.2.0"
|
9
|
-
gem "mysql2", "~> 0.5.2"
|
10
|
-
gem "sqlite3", "~> 1.4.1"
|
11
7
|
end
|
12
8
|
|
13
9
|
appraise "rails6.0" do
|
14
10
|
gem "activerecord", "~> 6.0.0"
|
15
|
-
gem "mysql2", "~> 0.5.2"
|
16
|
-
gem "sqlite3", "~> 1.4.1"
|
17
11
|
end
|
18
12
|
|
19
13
|
appraise "rails6.1" do
|
20
14
|
gem "activerecord", "~> 6.1.0"
|
21
|
-
gem "mysql2", "~> 0.5.2"
|
22
|
-
gem "sqlite3", "~> 1.4.1"
|
23
15
|
end
|
24
16
|
|
25
17
|
appraise "rails7.0" do
|
26
18
|
gem "activerecord", "~> 7.0.0"
|
27
|
-
|
28
|
-
|
19
|
+
end
|
20
|
+
|
21
|
+
appraise "rails7.1" do
|
22
|
+
gem "activerecord", "~> 7.1.0"
|
29
23
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## 0.5.1 2024-04-22
|
4
|
+
|
5
|
+
- Add kwargs argument to the ActiveRecordAbstractAdapter
|
6
|
+
|
7
|
+
## 0.5.0 2023-10-27
|
8
|
+
|
9
|
+
- Add support for Rails 7.1
|
10
|
+
- Drop legacy test job because ubuntu-18.04 build node is not available anymore
|
11
|
+
|
3
12
|
## 0.4.0 2022-02-12
|
4
13
|
|
5
14
|
- Add support for Rails 7.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
![Octoshark logo](http://dalibornasevic.com/images/octoshark.png)
|
2
2
|
|
3
|
-
![
|
3
|
+
![Build status](https://github.com/dalibor/octoshark/actions/workflows/build.yml/badge.svg)
|
4
4
|
|
5
5
|
Octoshark is a simple ActiveRecord connection manager. It provides connection switching mechanisms that can be used in various scenarios like master-slave, sharding or multi-tenant architecture.
|
6
6
|
|
@@ -54,7 +54,6 @@ config = {
|
|
54
54
|
password: 'pass',
|
55
55
|
pool: 1,
|
56
56
|
encoding: 'utf8',
|
57
|
-
reconnect: false
|
58
57
|
}
|
59
58
|
```
|
60
59
|
|
data/gemfiles/rails5.1.gemfile
CHANGED
data/gemfiles/rails5.2.gemfile
CHANGED
data/gemfiles/rails6.0.gemfile
CHANGED
data/gemfiles/rails6.1.gemfile
CHANGED
data/gemfiles/rails7.0.gemfile
CHANGED
@@ -26,12 +26,12 @@ module Octoshark
|
|
26
26
|
module ActiveRecordAbstractAdapter
|
27
27
|
attr_accessor :connection_name, :database_name
|
28
28
|
|
29
|
-
def log(sql, name = "SQL", *other_args, &block)
|
29
|
+
def log(sql, name = "SQL", *other_args, **kwargs, &block)
|
30
30
|
if connection_name || database_name
|
31
31
|
name = "[Octoshark: #{[connection_name, database_name].compact.join(' ')}] #{name}"
|
32
32
|
end
|
33
33
|
|
34
|
-
super(sql, name, *other_args, &block)
|
34
|
+
super(sql, name, *other_args, **kwargs, &block)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -81,6 +81,7 @@ module Octoshark
|
|
81
81
|
def build_connection_pool_spec(name, config)
|
82
82
|
if active_record_6_1_or_7?
|
83
83
|
env_name = defined?(Rails) ? Rails.env : nil
|
84
|
+
require "active_record/database_configurations"
|
84
85
|
db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(env_name, name, config)
|
85
86
|
|
86
87
|
pool_config_class = ActiveRecord::ConnectionAdapters::PoolConfig
|
data/lib/octoshark/version.rb
CHANGED
data/octoshark.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency "activerecord", ">= 3.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "rake"
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.12.0"
|
25
25
|
spec.add_development_dependency "sqlite3", "~> 1.4.1"
|
26
26
|
spec.add_development_dependency "mysql2", "~> 0.5.2"
|
27
27
|
spec.add_development_dependency "appraisal"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
db1:
|
2
2
|
adapter: mysql2
|
3
3
|
encoding: utf8
|
4
|
-
reconnect: false
|
5
4
|
database: octoshark_db1
|
6
5
|
pool: 5
|
7
6
|
username: root
|
@@ -12,7 +11,6 @@ db1:
|
|
12
11
|
db2:
|
13
12
|
adapter: mysql2
|
14
13
|
encoding: utf8
|
15
|
-
reconnect: false
|
16
14
|
database: octoshark_db2
|
17
15
|
pool: 5
|
18
16
|
username: root
|
@@ -1,7 +1,6 @@
|
|
1
1
|
db1:
|
2
2
|
adapter: mysql2
|
3
3
|
encoding: utf8
|
4
|
-
reconnect: false
|
5
4
|
database: octoshark_db1
|
6
5
|
pool: 5
|
7
6
|
username: root
|
@@ -12,7 +11,6 @@ db1:
|
|
12
11
|
db2:
|
13
12
|
adapter: mysql2
|
14
13
|
encoding: utf8
|
15
|
-
reconnect: false
|
16
14
|
database: octoshark_db2
|
17
15
|
pool: 5
|
18
16
|
username: root
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octoshark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dalibor Nasevic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.12.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.12.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,18 +111,13 @@ files:
|
|
111
111
|
- LICENSE.txt
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
|
-
- gemfiles/rails3.0.gemfile
|
115
|
-
- gemfiles/rails3.1.gemfile
|
116
|
-
- gemfiles/rails3.2.gemfile
|
117
|
-
- gemfiles/rails4.0.gemfile
|
118
|
-
- gemfiles/rails4.1.gemfile
|
119
|
-
- gemfiles/rails4.2.gemfile
|
120
114
|
- gemfiles/rails5.0.gemfile
|
121
115
|
- gemfiles/rails5.1.gemfile
|
122
116
|
- gemfiles/rails5.2.gemfile
|
123
117
|
- gemfiles/rails6.0.gemfile
|
124
118
|
- gemfiles/rails6.1.gemfile
|
125
119
|
- gemfiles/rails7.0.gemfile
|
120
|
+
- gemfiles/rails7.1.gemfile
|
126
121
|
- lib/octoshark.rb
|
127
122
|
- lib/octoshark/active_record_extensions.rb
|
128
123
|
- lib/octoshark/connection_manager.rb
|
@@ -143,7 +138,7 @@ homepage: https://github.com/dalibor/octoshark
|
|
143
138
|
licenses:
|
144
139
|
- MIT
|
145
140
|
metadata: {}
|
146
|
-
post_install_message:
|
141
|
+
post_install_message:
|
147
142
|
rdoc_options: []
|
148
143
|
require_paths:
|
149
144
|
- lib
|
@@ -158,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
153
|
- !ruby/object:Gem::Version
|
159
154
|
version: '0'
|
160
155
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
162
|
-
signing_key:
|
156
|
+
rubygems_version: 3.4.10
|
157
|
+
signing_key:
|
163
158
|
specification_version: 4
|
164
159
|
summary: Octoshark is an ActiveRecord connection switcher
|
165
160
|
test_files:
|
data/gemfiles/rails3.1.gemfile
DELETED
data/gemfiles/rails3.2.gemfile
DELETED
data/gemfiles/rails4.0.gemfile
DELETED
data/gemfiles/rails4.1.gemfile
DELETED