Skip to content

Commit 47be629

Browse files
committed
Initial commit
0 parents  commit 47be629

18 files changed

+809
-0
lines changed

.byebug_history

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
continue
2+
columns
3+
entries.first.changed
4+
continue
5+
entries
6+
continue
7+
entries.first.changes
8+
entries.each { _1.updated_at = Time.current }
9+
continue
10+
self.has_attribute?('updated_at')
11+
continue
12+
c.attributes
13+
c.bitcoin_address = 'abcdefghijkl'
14+
c.attributes
15+
c.encrypt
16+
c.attributes
17+
c.read_attribute(:bitcoin_address)
18+
c.bitcoin_address_after_type_cast
19+
c.bitcoin_address_before_type_cast
20+
c.bitcoin_address_before_typecast
21+
c.bitcoin_address = 'abc'
22+
c = Cat.first
23+
Cat.first
24+
Cat.firsst
25+
Cat.encrypted_attributes
26+
Cat
27+
entries
28+
continue
29+
entries.first.changed?
30+
entries
31+
continue
32+
cat2.changed?
33+
cat1.changed?
34+
continue
35+
cat1.changes
36+
cat2.changed?
37+
cat1.changed?
38+
continue
39+
expected
40+
@actual
41+
continue
42+
puts sql_queries
43+
sql_queries
44+
continue
45+
Cat.columns_hash['name']
46+
Cat.columns_hash
47+
continue

.github/workflows/tests.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1.196.0
18+
with:
19+
ruby-version: 3.3.4
20+
21+
- name: Install dependencies
22+
run: bundle install
23+
24+
- name: Run tests
25+
run: bin/rspec
26+
27+
- name: Run linters
28+
run: pre-commit run --all-files

.pre-commit-config.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: fix-byte-order-marker
6+
- id: check-merge-conflict
7+
- id: trailing-whitespace
8+
- repo: https://github.com/tdeo/pre-commit-hooks
9+
rev: v4.0.1
10+
hooks:
11+
- id: end-of-file-fixer
12+
- repo: local
13+
hooks:
14+
- id: rubocop
15+
name: Rubocop
16+
language: system
17+
entry: bin/rubocop
18+
require_serial: true # for proper cache behavior
19+
files: (?x)(
20+
\.rb|
21+
\.rake|
22+
\.gemspec|
23+
Gemfile|
24+
Rakefile)$
25+
args:
26+
- --autocorrect
27+
- --server
28+
- --fail-level=convention

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--order rand
2+
--require spec_helper

.rubocop.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
3+
AllCops:
4+
NewCops: enable
5+
6+
Style/Documentation:
7+
Enabled: false
8+
9+
Metrics/AbcSize:
10+
Enabled: false
11+
12+
Metrics/CyclomaticComplexity:
13+
Enabled: false
14+
15+
Metrics/MethodLength:
16+
Enabled: false
17+
18+
Metrics/PerceivedComplexity:
19+
Enabled: false
20+
21+
Metrics/BlockLength:
22+
Enabled: false
23+
24+
Layout/LineLength:
25+
Enabled: false

.tool-versions

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 3.3.4

Gemfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
gemspec
5+
6+
gem 'byebug'
7+
gem 'rake-release'
8+
gem 'rspec'
9+
gem 'rubocop'
10+
gem 'sqlite3'

