gizzard 0.7.1 → 0.9.0
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/README.md +3 -5
- data/lib/gizzard/base.rb +3 -0
- data/lib/gizzard/mysql.rb +3 -3
- data/lib/gizzard/version.rb +1 -1
- metadata +8 -26
- data/.github/workflows/main.yml +0 -87
- data/.github/workflows/release.yml +0 -33
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.travis.yml +0 -7
- data/Appraisals +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/docker-compose.yml +0 -25
- data/gemfiles/.bundle/config +0 -2
- data/gemfiles/activerecord5.2.gemfile +0 -7
- data/gemfiles/activerecord6.0.gemfile +0 -7
- data/gemfiles/activerecord6.1.gemfile +0 -7
- data/gemfiles/activerecord7.0.gemfile +0 -7
- data/gizzard.gemspec +0 -37
- data/scripts/setup.sh +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be6a21f08cb30550bee2e44335abff6799e078ba10d74d501509d4d60fbbd389
|
4
|
+
data.tar.gz: b7ce022da62abd511a35474f309c6897d35de8108c301a83f3fbe31c5330ea6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bef87f613ed1a34be31aac3763c9e77ff092de9a92dea49d9ee699f077b6e1d359b019ada16ad249c4e86fb2c993388843a0e9947084e2dbcd3a18c3c40a647f
|
7
|
+
data.tar.gz: 99df58b96433a1a0e1b4f81b612f675bf3818924203b973414267808873b34d1697f91eb140cbb3bbd5413292bafa92a8e70667517cef07f83469acee687c06c
|
data/README.md
CHANGED
data/lib/gizzard/base.rb
CHANGED
@@ -4,6 +4,9 @@ module Gizzard
|
|
4
4
|
|
5
5
|
class_methods do
|
6
6
|
def preload_associations(records:, associations:, scope: nil)
|
7
|
+
records = Array(records)
|
8
|
+
return if records.empty?
|
9
|
+
|
7
10
|
if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new(7)
|
8
11
|
ActiveRecord::Associations::Preloader.new(records: records, associations: associations, scope: scope).call
|
9
12
|
else
|
data/lib/gizzard/mysql.rb
CHANGED
@@ -7,7 +7,7 @@ module Gizzard
|
|
7
7
|
|
8
8
|
scope :filtered_by, -> (column, value) do
|
9
9
|
v = value.respond_to?(:strip) ? value.strip : value
|
10
|
-
v.present? ? where(column =>
|
10
|
+
v.present? ? where(column => v) : all
|
11
11
|
end
|
12
12
|
|
13
13
|
scope :forward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "#{sanitize_sql_like(value)}%") }
|
@@ -64,7 +64,7 @@ module Gizzard
|
|
64
64
|
when :left_outer_join
|
65
65
|
'LEFT OUTER JOIN'
|
66
66
|
else
|
67
|
-
raise
|
67
|
+
raise "Invalid join_type = #{join_type}"
|
68
68
|
end
|
69
69
|
|
70
70
|
index_hint = case hint
|
@@ -73,7 +73,7 @@ module Gizzard
|
|
73
73
|
when :force
|
74
74
|
'FORCE INDEX'
|
75
75
|
else
|
76
|
-
raise
|
76
|
+
raise "Invalid hint = #{hint}"
|
77
77
|
end
|
78
78
|
|
79
79
|
c = connection
|
data/lib/gizzard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gizzard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '0.3'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '0.3'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: appraisal
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,34 +171,16 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
-
- ".github/workflows/main.yml"
|
175
|
-
- ".github/workflows/release.yml"
|
176
|
-
- ".gitignore"
|
177
|
-
- ".rspec"
|
178
|
-
- ".travis.yml"
|
179
|
-
- Appraisals
|
180
|
-
- Gemfile
|
181
174
|
- LICENSE
|
182
175
|
- README.md
|
183
|
-
- Rakefile
|
184
|
-
- bin/console
|
185
|
-
- bin/setup
|
186
|
-
- docker-compose.yml
|
187
|
-
- gemfiles/.bundle/config
|
188
|
-
- gemfiles/activerecord5.2.gemfile
|
189
|
-
- gemfiles/activerecord6.0.gemfile
|
190
|
-
- gemfiles/activerecord6.1.gemfile
|
191
|
-
- gemfiles/activerecord7.0.gemfile
|
192
|
-
- gizzard.gemspec
|
193
176
|
- lib/gizzard.rb
|
194
177
|
- lib/gizzard/base.rb
|
195
178
|
- lib/gizzard/mysql.rb
|
196
179
|
- lib/gizzard/version.rb
|
197
|
-
- scripts/setup.sh
|
198
180
|
homepage: https://github.com/taka0125/gizzard
|
199
181
|
licenses: []
|
200
182
|
metadata: {}
|
201
|
-
post_install_message:
|
183
|
+
post_install_message:
|
202
184
|
rdoc_options: []
|
203
185
|
require_paths:
|
204
186
|
- lib
|
@@ -213,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
195
|
- !ruby/object:Gem::Version
|
214
196
|
version: '0'
|
215
197
|
requirements: []
|
216
|
-
rubygems_version: 3.
|
217
|
-
signing_key:
|
198
|
+
rubygems_version: 3.4.10
|
199
|
+
signing_key:
|
218
200
|
specification_version: 4
|
219
201
|
summary: Often use snippet for ActiveRecord.
|
220
202
|
test_files: []
|
data/.github/workflows/main.yml
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
|
8
|
-
pull_request:
|
9
|
-
branches:
|
10
|
-
- main
|
11
|
-
|
12
|
-
env:
|
13
|
-
RAILS_ENV: test
|
14
|
-
DB_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
strategy:
|
20
|
-
fail-fast: false
|
21
|
-
|
22
|
-
matrix:
|
23
|
-
ruby:
|
24
|
-
- '2.6'
|
25
|
-
- '2.7'
|
26
|
-
- '3.0'
|
27
|
-
- '3.1'
|
28
|
-
activerecord:
|
29
|
-
- '5.2'
|
30
|
-
- '6.0'
|
31
|
-
- '6.1'
|
32
|
-
- '7.0'
|
33
|
-
exclude: # https://github.com/sue445/activerecord-compatible_legacy_migration/blob/master/.github/workflows/test.yml
|
34
|
-
- ruby: '2.6'
|
35
|
-
activerecord: '7.0'
|
36
|
-
- ruby: '3.0'
|
37
|
-
activerecord: '5.2'
|
38
|
-
- ruby: '3.1'
|
39
|
-
activerecord: '5.2'
|
40
|
-
services:
|
41
|
-
mysql:
|
42
|
-
image: mysql:5.7
|
43
|
-
ports:
|
44
|
-
- 3306:3306
|
45
|
-
env:
|
46
|
-
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
|
47
|
-
MYSQL_DATABASE: ${{ env.DB_NAME }}
|
48
|
-
options: >-
|
49
|
-
--health-cmd "mysqladmin ping"
|
50
|
-
--health-interval 10s
|
51
|
-
--health-timeout 5s
|
52
|
-
--health-retries 5
|
53
|
-
|
54
|
-
env:
|
55
|
-
BUNDLE_GEMFILE: gemfiles/activerecord${{ matrix.activerecord }}.gemfile
|
56
|
-
DB_HOST: 127.0.0.1
|
57
|
-
|
58
|
-
steps:
|
59
|
-
- uses: actions/checkout@v2
|
60
|
-
|
61
|
-
- name: Set up Ruby
|
62
|
-
uses: ruby/setup-ruby@v1
|
63
|
-
with:
|
64
|
-
ruby-version: ${{ matrix.ruby }}
|
65
|
-
bundler-cache: true
|
66
|
-
|
67
|
-
- name: set MySQL sql_mode
|
68
|
-
run: |
|
69
|
-
mysql --ssl-mode=DISABLE --protocol=tcp --host 127.0.0.1 --user=root --password=${{ env.DB_PASSWORD }} mysql <<SQL
|
70
|
-
SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';
|
71
|
-
SET GLOBAL character_set_server = 'utf8mb4';
|
72
|
-
SET GLOBAL innodb_file_per_table = 1;
|
73
|
-
SET GLOBAL innodb_large_prefix = ON;
|
74
|
-
SQL
|
75
|
-
|
76
|
-
- name: set ENV
|
77
|
-
run: |
|
78
|
-
echo "DB_PORT=${{ job.services.mysql.ports[3306] }}" >> $GITHUB_ENV
|
79
|
-
|
80
|
-
- name: Setup DB
|
81
|
-
run: |
|
82
|
-
./scripts/setup.sh
|
83
|
-
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
84
|
-
|
85
|
-
- name: Run tests
|
86
|
-
run: bundle exec rspec
|
87
|
-
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
name: Release gem
|
2
|
-
|
3
|
-
on:
|
4
|
-
workflow_dispatch:
|
5
|
-
inputs:
|
6
|
-
rubygems-otp-code:
|
7
|
-
description: RubyGems OTP code
|
8
|
-
required: true
|
9
|
-
|
10
|
-
permissions:
|
11
|
-
contents: write
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
release-gem:
|
15
|
-
runs-on: ubuntu-latest
|
16
|
-
env:
|
17
|
-
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
18
|
-
GEM_HOST_OTP_CODE: ${{ github.event.inputs.rubygems-otp-code }}
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@v2
|
21
|
-
with:
|
22
|
-
fetch-depth: 0 # bundle exec rake release で git tag を見るため、tagをfetchするようにしている
|
23
|
-
- uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: 3.1.1
|
26
|
-
- name: Bundle install
|
27
|
-
run: bundle install
|
28
|
-
- name: Setup git config # bundle exec rake release でgit tagが打たれていない場合、タグを打ってpushしてくれるため用意している
|
29
|
-
run: |
|
30
|
-
git config --global user.email "taka0125@gmail.com"
|
31
|
-
git config --global user.name "Takahiro Ooishi"
|
32
|
-
- name: Release gem
|
33
|
-
run: bundle exec rake release
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Appraisals
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
appraise 'activerecord5.2' do
|
2
|
-
gem 'activerecord', '~> 5.2'
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise 'activerecord6.0' do
|
6
|
-
gem 'activerecord', '~> 6.0'
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise 'activerecord6.1' do
|
10
|
-
gem 'activerecord', '~> 6.1'
|
11
|
-
end
|
12
|
-
|
13
|
-
if RUBY_VERSION >= '2.7.0'
|
14
|
-
appraise 'activerecord7.0' do
|
15
|
-
gem 'activerecord', '~> 7.0'
|
16
|
-
end
|
17
|
-
end
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "gizzard"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/docker-compose.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
version: '3.9'
|
2
|
-
|
3
|
-
x-mysql: &mysql
|
4
|
-
image: mysql:5.7
|
5
|
-
container_name: gizzard_mysql57
|
6
|
-
environment:
|
7
|
-
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-5y8m2jzTamDS6M85ateGrA6pihhyCm}
|
8
|
-
platform: linux/x86_64
|
9
|
-
ports:
|
10
|
-
- 127.0.0.1:${DB_PORT:-33306}:3306
|
11
|
-
volumes:
|
12
|
-
- mysql:/var/lib/mysql
|
13
|
-
command: >
|
14
|
-
mysqld
|
15
|
-
--sql-mode=NO_ENGINE_SUBSTITUTION
|
16
|
-
--character-set-server=utf8mb4
|
17
|
-
--innodb-file-per-table=1
|
18
|
-
--innodb-large-prefix
|
19
|
-
|
20
|
-
services:
|
21
|
-
mysql:
|
22
|
-
<<: *mysql
|
23
|
-
|
24
|
-
volumes:
|
25
|
-
mysql:
|
data/gemfiles/.bundle/config
DELETED
data/gizzard.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "gizzard/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "gizzard"
|
8
|
-
spec.version = Gizzard::VERSION
|
9
|
-
spec.authors = ["Takahiro Ooishi"]
|
10
|
-
spec.email = ["taka0125@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Often use snippet for ActiveRecord.}
|
13
|
-
spec.description = %q{Often use snippet for ActiveRecord.}
|
14
|
-
spec.homepage = "https://github.com/taka0125/gizzard"
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
spec.bindir = "exe"
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = ["lib"]
|
24
|
-
|
25
|
-
spec.add_dependency "activerecord", ">= 5.2"
|
26
|
-
spec.add_dependency "activesupport", ">= 5.2"
|
27
|
-
|
28
|
-
spec.add_development_dependency "ridgepole"
|
29
|
-
spec.add_development_dependency "database_cleaner-active_record"
|
30
|
-
spec.add_development_dependency "mysql2"
|
31
|
-
spec.add_development_dependency "psych", "~> 3.1"
|
32
|
-
spec.add_development_dependency "standalone_activerecord_boot_loader"
|
33
|
-
spec.add_development_dependency "appraisal"
|
34
|
-
spec.add_development_dependency "bundler"
|
35
|
-
spec.add_development_dependency "rake", ">= 12.3.3"
|
36
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
-
end
|
data/scripts/setup.sh
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
set -ex
|
3
|
-
|
4
|
-
CURRENT=$(cd $(dirname $0);pwd)
|
5
|
-
DOCKER_MYSQL_PORT=$(docker port gizzard_mysql57 3306 2>/dev/null | cut -f 2 -d ':')
|
6
|
-
DOCKER_MYSQL_PORT=${DOCKER_MYSQL_PORT:-3306}
|
7
|
-
|
8
|
-
export DB_HOST=${DB_HOST:-127.0.0.1}
|
9
|
-
export DB_PORT=${DB_PORT:-${DOCKER_MYSQL_PORT}}
|
10
|
-
export DB_NAME=${DB_NAME:-gizzard_test}
|
11
|
-
export DB_USER=${DB_USER:-root}
|
12
|
-
export DB_PASSWORD=${DB_PASSWORD:-5y8m2jzTamDS6M85ateGrA6pihhyCm}
|
13
|
-
|
14
|
-
mysql \
|
15
|
-
-u ${DB_USER} \
|
16
|
-
-h ${DB_HOST} \
|
17
|
-
-p${DB_PASSWORD} \
|
18
|
-
--port ${DB_PORT} \
|
19
|
-
-e "CREATE DATABASE IF NOT EXISTS ${DB_NAME}"
|
20
|
-
|
21
|
-
bundle exec ridgepole \
|
22
|
-
-c ${CURRENT}/../spec/dummy/config/database.yml \
|
23
|
-
--apply \
|
24
|
-
-f ${CURRENT}/../spec/dummy/db/Schemafile \
|
25
|
-
-E test
|