atomically 1.1.4 → 1.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 109b9c9c0f457809981bf9f0ddccc0373cfc9419f5d76246100b788fd4063889
4
- data.tar.gz: 74814d48c0e2b4d01bd9992157374e0901f7729c0ed3076d3da6587166839423
3
+ metadata.gz: fbb0af3b3a4baf323b17773ab9572ba0e89935eea46de17cbb5bd62ca82ae7ce
4
+ data.tar.gz: 7815d478fd7d3cf46d1e21c65a32e0bd0942350c1f7364a7dbc81144dafe5355
5
5
  SHA512:
6
- metadata.gz: 01a27991eda8e03792ef5b11b2f5d3f596e4fc2086f6a75eca848d89c3d4dd550a53b5bbc5304f4e933174e30fc27a84ded106d7bd27fd0511e1a20081f3b575
7
- data.tar.gz: 738a6704402e6611f6c1451642f40472dc7ddc3a2f637b52924b96e3a9a2b8b7aa007b7ac23ce9a141c198aae7a6c44a4e0dd49a26ead7481f3b6a02e7d4f10c
6
+ metadata.gz: 0fbe27d9450a49fed06b3c29cdc38efd9c44d84da6bacb1aadaa43cdf62649c653ecc65541dea4e8b5a6b51ae4b35a4327ab9f33ad0032c2227dd22913c8ef0e
7
+ data.tar.gz: 907a4f8452b56e20126cb888d59b3cde2f394b706b9ffc6d946fb5e4fe3d2459a807f0dbf2cc09675ff2fd0476da780b7e8967c3ce6f408974cf9f1fbb76bd23
@@ -28,6 +28,7 @@ jobs:
28
28
  - 2.6
29
29
  - 2.7
30
30
  - 3.0
31
+ - 3.2
31
32
  gemfile:
32
33
  - 3.2.gemfile
33
34
  - 4.2.gemfile
@@ -35,25 +36,44 @@ jobs:
35
36
  - 5.1.gemfile
36
37
  - 5.2.gemfile
37
38
  - 6.0.gemfile
39
+ - 7.2.gemfile
38
40
  exclude:
39
41
  - gemfile: 3.2.gemfile
40
42
  ruby: 2.6
41
43
  - gemfile: 3.2.gemfile
42
44
  ruby: 3.0
45
+ - gemfile: 3.2.gemfile
46
+ ruby: 3.2
43
47
  - gemfile: 3.2.gemfile
44
48
  ruby: 2.7
45
49
  - gemfile: 4.2.gemfile
46
50
  ruby: 2.7
47
51
  - gemfile: 4.2.gemfile
48
52
  ruby: 3.0
53
+ - gemfile: 4.2.gemfile
54
+ ruby: 3.2
49
55
  - gemfile: 5.0.gemfile
50
56
  ruby: 3.0
57
+ - gemfile: 5.0.gemfile
58
+ ruby: 3.2
51
59
  - gemfile: 5.1.gemfile
52
60
  ruby: 3.0
61
+ - gemfile: 5.1.gemfile
62
+ ruby: 3.2
53
63
  - gemfile: 5.2.gemfile
54
64
  ruby: 3.0
65
+ - gemfile: 5.2.gemfile
66
+ ruby: 3.2
55
67
  - gemfile: 6.0.gemfile
56
68
  ruby: 2.2
69
+ - gemfile: 7.2.gemfile
70
+ ruby: 2.2
71
+ - gemfile: 7.2.gemfile
72
+ ruby: 2.6
73
+ - gemfile: 7.2.gemfile
74
+ ruby: 2.7
75
+ - gemfile: 7.2.gemfile
76
+ ruby: 3.0
57
77
  include:
58
78
  - db: makara_mysql
59
79
  gemfile: 6.0.gemfile
data/.gitignore CHANGED
File without changes
data/.rubocop.yml CHANGED
File without changes
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Change Log
2
2
 
