gizzard 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8bb051ec47485a5252ebd7aa6b6d0f00a5fce77ccc985f3dba400ce3b4564b6
4
- data.tar.gz: 319d1ac24f2da5174c7ed75a141d1f34909afac0b0ea5b8d0aafb233315c54a3
3
+ metadata.gz: be6a21f08cb30550bee2e44335abff6799e078ba10d74d501509d4d60fbbd389
4
+ data.tar.gz: b7ce022da62abd511a35474f309c6897d35de8108c301a83f3fbe31c5330ea6c
5
5
  SHA512:
6
- metadata.gz: 6af2539ed91ffc9aa2528d6b1d301ad41972a7fb969d5074b0e7f3368fdd8cd2148b2b25b875768d108eac7151b82c03660eea961bfc8219017e3e690ee7a3d1
7
- data.tar.gz: 69d5665693686af4f7a765f1e90142e4ba49d8bd39391381bfeed8501fa8cf455d3a7e7cfb6378044e48244f0617c65e92674bb725f98400bc8ccbe958c10ee1
6
+ metadata.gz: bef87f613ed1a34be31aac3763c9e77ff092de9a92dea49d9ee699f077b6e1d359b019ada16ad249c4e86fb2c993388843a0e9947084e2dbcd3a18c3c40a647f
7
+ data.tar.gz: 99df58b96433a1a0e1b4f81b612f675bf3818924203b973414267808873b34d1697f91eb140cbb3bbd5413292bafa92a8e70667517cef07f83469acee687c06c
data/README.md CHANGED
@@ -35,11 +35,9 @@ end
35
35
 
36
36
  ## Run Test
37
37
 
38
- ```
39
- $ bundle install
40
- $ docker-compose up -d
41
- $ ./scripts/setup.sh
42
- $ bundle exec rspec
38
+ ```bash
39
+ $ make setup
40
+ $ make ruby/rspec
43
41
  ```
44
42
 
45
43
  ## Development
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 => value) : all
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
@@ -1,3 +1,3 @@
1
1
  module Gizzard
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-01 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -171,30 +171,12 @@ 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/activerecord6.0.gemfile
189
- - gemfiles/activerecord6.1.gemfile
190
- - gemfiles/activerecord7.0.gemfile
191
- - gemfiles/activerecord7.1.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: {}
@@ -213,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
195
  - !ruby/object:Gem::Version
214
196
  version: '0'
215
197
  requirements: []
216
- rubygems_version: 3.3.7
198
+ rubygems_version: 3.4.10
217
199
  signing_key:
218
200
  specification_version: 4
219
201
  summary: Often use snippet for ActiveRecord.
@@ -1,78 +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
- - '3.0'
25
- - '3.1'
26
- activerecord:
27
- - '6.0'
28
- - '6.1'
29
- - '7.0'
30
- - '7.1'
31
- services:
32
- mysql:
33
- image: mysql:8
34
- ports:
35
- - 3306:3306
36
- env:
37
- MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
38
- MYSQL_DATABASE: ${{ env.DB_NAME }}
39
- options: >-
40
- --health-cmd "mysqladmin ping"
41
- --health-interval 10s
42
- --health-timeout 5s
43
- --health-retries 5
44
-
45
- env:
46
- BUNDLE_GEMFILE: gemfiles/activerecord${{ matrix.activerecord }}.gemfile
47
- DB_HOST: 127.0.0.1
48
-
49
- steps:
50
- - uses: actions/checkout@v2
51
-
52
- - name: Set up Ruby
53
- uses: ruby/setup-ruby@v1
54
- with:
55
- ruby-version: ${{ matrix.ruby }}
56
- bundler-cache: true
57
- cache-version: 1
58
-
59
- - name: set MySQL sql_mode
60
- run: |
61
- mysql --ssl-mode=DISABLE --get-server-public-key --protocol=tcp --host 127.0.0.1 --user=root --password=${{ env.DB_PASSWORD }} mysql <<SQL
62
- SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';
63
- SET GLOBAL character_set_server = 'latin1';
64
- SET GLOBAL innodb_file_per_table = ON;
65
- SQL
66
-
67
- - name: set ENV
68
- run: |
69
- echo "DB_PORT=${{ job.services.mysql.ports[3306] }}" >> $GITHUB_ENV
70
-
71
- - name: Setup DB
72
- run: |
73
- ./scripts/setup.sh
74
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
75
-
76
- - name: Run tests
77
- run: bundle exec rspec
78
- 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
@@ -1,16 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- vendor/
14
- Gemfile.lock
15
-
16
- gemfiles/*.gemfile.lock
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.1
data/Appraisals DELETED
@@ -1,21 +0,0 @@
1
- appraise 'activerecord5.2' do
2
- gem 'activerecord', '~> 5.2.0'
3
- end
4
-
5
- appraise 'activerecord6.0' do
6
- gem 'activerecord', '~> 6.0.0'
7
- end
8
-
9
- appraise 'activerecord6.1' do
10
- gem 'activerecord', '~> 6.1.0'
11
- end
12
-
13
- if RUBY_VERSION >= '2.7.0'
14
- appraise 'activerecord7.0' do
15
- gem 'activerecord', '~> 7.0.0'
16
- end
17
-
18
- appraise 'activerecord7.1' do
19
- gem 'activerecord', '~> 7.1.0'
20
- end
21
- end
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in gizzard.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
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:
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_RETRY: "1"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 6.0.0"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 6.1.0"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 7.0.0"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 7.1.0"
6
-
7
- gemspec path: "../"
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", ">= 0.3"
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