Gemfile.lock

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
PATH
2+
remote: .
3+
specs:
4+
batch_update (0.0.1)
5+
activerecord (~> 7.0)
6+
activesupport (~> 7.0)
7+
8+
GEM
9+
remote: https://rubygems.org/
10+
specs:
11+
activemodel (7.1.3.4)
12+
activesupport (= 7.1.3.4)
13+
activerecord (7.1.3.4)
14+
activemodel (= 7.1.3.4)
15+
activesupport (= 7.1.3.4)
16+
timeout (>= 0.4.0)
17+
activesupport (7.1.3.4)
18+
base64
19+
bigdecimal
20+
concurrent-ruby (~> 1.0, >= 1.0.2)
21+
connection_pool (>= 2.2.5)
22+
drb
23+
i18n (>= 1.6, < 2)
24+
minitest (>= 5.1)
25+
mutex_m
26+
tzinfo (~> 2.0)
27+
ast (2.4.2)
28+
base64 (0.2.0)
29+
bigdecimal (3.1.8)
30+
byebug (11.1.3)
31+
concurrent-ruby (1.3.3)
32+
connection_pool (2.4.1)
33+
diff-lcs (1.5.1)
34+
drb (2.2.1)
35+
i18n (1.14.5)
36+
concurrent-ruby (~> 1.0)
37+
json (2.7.2)
38+
language_server-protocol (3.17.0.3)
39+
mini_portile2 (2.8.7)
40+
minitest (5.24.1)
41+
mutex_m (0.2.0)
42+
parallel (1.26.3)
43+
parser (3.3.5.0)
44+
ast (~> 2.4.1)
45+
racc
46+
racc (1.8.1)
47+
rainbow (3.1.1)
48+
rake-release (1.3.0)
49+
bundler (>= 1.11, < 3)
50+
regexp_parser (2.9.2)
51+
rspec (3.13.0)
52+
rspec-core (~> 3.13.0)
53+
rspec-expectations (~> 3.13.0)
54+
rspec-mocks (~> 3.13.0)
55+
rspec-core (3.13.0)
56+
rspec-support (~> 3.13.0)
57+
rspec-expectations (3.13.1)
58+
diff-lcs (>= 1.2.0, < 2.0)
59+
rspec-support (~> 3.13.0)
60+
rspec-mocks (3.13.1)
61+
diff-lcs (>= 1.2.0, < 2.0)
62+
rspec-support (~> 3.13.0)
63+
rspec-support (3.13.1)
64+
rubocop (1.67.0)
65+
json (~> 2.3)
66+
language_server-protocol (>= 3.17.0)
67+
parallel (~> 1.10)
68+
parser (>= 3.3.0.2)
69+
rainbow (>= 2.2.2, < 4.0)
70+
regexp_parser (>= 2.4, < 3.0)
71+
rubocop-ast (>= 1.32.2, < 2.0)
72+
ruby-progressbar (~> 1.7)
73+
unicode-display_width (>= 2.4.0, < 3.0)
74+
rubocop-ast (1.32.3)
75+
parser (>= 3.3.1.0)
76+
ruby-progressbar (1.13.0)
77+
sqlite3 (2.1.0)
78+
mini_portile2 (~> 2.8.0)
79+
sqlite3 (2.1.0-arm64-darwin)
80+
timeout (0.4.1)
81+
tzinfo (2.0.6)
82+
concurrent-ruby (~> 1.0)
83+
unicode-display_width (2.6.0)
84+
85+
PLATFORMS
86+
arm64-darwin-23
87+
ruby
88+
89+
DEPENDENCIES
90+
batch_update!
91+
byebug
92+
rake-release
93+
rspec
94+
rubocop
95+
sqlite3
96+
97+
BUNDLED WITH
98+
2.5.11

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Pennylane
4+
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:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
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 THE
21+
SOFTWARE.

batch_update.gemspec

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# frozen_string_literal: true
2+
3+
Gem::Specification.new do |s|
4+
s.name = 'batch_update'
5+
s.version = '0.0.1'
6+
s.summary = 'Update multiple records with different values in a small number of queries'
7+
s.description = 'A simple hello world gem'
8+
s.authors = ['Quentin de Metz']
9+
s.email = 'quentin@pennylane.com'
10+
s.files = Dir['{lib}/**/*.rb']
11+
s.homepage =
12+
'https://rubygems.org/gems/batch_update'
13+
s.license = 'MIT'
14+
15+
s.required_ruby_version = '>= 3.3.4'
16+
17+
s.add_dependency 'activerecord', '~> 7.0'
18+
s.add_dependency 'activesupport', '~> 7.0'
19+
20+
s.metadata['rubygems_mfa_required'] = 'true'
21+
end

bin/rspec

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rspec' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
bundle_binstub = File.expand_path("bundle", __dir__)
14+
15+
if File.file?(bundle_binstub)
16+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17+
load(bundle_binstub)
18+
else
19+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21+
end
22+
end
23+
24+
require "rubygems"
25+
require "bundler/setup"
26+
27+
load Gem.bin_path("rspec-core", "rspec")

bin/rubocop

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rubocop' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
bundle_binstub = File.expand_path("bundle", __dir__)
14+
15+
if File.file?(bundle_binstub)
16+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17+
load(bundle_binstub)
18+
else
19+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21+
end
22+
end
23+
24+
require "rubygems"
25+
require "bundler/setup"
26+
27+
load Gem.bin_path("rubocop", "rubocop")

0 commit comments

Comments
 (0)