update_values_all 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +46 -30
- data/README.md +1 -1
- data/Rakefile +3 -3
- data/lib/update_values_all/adapters/postgres.rb +1 -1
- data/lib/update_values_all/batch_update.rb +14 -7
- data/lib/update_values_all/railtie.rb +2 -0
- data/lib/update_values_all/version.rb +1 -1
- data/lib/update_values_all.rb +0 -12
- metadata +7 -8
- data/update_values_all.gemspec +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 407100066be1214e75c13c733db1fcb66ab8eae08a73d5edaf28b9fe805a54af
|
4
|
+
data.tar.gz: 4a0cb4a3f0aa7e4b9c6154ad760fe53a486b96ab96e46502f9ac4daeed6d3150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b31196412dcf1f69187a979c0bde27e60262d0683ba0967be698a7768f187452720099fda52253a954539d71668879d9c7d712735af7731aa8f414ab8dbdd07a
|
7
|
+
data.tar.gz: 97f917b319a95a738fcf7d2e510a86e7b1a6e1b92fcbfbba210498e90391cb0992ba8479add5302302c52c3c10d341b5824018326a31617418c729006a25d49f
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in update_values_all.gemspec
|
6
6
|
gemspec
|
@@ -11,4 +11,4 @@ gem 'lefthook', require: false
|
|
11
11
|
gem 'pg'
|
12
12
|
gem 'rspec'
|
13
13
|
gem 'rspec-rails'
|
14
|
-
gem 'rubocop-gp', github: 'corp-gp/rubocop-gp', require: false
|
14
|
+
gem 'rubocop-gp', github: 'corp-gp/rubocop-gp', require: false
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/corp-gp/rubocop-gp.git
|
3
|
-
revision:
|
3
|
+
revision: e5bd900ce4b10077cf8f4ae88a5a6e32e7861b65
|
4
4
|
specs:
|
5
|
-
rubocop-gp (0.0.
|
5
|
+
rubocop-gp (0.0.4)
|
6
6
|
rubocop
|
7
|
+
rubocop-capybara
|
8
|
+
rubocop-factory_bot
|
7
9
|
rubocop-performance
|
8
10
|
rubocop-rails
|
9
11
|
rubocop-rspec
|
12
|
+
rubocop-rspec_rails
|
10
13
|
|
11
14
|
PATH
|
12
15
|
remote: .
|
13
16
|
specs:
|
14
|
-
update_values_all (1.0.
|
17
|
+
update_values_all (1.0.2)
|
15
18
|
activerecord (>= 4.2)
|
16
19
|
|
17
20
|
GEM
|
@@ -46,7 +49,7 @@ GEM
|
|
46
49
|
activesupport (>= 3.0.0)
|
47
50
|
railties (>= 3.0.0)
|
48
51
|
thor (>= 0.14.6)
|
49
|
-
concurrent-ruby (1.
|
52
|
+
concurrent-ruby (1.3.4)
|
50
53
|
crass (1.0.6)
|
51
54
|
diff-lcs (1.5.0)
|
52
55
|
dotenv (2.8.1)
|
@@ -54,23 +57,27 @@ GEM
|
|
54
57
|
dotenv (= 2.8.1)
|
55
58
|
railties (>= 3.2)
|
56
59
|
erubi (1.12.0)
|
57
|
-
i18n (1.
|
60
|
+
i18n (1.14.5)
|
58
61
|
concurrent-ruby (~> 1.0)
|
59
|
-
json (2.
|
62
|
+
json (2.7.2)
|
63
|
+
language_server-protocol (3.17.0.3)
|
60
64
|
lefthook (1.3.8)
|
61
65
|
loofah (2.19.1)
|
62
66
|
crass (~> 1.0.2)
|
63
67
|
nokogiri (>= 1.5.9)
|
64
68
|
method_source (1.0.0)
|
65
|
-
minitest (5.
|
66
|
-
nokogiri (1.
|
69
|
+
minitest (5.25.1)
|
70
|
+
nokogiri (1.16.7-arm64-darwin)
|
67
71
|
racc (~> 1.4)
|
68
|
-
|
69
|
-
|
72
|
+
nokogiri (1.16.7-x86_64-linux)
|
73
|
+
racc (~> 1.4)
|
74
|
+
parallel (1.26.3)
|
75
|
+
parser (3.3.4.2)
|
70
76
|
ast (~> 2.4.1)
|
77
|
+
racc
|
71
78
|
pg (1.4.6)
|
72
|
-
racc (1.
|
73
|
-
rack (2.2.
|
79
|
+
racc (1.8.1)
|
80
|
+
rack (2.2.9)
|
74
81
|
rack-test (2.1.0)
|
75
82
|
rack (>= 1.3)
|
76
83
|
rails-dom-testing (2.0.3)
|
@@ -87,8 +94,9 @@ GEM
|
|
87
94
|
zeitwerk (~> 2.5)
|
88
95
|
rainbow (3.1.1)
|
89
96
|
rake (13.0.6)
|
90
|
-
regexp_parser (2.
|
91
|
-
rexml (3.
|
97
|
+
regexp_parser (2.9.2)
|
98
|
+
rexml (3.3.6)
|
99
|
+
strscan
|
92
100
|
rspec (3.11.0)
|
93
101
|
rspec-core (~> 3.11.0)
|
94
102
|
rspec-expectations (~> 3.11.0)
|
@@ -110,38 +118,46 @@ GEM
|
|
110
118
|
rspec-mocks (~> 3.11)
|
111
119
|
rspec-support (~> 3.11)
|
112
120
|
rspec-support (3.11.0)
|
113
|
-
rubocop (1.
|
121
|
+
rubocop (1.65.1)
|
114
122
|
json (~> 2.3)
|
123
|
+
language_server-protocol (>= 3.17.0)
|
115
124
|
parallel (~> 1.10)
|
116
|
-
parser (>= 3.
|
125
|
+
parser (>= 3.3.0.2)
|
117
126
|
rainbow (>= 2.2.2, < 4.0)
|
118
|
-
regexp_parser (>=
|
127
|
+
regexp_parser (>= 2.4, < 3.0)
|
119
128
|
rexml (>= 3.2.5, < 4.0)
|
120
|
-
rubocop-ast (>= 1.
|
129
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
121
130
|
ruby-progressbar (~> 1.7)
|
122
131
|
unicode-display_width (>= 2.4.0, < 3.0)
|
123
|
-
rubocop-ast (1.
|
124
|
-
parser (>= 3.
|
125
|
-
rubocop-capybara (2.
|
132
|
+
rubocop-ast (1.32.1)
|
133
|
+
parser (>= 3.3.1.0)
|
134
|
+
rubocop-capybara (2.21.0)
|
126
135
|
rubocop (~> 1.41)
|
127
|
-
rubocop-
|
128
|
-
rubocop (
|
129
|
-
|
130
|
-
|
136
|
+
rubocop-factory_bot (2.26.1)
|
137
|
+
rubocop (~> 1.61)
|
138
|
+
rubocop-performance (1.21.1)
|
139
|
+
rubocop (>= 1.48.1, < 2.0)
|
140
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
141
|
+
rubocop-rails (2.26.0)
|
131
142
|
activesupport (>= 4.2.0)
|
132
143
|
rack (>= 1.1)
|
133
|
-
rubocop (>= 1.
|
134
|
-
|
135
|
-
|
136
|
-
rubocop
|
144
|
+
rubocop (>= 1.52.0, < 2.0)
|
145
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
146
|
+
rubocop-rspec (3.0.4)
|
147
|
+
rubocop (~> 1.61)
|
148
|
+
rubocop-rspec_rails (2.30.0)
|
149
|
+
rubocop (~> 1.61)
|
150
|
+
rubocop-rspec (~> 3, >= 3.0.1)
|
137
151
|
ruby-progressbar (1.13.0)
|
152
|
+
strscan (3.1.0)
|
138
153
|
thor (1.2.1)
|
139
154
|
tzinfo (2.0.6)
|
140
155
|
concurrent-ruby (~> 1.0)
|
141
|
-
unicode-display_width (2.
|
156
|
+
unicode-display_width (2.5.0)
|
142
157
|
zeitwerk (2.6.7)
|
143
158
|
|
144
159
|
PLATFORMS
|
160
|
+
arm64-darwin-23
|
145
161
|
x86_64-linux
|
146
162
|
|
147
163
|
DEPENDENCIES
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
@@ -4,7 +4,7 @@ module UpdateValuesAll
|
|
4
4
|
module Adapters
|
5
5
|
module Postgres
|
6
6
|
|
7
|
-
def
|
7
|
+
def pg_update_values_all(data, key_to_match:, touch: false, sql_update_expression: 'updated_at = CURRENT_TIMESTAMP')
|
8
8
|
keys = data.first.keys
|
9
9
|
|
10
10
|
sql_values = +''
|
@@ -1,16 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "update_values_all/adapters/postgres"
|
4
|
+
|
3
5
|
module UpdateValuesAll
|
4
6
|
module BatchUpdate
|
5
7
|
|
6
|
-
def self.extended(
|
7
|
-
|
8
|
-
|
8
|
+
def self.extended(klass)
|
9
|
+
if defined?(::PG::Connection)
|
10
|
+
klass.extend(UpdateValuesAll::Adapters::Postgres)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_values_all(data, **keyword_args)
|
15
|
+
return [] if data.empty?
|
16
|
+
|
17
|
+
keyword_args[:key_to_match] ||= primary_key
|
9
18
|
|
10
|
-
|
11
|
-
|
12
|
-
subclass.extend UpdateValuesAll::Adapters::Postgres
|
13
|
-
end
|
19
|
+
if defined?(::PG::Connection) && connection.raw_connection.is_a?(::PG::Connection)
|
20
|
+
pg_update_values_all(data, **keyword_args)
|
14
21
|
end
|
15
22
|
end
|
16
23
|
|
data/lib/update_values_all.rb
CHANGED
@@ -2,15 +2,3 @@
|
|
2
2
|
|
3
3
|
require_relative 'update_values_all/version'
|
4
4
|
require_relative 'update_values_all/railtie'
|
5
|
-
|
6
|
-
module UpdateValuesAll
|
7
|
-
|
8
|
-
autoload :BatchUpdate, 'update_values_all/batch_update'
|
9
|
-
|
10
|
-
module Adapters
|
11
|
-
|
12
|
-
autoload :Postgres, 'update_values_all/adapters/postgres'
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: update_values_all
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Malykh
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- xronos.i.am@gmail.com
|
30
30
|
executables: []
|
@@ -48,7 +48,6 @@ files:
|
|
48
48
|
- lib/update_values_all/batch_update.rb
|
49
49
|
- lib/update_values_all/railtie.rb
|
50
50
|
- lib/update_values_all/version.rb
|
51
|
-
- update_values_all.gemspec
|
52
51
|
homepage: https://github.com/corp-gp/update_values_all
|
53
52
|
licenses:
|
54
53
|
- MIT
|
@@ -58,7 +57,7 @@ metadata:
|
|
58
57
|
source_code_uri: https://github.com/corp-gp/update_values_all
|
59
58
|
changelog_uri: https://github.com/corp-gp/update_values_all/CHANGELOG.md
|
60
59
|
rubygems_mfa_required: 'true'
|
61
|
-
post_install_message:
|
60
|
+
post_install_message:
|
62
61
|
rdoc_options: []
|
63
62
|
require_paths:
|
64
63
|
- lib
|
@@ -73,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
72
|
- !ruby/object:Gem::Version
|
74
73
|
version: '0'
|
75
74
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
77
|
-
signing_key:
|
75
|
+
rubygems_version: 3.3.17
|
76
|
+
signing_key:
|
78
77
|
specification_version: 4
|
79
78
|
summary: The gem allows to update AR-records in batch
|
80
79
|
test_files: []
|
data/update_values_all.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/update_values_all/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "update_values_all"
|
7
|
-
spec.version = UpdateValuesAll::VERSION
|
8
|
-
spec.authors = ["Sergei Malykh"]
|
9
|
-
spec.email = ["xronos.i.am@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary = "The gem allows to update AR-records in batch"
|
12
|
-
spec.homepage = "https://github.com/corp-gp/update_values_all"
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = ">= 2.7.0"
|
15
|
-
|
16
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
17
|
-
|
18
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata['source_code_uri'] = 'https://github.com/corp-gp/update_values_all'
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/corp-gp/update_values_all/CHANGELOG.md'
|
21
|
-
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files = Dir.chdir(__dir__) do
|
25
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
27
|
-
end
|
28
|
-
end
|
29
|
-
spec.require_paths = ['lib']
|
30
|
-
|
31
|
-
spec.add_dependency 'activerecord', '>= 4.2'
|
32
|
-
|
33
|
-
# For more information and examples about making a new gem, check out our
|
34
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
35
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
36
|
-
end
|