3
+ ### [v1.1.4](https://github.com/khiav223577/atomically/compare/v1.1.3...v1.1.4) 2023/09/04
4
+ - [#23](https://github.com/khiav223577/atomically/pull/23) Fix - `from(nil)` did not generate the expected SQL (@ff2248)
5
+ - [#24](https://github.com/khiav223577/atomically/pull/24) Skip the step of publishing code coverage for the PR from forked repos (@khiav223577)
6
+
3
7
  ### [v1.1.3](https://github.com/khiav223577/atomically/compare/v1.1.2...v1.1.3) 2023/08/19
4
8
  - [#22](https://github.com/khiav223577/atomically/pull/22) Support Ruby 3.0 (@khiav223577)
5
9
  - [#21](https://github.com/khiav223577/atomically/pull/21) Migrating from Travis CI to GitHub Actions (@khiav223577)
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -11,8 +11,8 @@
11
11
  All methods are defined in `Atomically::QueryService` instead of defining in `ActiveRecord` directly, in order not to pollute the model instance.
12
12
 
13
13
  ## Supports
14
- - Ruby 2.2 ~ 2.7, 3.0
15
- - Rails 3.2, 4.2, 5.0, 5.1, 5.2, 6.0
14
+ - Ruby 2.2 ~ 2.7, 3.0, 3.2
15
+ - Rails 3.2, 4.2, 5.0, 5.1, 5.2, 6.0, 7.2
16
16
  - MySQL, PostgreSQL
17
17
 
18
18
  ## Table of contents
data/Rakefile CHANGED
File without changes
data/atomically.gemspec CHANGED
@@ -1,50 +1,51 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'atomically/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'atomically'
8
- spec.version = Atomically::VERSION
9
- spec.authors = ['khiav reoy']
10
- spec.email = ['mrtmrt15xn@yahoo.com.tw']
11
-
12
- spec.summary = 'An ActiveRecord extension for writing commonly useful atomic SQL statements to avoid race condition.'
13
- spec.description = 'An ActiveRecord extension for writing commonly useful atomic SQL statements to avoid race condition.'
14
- spec.homepage = 'https://github.com/khiav223577/atomically'
15
- spec.license = 'MIT'
16
-
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
- # if spec.respond_to?(:metadata)
20
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- # else
22
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- # end
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject{|f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = 'exe'
27
- spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f) }
28
- spec.require_paths = ['lib']
29
- spec.metadata = {
30
- 'homepage_uri' => 'https://github.com/khiav223577/atomically',
31
- 'changelog_uri' => 'https://github.com/khiav223577/atomically/blob/master/CHANGELOG.md',
32
- 'source_code_uri' => 'https://github.com/khiav223577/atomically',
33
- 'documentation_uri' => 'https://www.rubydoc.info/gems/atomically',
34
- 'bug_tracker_uri' => 'https://github.com/khiav223577/atomically/issues',
35
- }
36
-
37
- spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
38
- spec.add_development_dependency 'rake', '~> 12.0'
39
- spec.add_development_dependency 'sqlite3', '~> 1.3'
40
- spec.add_development_dependency 'minitest', '~> 5.0'
41
- spec.add_development_dependency 'mysql2', '>= 0.3'
42
- spec.add_development_dependency 'pg', '~> 0.18'
43
- spec.add_development_dependency 'pluck_all', '>= 2.0.3'
44
- spec.add_development_dependency 'timecop', '~> 0.9.1'
45
-
46
- spec.add_dependency 'activerecord', '>= 3'
47
- spec.add_dependency 'activerecord-import', '>= 0.27.0'
48
- spec.add_dependency 'rails_or', '>= 1.1.8'
49
- spec.add_dependency 'update_all_scope', '~> 0.1.0'
50
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'atomically/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'atomically'
8
+ spec.version = Atomically::VERSION
9
+ spec.authors = ['khiav reoy']
10
+ spec.email = ['mrtmrt15xn@yahoo.com.tw']
11
+
12
+ spec.summary = 'An ActiveRecord extension for writing commonly useful atomic SQL statements to avoid race condition.'
13
+ spec.description = 'An ActiveRecord extension for writing commonly useful atomic SQL statements to avoid race condition.'
14
+ spec.homepage = 'https://github.com/khiav223577/atomically'
15
+ spec.license = 'MIT'
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ # end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject{|f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+ spec.metadata = {
30
+ 'homepage_uri' => 'https://github.com/khiav223577/atomically',
31
+ 'changelog_uri' => 'https://github.com/khiav223577/atomically/blob/master/CHANGELOG.md',
32
+ 'source_code_uri' => 'https://github.com/khiav223577/atomically',
33
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/atomically',
34
+ 'bug_tracker_uri' => 'https://github.com/khiav223577/atomically/issues',
35
+ }
36
+
37
+ spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
38
+ spec.add_development_dependency 'rake', '~> 12.0'
39
+ spec.add_development_dependency 'sqlite3', '~> 1.3'
40
+ spec.add_development_dependency 'minitest', '~> 5.0'
41
+ spec.add_development_dependency 'mysql2', '>= 0.3'
42
+ spec.add_development_dependency 'pg', '~> 0.18'
43
+ spec.add_development_dependency 'pluck_all', '>= 2.0.3'
44
+ spec.add_development_dependency 'timecop', '~> 0.9.1'
45
+ spec.add_development_dependency 'rails_compatibility', '>= 0.0.8'
46
+
47
+ spec.add_dependency 'activerecord', '>= 3'
48
+ spec.add_dependency 'activerecord-import', '>= 0.27.0'
49
+ spec.add_dependency 'rails_or', '>= 1.1.8'
50
+ spec.add_dependency 'update_all_scope', '~> 0.1.0'
51
+ end
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
data/gemfiles/3.2.gemfile CHANGED
@@ -11,6 +11,7 @@ group :test do
11
11
  gem 'pluck_all', '>= 2.0.3'
12
12
  gem 'timecop', '~> 0.9.1'
13
13
  gem 'update_all_scope', '~> 0.1.0'
14
+ gem 'rails_compatibility', '>= 0.0.8'
14
15
  end
15
16
 
16
17
  gemspec path: '../'
data/gemfiles/4.2.gemfile CHANGED
@@ -11,6 +11,7 @@ group :test do
11
11
  gem 'pluck_all', '>= 2.0.3'
12
12
  gem 'timecop', '~> 0.9.1'
13
13
  gem 'update_all_scope', '~> 0.1.0'
14
+ gem 'rails_compatibility', '>= 0.0.8'
14
15
  end
15
16
 
16
17
  gemspec path: '../'
data/gemfiles/5.0.gemfile CHANGED
@@ -11,6 +11,7 @@ group :test do
11
11
  gem 'pluck_all', '>= 2.0.3'
12
12
  gem 'timecop', '~> 0.9.1'
13
13
  gem 'update_all_scope', '~> 0.1.0'
14
+ gem 'rails_compatibility', '>= 0.0.8'
14
15
  end
15
16
 
16
17
  gemspec path: '../'
data/gemfiles/5.1.gemfile CHANGED
@@ -11,6 +11,7 @@ group :test do
11
11
  gem 'pluck_all', '>= 2.0.3'
12
12
  gem 'timecop', '~> 0.9.1'
13
13
  gem 'update_all_scope', '~> 0.1.0'
14
+ gem 'rails_compatibility', '>= 0.0.8'
14
15
  end
15
16
 
16
17
  gemspec path: '../'
data/gemfiles/5.2.gemfile CHANGED
@@ -11,6 +11,7 @@ group :test do
11
11
  gem 'pluck_all', '>= 2.0.3'
12
12
  gem 'timecop', '~> 0.9.1'
13
13
  gem 'update_all_scope', '~> 0.1.0'
14
+ gem 'rails_compatibility', '>= 0.0.8'
14
15
  end
15
16
 
16
17
  gemspec path: '../'
data/gemfiles/6.0.gemfile CHANGED
@@ -10,6 +10,7 @@ group :test do
10
10
  gem 'pluck_all', '>= 2.0.4'
11
11
  gem 'timecop', '~> 0.9.1'
12
12
  gem 'update_all_scope', '~> 0.1.0'
13
+ gem 'rails_compatibility', '>= 0.0.8'
13
14
  end
14
15
 
15
16
  gemspec path: '../'
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 7.2.1'
4
+
5
+ group :test do
6
+ gem 'mysql2', '0.5.1' if %w[mysql makara_mysql].include?(ENV['DB'])
7
+ gem 'pg', '~> 1.4.6' if %w[pg makara_pg].include?(ENV['DB'])
8
+ gem 'makara', '~> 0.4.1' if %w[makara_mysql makara_pg].include?(ENV['DB'])
9
+ gem 'simplecov', '< 0.18'
10
+ gem 'pluck_all', '>= 2.0.4'
11
+ gem 'timecop', '~> 0.9.1'
12
+ gem 'update_all_scope', '~> 0.1.0'
13
+ gem 'rails_compatibility', '>= 0.0.8'
14
+ gem 'zeitwerk', '~> 2.6.18'
15
+ end
16
+
17
+ gemspec path: '../'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -87,7 +87,7 @@ class Atomically::QueryService
87
87
  id_column = quote_column_with_table(:id)
88
88
  @klass.transaction do
89
89
  @relation.connection.execute('SET @ids := NULL')
90
- @relation.where("(SELECT @ids := CONCAT_WS(',', #{id_column}, @ids))").update_all(*args) # 撈出有真的被更新的 id,用逗號串在一起
90
+ @relation.where("((@ids := CONCAT_WS(',', #{id_column}, @ids)) IS NOT NULL)").update_all(*args) # 撈出有真的被更新的 id,用逗號串在一起
91
91
  ids = @klass.from(Arel.sql('DUAL')).pluck(Arel.sql('@ids')).first
92
92
  end
93
93
  return ids.try{|s| s.split(',').map(&:to_i).uniq.sort } || [] # 將 id 從字串取出來 @id 的格式範例: '1,4,12'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Atomically
4
- VERSION = '1.1.4'
4
+ VERSION = '1.1.5'
5
5
  end
data/lib/atomically.rb CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomically
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - khiav reoy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-04 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,6 +128,20 @@ dependencies:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: 0.9.1
131
+ - !ruby/object:Gem::Dependency
132
+ name: rails_compatibility
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 0.0.8
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 0.0.8
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: activerecord
133
147
  requirement: !ruby/object:Gem::Requirement
@@ -210,6 +224,7 @@ files:
210
224
  - gemfiles/5.1.gemfile
211
225
  - gemfiles/5.2.gemfile
212
226
  - gemfiles/6.0.gemfile
227
+ - gemfiles/7.2.gemfile
213
228
  - lib/atomically.rb
214
229
  - lib/atomically/active_record/extension.rb
215
230
  - lib/atomically/adapter_check_service.rb
@@ -243,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
258
  - !ruby/object:Gem::Version
244
259
  version: '0'
245
260
  requirements: []
246
- rubygems_version: 3.2.14
261
+ rubygems_version: 3.5.18
247
262
  signing_key:
248
263
  specification_version: 4
249
264
  summary: An ActiveRecord extension for writing commonly useful atomic SQL statements