transaction_isolation_continued 1.1.0 → 1.1.1
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/.github/workflows/rubygem.yml +28 -0
- data/Gemfile.old.local +27 -0
- data/README.md +2 -2
- data/lib/transaction_isolation/version.rb +1 -1
- data/lib/transaction_isolation.rb +13 -8
- data/lib/transaction_isolation_continued.rb +1 -0
- data/spec/gem_template_spec.rb +11 -0
- data/spec/spec_helper.rb +15 -0
- data/transaction_isolation_continued.gemspec +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5abbf92825c1d63049fbae813f27d3df651bc4895a01626d6d01c4223ebc6ed
|
4
|
+
data.tar.gz: c589d78b41a18f1984f36e94f3eacd5f61740617a02889e6d754964c456671dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c0ae13dc44a64f176d182a9874473c43bf3b98e1d29df6a1ede734a3730d8fb9604a7059417961989c2ab95e9f21f8c799bd491b03213c40b5930e90e5afd2
|
7
|
+
data.tar.gz: 9f74455b9ae024d26958f12bda07bb7c714db27ad20ae7f7f94d9bdde1a6978f2a6237aa39acfbdfc50ea5c9854d2edb057e447dd5a6bf46bb87c198a16e1bba
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
branches: [ main ]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v3
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7
|
18
|
+
bundler-cache: true
|
19
|
+
- name: Publish to RubyGems
|
20
|
+
run: |
|
21
|
+
mkdir -p $HOME/.gem
|
22
|
+
touch $HOME/.gem/credentials
|
23
|
+
chmod 0600 $HOME/.gem/credentials
|
24
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
25
|
+
gem build *.gemspec
|
26
|
+
gem push *.gem
|
27
|
+
env:
|
28
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/Gemfile.old.local
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem "rake"
|
6
|
+
|
7
|
+
platform :ruby do
|
8
|
+
# https://github.com/rails/rails/pull/51592
|
9
|
+
gem "sqlite3", "~> 1.4"
|
10
|
+
gem "mysql2"
|
11
|
+
gem "pg"
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'ruby2_keywords' if RUBY_VERSION < '2.7'
|
15
|
+
|
16
|
+
group :test do
|
17
|
+
gem 'simplecov'
|
18
|
+
gem 'simplecov_json_formatter'
|
19
|
+
end
|
20
|
+
|
21
|
+
gem 'rubocop', require: false
|
22
|
+
|
23
|
+
platform :jruby do
|
24
|
+
gem 'activerecord-jdbcpostgresql-adapter'
|
25
|
+
gem 'activerecord-jdbcmysql-adapter'
|
26
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
|
27
|
+
end
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ end
|
|
23
23
|
## Requirements
|
24
24
|
|
25
25
|
- Rails: ActiveRecord 5.2+.
|
26
|
-
- Database: MySQL, PostgreSQL, SQLite.
|
26
|
+
- Database: MySQL(compatible with mysql 5 and 8), PostgreSQL, SQLite.
|
27
27
|
- Ruby: MRI 2.5+.
|
28
28
|
|
29
29
|
## Installation
|
@@ -105,7 +105,7 @@ Run tests on the selected database (mysql2 by default):
|
|
105
105
|
|
106
106
|
```bash
|
107
107
|
# passing desired database, active record version and ruby version
|
108
|
-
docker compose run -e db=sqlite3 -e BUNDLE_GEMFILE=gemfiles/activerecord-7.0/Gemfile.sqlite3
|
108
|
+
docker compose run -e db=sqlite3 -e BUNDLE_GEMFILE=gemfiles/activerecord-7.0/Gemfile.sqlite3 ruby_2_7 bash -c ./docker/test-ruby.sh
|
109
109
|
|
110
110
|
# db options: mysql2, postgresql, sqlite3
|
111
111
|
# active record version options: 5.2, 6.0, 6.1, 7.0
|
@@ -36,15 +36,20 @@ module TransactionIsolation
|
|
36
36
|
# Setup applying the patch after Rails is initialized.
|
37
37
|
class Railtie < ::Rails::Railtie
|
38
38
|
config.after_initialize do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
begin
|
40
|
+
if TransactionIsolation.config.detect_mysql_isolation_variable && ActiveRecord::Base.connection.adapter_name == 'Mysql2'
|
41
|
+
mysql_version = ActiveRecord::Base.connection.select_value('SELECT version()')
|
42
|
+
TransactionIsolation.config.mysql_isolation_variable = if mysql_version >= '8'
|
43
|
+
'transaction_isolation'
|
44
|
+
else
|
45
|
+
'tx_isolation'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
TransactionIsolation.apply_activerecord_patch
|
50
|
+
rescue ActiveRecord::NoDatabaseError
|
51
|
+
# This is expected when running rake db:create
|
46
52
|
end
|
47
|
-
TransactionIsolation.apply_activerecord_patch
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'transaction_isolation'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "gem_template"
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
# Enable flags like --only-failures and --next-failure
|
7
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
8
|
+
|
9
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
10
|
+
config.disable_monkey_patching!
|
11
|
+
|
12
|
+
config.expect_with :rspec do |c|
|
13
|
+
c.syntax = :expect
|
14
|
+
end
|
15
|
+
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.description = 'Set transaction isolation level in the ActiveRecord in a database agnostic way.
|
13
13
|
Works with MySQL, PostgreSQL and SQLite as long as you are using new adapters mysql2, pg or sqlite3.
|
14
14
|
Supports all ANSI SQL isolation levels: :serializable, :repeatable_read, :read_committed, :read_uncommitted.'
|
15
|
-
s.required_ruby_version = '>=
|
15
|
+
s.required_ruby_version = '>= 2.3'
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transaction_isolation_continued
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iago Pimenta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -63,8 +63,10 @@ extra_rdoc_files: []
|
|
63
63
|
files:
|
64
64
|
- ".dockerignore"
|
65
65
|
- ".github/workflows/main.yml"
|
66
|
+
- ".github/workflows/rubygem.yml"
|
66
67
|
- ".gitignore"
|
67
68
|
- Gemfile
|
69
|
+
- Gemfile.old.local
|
68
70
|
- LICENSE
|
69
71
|
- README.md
|
70
72
|
- Rakefile
|
@@ -104,6 +106,9 @@ files:
|
|
104
106
|
- lib/transaction_isolation/active_record/errors.rb
|
105
107
|
- lib/transaction_isolation/configuration.rb
|
106
108
|
- lib/transaction_isolation/version.rb
|
109
|
+
- lib/transaction_isolation_continued.rb
|
110
|
+
- spec/gem_template_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
107
112
|
- test/db/all.rb
|
108
113
|
- test/db/db.rb
|
109
114
|
- test/db/migrations.rb
|
@@ -131,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
136
|
requirements:
|
132
137
|
- - ">="
|
133
138
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
139
|
+
version: '2.3'
|
135
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
141
|
requirements:
|
137
142
|
- - ">="
|
@@ -144,6 +149,8 @@ specification_version: 4
|
|
144
149
|
summary: Set transaction isolation level in the ActiveRecord in a database agnostic
|
145
150
|
way.
|
146
151
|
test_files:
|
152
|
+
- spec/gem_template_spec.rb
|
153
|
+
- spec/spec_helper.rb
|
147
154
|
- test/db/all.rb
|
148
155
|
- test/db/db.rb
|
149
156
|
- test/db/migrations.rb
|