arel_extensions 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +41 -89
  3. data/.gitignore +7 -6
  4. data/.rubocop.yml +37 -0
  5. data/Gemfile +3 -3
  6. data/README.md +1 -0
  7. data/appveyor.yml +73 -0
  8. data/gemfiles/rails3.gemfile +5 -5
  9. data/gemfiles/rails4.gemfile +7 -7
  10. data/gemfiles/rails5_0.gemfile +6 -6
  11. data/gemfiles/rails5_1_4.gemfile +6 -6
  12. data/gemfiles/rails5_2.gemfile +6 -5
  13. data/gemfiles/rails6.gemfile +5 -4
  14. data/gemfiles/rails6_1.gemfile +5 -4
  15. data/gemfiles/rails7.gemfile +5 -4
  16. data/lib/arel_extensions/common_sql_functions.rb +2 -2
  17. data/lib/arel_extensions/helpers.rb +12 -12
  18. data/lib/arel_extensions/math.rb +32 -17
  19. data/lib/arel_extensions/nodes/cast.rb +2 -2
  20. data/lib/arel_extensions/nodes/coalesce.rb +1 -1
  21. data/lib/arel_extensions/nodes/collate.rb +1 -1
  22. data/lib/arel_extensions/nodes/date_diff.rb +6 -6
  23. data/lib/arel_extensions/nodes/locate.rb +1 -1
  24. data/lib/arel_extensions/nodes/repeat.rb +2 -2
  25. data/lib/arel_extensions/nodes/substring.rb +1 -1
  26. data/lib/arel_extensions/nodes/then.rb +1 -1
  27. data/lib/arel_extensions/nodes/trim.rb +2 -2
  28. data/lib/arel_extensions/nodes/union.rb +3 -3
  29. data/lib/arel_extensions/nodes/union_all.rb +2 -2
  30. data/lib/arel_extensions/version.rb +1 -1
  31. data/lib/arel_extensions/visitors/ibm_db.rb +1 -1
  32. data/lib/arel_extensions/visitors/mssql.rb +30 -17
  33. data/lib/arel_extensions/visitors/mysql.rb +15 -10
  34. data/lib/arel_extensions/visitors/oracle.rb +22 -17
  35. data/lib/arel_extensions/visitors/postgresql.rb +17 -12
  36. data/lib/arel_extensions/visitors/sqlite.rb +4 -4
  37. data/lib/arel_extensions/visitors/to_sql.rb +4 -1
  38. data/lib/arel_extensions.rb +10 -0
  39. data/test/arelx_test_helper.rb +1 -1
  40. data/test/real_db_test.rb +5 -5
  41. data/test/support/fake_record.rb +1 -1
  42. data/test/visitors/test_bulk_insert_oracle.rb +3 -3
  43. data/test/visitors/test_bulk_insert_sqlite.rb +1 -1
  44. data/test/visitors/test_bulk_insert_to_sql.rb +1 -1
  45. data/test/visitors/test_to_sql.rb +6 -6
  46. data/test/with_ar/all_agnostic_test.rb +67 -60
  47. data/test/with_ar/insert_agnostic_test.rb +3 -3
  48. data/test/with_ar/test_bulk_sqlite.rb +1 -1
  49. data/version_v1.rb +1 -1
  50. data/version_v2.rb +1 -1
  51. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cccb0b1ca82955d6b7505600c43eb2fd64a79a7a002aa5d7c3ae73a20f0c81d
4
- data.tar.gz: 7d43ef3dd1245d583d99873a15245d1e734450612c0bae55f230e48a8a3ad569
3
+ metadata.gz: b815ee8b9bef1d105cdec1169ac05ee9335aef3c46803f7b52c6c8f9b0ff1948
4
+ data.tar.gz: cce0699d96760d791a1030b1f8a142ebeb28f9fa3054906d21e5acd3afb154e1
5
5
  SHA512:
6
- metadata.gz: c48cdf4cdc3ed8b607f0e3d16f577adc3847469509f18a81caa57315bd34afd159b04630ccc2e565452422f581193210cb02131a81d33656b5e1104397e2cc52
7
- data.tar.gz: 7e776e1b749e7fd1756df5f4095e88c6c95fd320a1ad902983452d0146ce38dd0e6b30ec252955db397a3b27e6c745a11af13bba306ad7fe11c507ca24eb2691
6
+ metadata.gz: 11676e5e39e07817c28d30e1a20bde492ddb4fd0816ed713184b962e713380cef5e0e824fa2cd06702d40f94ebd750f9c46571a92ff78287ef06c6545c0cd70b
7
+ data.tar.gz: 3d74efa45263a373a580c3b419dd3304975d3b9897743de14ab7597a6d5b37d47928af1c32bce365d839529e005b9182e19b790b83c34020c45b3a2c665ff9b9
@@ -148,32 +148,41 @@ jobs:
148
148
  matrix:
149
149
  ruby: [3.1, 3.0, 2.7, 2.5, jruby-9.2, jruby-9.3]
150
150
  rails: [7, 6_1, 6, 5_2]
151
- exclude: [
152
- {ruby: 3.1, rails: 6 },
153
- {ruby: 3.1, rails: 5_2},
154
- {ruby: 3.0, rails: 6 },
155
- {ruby: 3.0, rails: 5_2},
156
- {ruby: 2.7, rails: 5_2},
157
- {ruby: 2.5, rails: 7 },
158
- {ruby: jruby-9.2, rails: 7},
159
- {ruby: jruby-9.3, rails: 7},
160
- ]
161
- services:
162
- postgres:
163
- image: postgres:11.6-alpine
164
- env:
165
- POSTGRES_DB: arelx_test
166
- POSTGRES_PASSWORD: secret
167
- ports:
168
- - 5432:5432
169
- # needed because the postgres container does not provide a healthcheck
170
- options: >-
171
- --health-cmd "pg_isready -d arelx_test -U postgres -p 5432"
172
- --health-interval 10s
173
- --health-timeout 5s
174
- --health-retries 5
151
+ exclude:
152
+ [
153
+ { ruby: 3.1, rails: 6 },
154
+ { ruby: 3.1, rails: 5_2 },
155
+ { ruby: 3.0, rails: 6 },
156
+ { ruby: 3.0, rails: 5_2 },
157
+ { ruby: 2.7, rails: 5_2 },
158
+ { ruby: 2.5, rails: 7 },
159
+ { ruby: jruby-9.2, rails: 7 },
160
+ { ruby: jruby-9.3, rails: 7 },
161
+ ]
175
162
  steps:
176
163
  - uses: actions/checkout@v2
164
+ # PostgreSQL requires locales to be installed on the system to be able
165
+ # to do time and currency conversions at runtime.
166
+ #
167
+ # That's why we're not launching it as a service; pre-built images
168
+ # lack loaclization.
169
+ #
170
+ # After we install locales, we'll install PostgreSQL binaries and start
171
+ # the service.
172
+ - name: setup locale
173
+ run: |
174
+ sudo locale-gen fr_FR.utf8
175
+ sudo update-locale
176
+ - name: setup postgres 11
177
+ run: |
178
+ curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
179
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
180
+ sudo apt update
181
+ sudo apt -y install postgresql-11
182
+ sudo systemctl enable postgresql
183
+ sudo systemctl start postgresql
184
+ sudo su -c "psql -c \"alter user postgres with password 'secret'\"" postgres
185
+ sudo su -c "createdb arelx_test" postgres
177
186
  - name: Set up Ruby
178
187
  uses: ruby/setup-ruby@v1
179
188
  with:
@@ -280,18 +289,19 @@ jobs:
280
289
  fail-fast: false
281
290
  matrix:
282
291
  ruby: [3.1, 3.0, 2.7, 2.5, jruby-9.2, jruby-9.3]
283
- rails: [7, 6_1, 6, 5_2]
292
+ rails: [6_1, 6, 5_2]
293
+ version: [2017, 2019]
284
294
  exclude: [
285
295
  {ruby: 3.1, rails: 6 },
286
296
  {ruby: 3.1, rails: 5_2 },
287
297
  {ruby: 3.0, rails: 6 },
288
298
  {ruby: 3.0, rails: 5_2 },
289
299
  {ruby: 2.7, rails: 5_2 },
290
- {ruby: 2.5, rails: 7 },
291
- {ruby: jruby-9.2, rails: 7 },
300
+ # {ruby: 2.5, rails: 7 },
301
+ # {ruby: jruby-9.2, rails: 7 },
292
302
  {ruby: jruby-9.2, rails: 6_1 },
293
303
  {ruby: jruby-9.2, rails: 6 },
294
- {ruby: jruby-9.3, rails: 7 },
304
+ # {ruby: jruby-9.3, rails: 7 },
295
305
  {ruby: jruby-9.3, rails: 6_1 },
296
306
  {ruby: jruby-9.3, rails: 6 },
297
307
  ]
@@ -305,9 +315,10 @@ jobs:
305
315
  run: |
306
316
  sudo apt-get update -q
307
317
  sudo apt-get install -y freetds-dev
308
- - name: Install MSSQL 2019
309
- uses: potatoqualitee/mssqlsuite@v1
318
+ - name: Install MSSQL ${{ matrix.version }}
319
+ uses: potatoqualitee/mssqlsuite@v1.5.1
310
320
  with:
321
+ version: ${{ matrix.version }}
311
322
  install: sqlengine, sqlclient, sqlpackage, localdb
312
323
  sa-password: Password12!
313
324
  - name: Update system-wide gems
@@ -328,62 +339,3 @@ jobs:
328
339
  bundle install
329
340
  - name: Run test mssql
330
341
  run: bundle exec rake test:mssql
331
-
332
- job_test_windows:
333
- name: test mssql on windows
334
- needs: job_build_gem
335
- runs-on: windows-latest
336
- strategy:
337
- fail-fast: false
338
- matrix:
339
- ruby: [3.1, 3.0, 2.7, 2.5]
340
- rails: [7, 6_1, 6, 5_2]
341
- exclude: [
342
- {ruby: 3.1, rails: 6 },
343
- {ruby: 3.1, rails: 5_2 },
344
- {ruby: 3.0, rails: 6 },
345
- {ruby: 3.0, rails: 5_2 },
346
- {ruby: 2.7, rails: 5_2 },
347
- {ruby: 2.5, rails: 7 },
348
- {ruby: jruby-9.2, rails: 7 },
349
- {ruby: jruby-9.2, rails: 6_1 },
350
- {ruby: jruby-9.2, rails: 6 },
351
- {ruby: jruby-9.3, rails: 7 },
352
- {ruby: jruby-9.3, rails: 6_1 },
353
- {ruby: jruby-9.3, rails: 6 },
354
- ]
355
- steps:
356
- - uses: actions/checkout@v2
357
- - name: Install mssql
358
- uses: potatoqualitee/mssqlsuite@v1
359
- with:
360
- install: sqlengine, sqlclient, sqlpackage, localdb
361
- sa-password: Password12!
362
- - name: Set up Ruby
363
- uses: MSP-Greg/ruby-setup-ruby@win-ucrt-1
364
- with:
365
- ruby-version: ${{ matrix.ruby }}
366
- - name: Install required packages on Windows
367
- shell: cmd
368
- run: |
369
- ridk exec sh -c "pacman --sync --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-gcc"
370
- - name: Update system-wide gems
371
- run: gem update --system
372
- - name: Setup Gemfile
373
- if: ${{ matrix.rails != '5_2' }}
374
- run: |
375
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
376
- cp ./version_v2.rb lib/arel_extensions/version.rb
377
- cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
378
- - name: bundle install
379
- run: |
380
- bundle config set gemfile .\gemfiles\rails${{ matrix.rails }}.gemfile
381
- bundle install --verbose
382
- - name: Download gem from build job
383
- uses: actions/download-artifact@v2
384
- with:
385
- name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
386
- - name: Install downloaded gem
387
- run: gem install --local *.gem --verbose
388
- - name: Run test mssql
389
- run: bundle exec rake test:mssql
data/.gitignore CHANGED
@@ -1,9 +1,10 @@
1
- coverage/*
2
- config/database.yml
3
- spec/support/fixtures/*database*
4
1
  *.DS_Store
2
+ *.swp
3
+ .bundle
4
+ Gemfile.lock
5
+ config/database.yml
6
+ coverage/*
5
7
  debug.log
6
8
  pkg
7
- .bundle
8
- *.swp
9
- Gemfile.lock
9
+ spec/support/fixtures/*database*
10
+ vendor/
data/.rubocop.yml CHANGED
@@ -24,6 +24,10 @@ Layout/SpaceAroundEqualsInParameterDefault:
24
24
  Layout/SpaceAroundOperators:
25
25
  Enabled: true
26
26
 
27
+ Layout/SpaceInsideHashLiteralBraces:
28
+ Enabled: true
29
+ EnforcedStyle: no_space
30
+
27
31
  Layout/TrailingEmptyLines:
28
32
  Enabled: true
29
33
 
@@ -51,6 +55,10 @@ Style/EmptyElse:
51
55
  Style/Encoding:
52
56
  Enabled: true
53
57
 
58
+ Style/HashSyntax:
59
+ Enabled: true
60
+ EnforcedStyle: ruby19
61
+
54
62
  Style/MethodCallWithArgsParentheses:
55
63
  Enabled: false
56
64
 
@@ -60,9 +68,32 @@ Style/MethodCallWithoutArgsParentheses:
60
68
  Style/NegatedIf:
61
69
  Enabled: false
62
70
 
71
+ Style/NumericLiterals:
72
+ Enabled: true
73
+
74
+ Style/RedundantParentheses:
75
+ Enabled: true
76
+
77
+ Style/RedundantRegexpCharacterClass:
78
+ Enabled: true
79
+
80
+ Style/RedundantReturn:
81
+ Enabled: true
82
+
83
+ # Even when conservative, this is unsafe.
84
+ #Style/StringConcatenation:
85
+ # Enabled: true
86
+ # Mode: 'conservative'
87
+
63
88
  Style/StringLiterals:
64
89
  Enabled: true
65
90
 
91
+ Style/SymbolArray:
92
+ Enabled: true
93
+
94
+ Style/WordArray:
95
+ Enabled: true
96
+
66
97
  # Performance cops have been transferred to rubocop-performance gem.
67
98
  require: rubocop-performance
68
99
 
@@ -71,3 +102,9 @@ Performance/DoubleStartEndWith:
71
102
 
72
103
  Performance/RedundantMerge:
73
104
  Enabled: true
105
+
106
+ Performance/RegexpMatch:
107
+ Enabled: true
108
+
109
+ Performance/StringReplacement:
110
+ Enabled: true
data/Gemfile CHANGED
@@ -12,10 +12,10 @@ group :development, :test do
12
12
  gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
13
13
  gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
14
14
 
15
- gem 'tiny_tds', '~> 2.1', require: false, platforms: [:mri, :mingw, :x64_mingw, :mswin]
16
- gem 'activerecord-sqlserver-adapter', '~> 6.0', platforms: [:mri, :mingw, :x64_mingw, :mswin]
15
+ gem 'tiny_tds', '~> 2.1', require: false, platforms: %i[mri mingw x64_mingw mswin]
16
+ gem 'activerecord-sqlserver-adapter', '~> 6.0', platforms: %i[mri mingw x64_mingw mswin]
17
17
 
18
- gem 'ruby-oci8', platforms: [:mri, :mswin, :x64_mingw, :mingw]
18
+ gem 'ruby-oci8', platforms: %i[mri mswin x64_mingw mingw]
19
19
  gem 'activerecord-oracle_enhanced-adapter', '~> 1.6.0'
20
20
 
21
21
  gem 'activesupport', '~> 6.0'
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Arel Extensions
2
2
 
3
3
  ![GitHub workflow](https://github.com/Faveod/arel-extensions/actions/workflows/ruby.yml/badge.svg)
4
+ [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/yazfav/arel-extensions.svg?label=AppVeyor%20build)](https://ci.appveyor.com/project/yazfav/arel-extensions)
4
5
  [![Security](https://hakiri.io/github/Faveod/arel-extensions/master.svg)](https://hakiri.io/github/Faveod/arel-extensions/master)
5
6
  ![](http://img.shields.io/badge/license-MIT-brightgreen.svg)
6
7
 
data/appveyor.yml ADDED
@@ -0,0 +1,73 @@
1
+ image: Visual Studio 2015
2
+
3
+ version: "{build}"
4
+
5
+ cache:
6
+ - vendor/bundle
7
+
8
+ environment:
9
+ matrix:
10
+ - RUBY_VERSION: 25-x64
11
+ RAILS: 5_2
12
+ SQL: MSSQL$SQL2012SP1
13
+ - RUBY_VERSION: 25-x64
14
+ RAILS: 5_2
15
+ SQL: MSSQL$SQL2014
16
+ - RUBY_VERSION: 25-x64
17
+ RAILS: 5_2
18
+ SQL: MSSQL$SQL2016
19
+ - RUBY_VERSION: 25-x64
20
+ RAILS: 6
21
+ SQL: MSSQL$SQL2012SP1
22
+ - RUBY_VERSION: 25-x64
23
+ RAILS: 6
24
+ SQL: MSSQL$SQL2014
25
+ - RUBY_VERSION: 25-x64
26
+ RAILS: 6
27
+ SQL: MSSQL$SQL2016
28
+ - RUBY_VERSION: 25-x64
29
+ RAILS: 6_1
30
+ SQL: MSSQL$SQL2012SP1
31
+ - RUBY_VERSION: 25-x64
32
+ RAILS: 6_1
33
+ SQL: MSSQL$SQL2014
34
+ - RUBY_VERSION: 25-x64
35
+ RAILS: 6_1
36
+ SQL: MSSQL$SQL2016
37
+
38
+ install:
39
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
40
+ - gem update --system
41
+ - gem install rubygems-update && update_rubygems
42
+ - bundle config --local path vendor/bundle
43
+ - cp ./gemfiles/rails%RAILS%.gemfile ./Gemfile
44
+ - bundle config set gemfile ./gemfiles/rails%RAILS%.gemfile
45
+ - bundle install
46
+
47
+ build: off
48
+
49
+ before_test:
50
+ - ruby -v
51
+ - gem -v
52
+ - bundle -v
53
+
54
+ test_script:
55
+ - ps: Get-Service '*SQL*'
56
+ - net start %SQL%
57
+ - bundle exec rake test:mssql
58
+
59
+ for:
60
+ -
61
+ matrix:
62
+ except:
63
+ - RAILS: 5_2
64
+ install:
65
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
66
+ - cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
67
+ - cp ./version_v2.rb lib/arel_extensions/version.rb
68
+ - cp ./gemfiles/rails%RAILS%.gemfile ./Gemfile
69
+ - gem update --system
70
+ - gem install rubygems-update && update_rubygems
71
+ - bundle config --local path vendor/bundle
72
+ - bundle config set gemfile ./gemfiles/rails%RAILS%.gemfile
73
+ - bundle install
@@ -3,10 +3,10 @@ source 'https://rubygems.org'
3
3
  gem 'arel', '~> 3.0' # too old...
4
4
 
5
5
  group :development, :test do
6
- gem 'sqlite3', '<= 1.3.13', platform: [:ruby, :mswin, :mingw]
7
- gem 'mysql2', '0.4.10', platform: [:ruby, :mswin, :mingw]
8
- gem 'activerecord-mysql2-adapter', platform: [:ruby, :mswin, :mingw]
9
- gem 'pg', platform: [:ruby, :mswin, :mingw]
6
+ gem 'sqlite3', '<= 1.3.13', platform: %i[ruby mswin mingw]
7
+ gem 'mysql2', '0.4.10', platform: %i[ruby mswin mingw]
8
+ gem 'activerecord-mysql2-adapter', platform: %i[ruby mswin mingw]
9
+ gem 'pg', platform: %i[ruby mswin mingw]
10
10
  # for JRuby
11
11
  gem 'jdbc-sqlite3', platform: :jruby
12
12
  gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
@@ -17,4 +17,4 @@ group :development, :test do
17
17
  gem 'activerecord', '~> 3.2'
18
18
  end
19
19
 
20
- gemspec path: '../'
20
+ gemspec path: Dir.pwd
@@ -7,14 +7,14 @@ group :development, :test do
7
7
  gem 'activemodel', '~> 4.0'
8
8
  gem 'activerecord', '~> 4.0'
9
9
 
10
- gem 'sqlite3', '<= 1.3.13', platforms: [:mri, :mswin, :mingw]
11
- gem 'mysql2', '0.4.10', platforms: [:mri, :mswin, :mingw]
12
- gem 'pg', '< 1.0.0', platforms: [:mri, :mingw]
10
+ gem 'sqlite3', '<= 1.3.13', platforms: %i[mri mswin mingw]
11
+ gem 'mysql2', '0.4.10', platforms: %i[mri mswin mingw]
12
+ gem 'pg', '< 1.0.0', platforms: %i[mri mingw]
13
13
 
14
- gem 'tiny_tds', platforms: [:mri, :mingw, :mswin] if RUBY_PLATFORM =~ /windows/
15
- gem 'activerecord-sqlserver-adapter', '~> 4.2.0', platforms: [:mri, :mingw, :mswin] if RUBY_PLATFORM =~ /windows/
14
+ gem 'tiny_tds', platforms: %i[mri mingw mswin] if RUBY_PLATFORM.match?(/windows/)
15
+ gem 'activerecord-sqlserver-adapter', '~> 4.2.0', platforms: %i[mri mingw mswin] if RUBY_PLATFORM.match?(/windows/)
16
16
 
17
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
17
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
18
18
  gem 'activerecord-oracle_enhanced-adapter', '~> 1.6.0' if ENV.has_key? 'ORACLE_HOME'
19
19
 
20
20
  # for JRuby
@@ -26,4 +26,4 @@ group :development, :test do
26
26
  gem 'activerecord-jdbcmssql-adapter', platforms: :jruby
27
27
  end
28
28
 
29
- gemspec path: '../'
29
+ gemspec path: Dir.pwd
@@ -7,14 +7,14 @@ group :development, :test do
7
7
  gem 'activemodel', '~> 5.0'
8
8
  gem 'activerecord', '5.0.6'
9
9
 
10
- gem 'sqlite3', '<= 1.3.13', platforms: [:mri, :mswin, :mingw]
11
- gem 'mysql2', '0.4.10', platforms: [:mri, :mswin, :mingw]
12
- gem 'pg', '< 1.0.0', platforms: [:mri, :mingw]
10
+ gem 'sqlite3', '<= 1.3.13', platforms: %i[mri mswin mingw]
11
+ gem 'mysql2', '0.4.10', platforms: %i[mri mswin mingw]
12
+ gem 'pg', '< 1.0.0', platforms: %i[mri mingw]
13
13
 
14
- gem 'tiny_tds', platforms: [:mri, :mingw] if RUBY_PLATFORM =~ /windows/
14
+ gem 'tiny_tds', platforms: %i[mri mingw] if RUBY_PLATFORM.match?(/windows/)
15
15
  # gem "activerecord-sqlserver-adapter", platforms: [:mri, :mingw]
16
16
 
17
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
17
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
18
18
  gem 'activerecord-oracle_enhanced-adapter', '~> 1.7' if ENV.has_key? 'ORACLE_HOME'
19
19
 
20
20
  # for JRuby
@@ -26,4 +26,4 @@ group :development, :test do
26
26
  gem 'activerecord-jdbcmssql-adapter', platforms: :jruby
27
27
  end
28
28
 
29
- gemspec path: '../'
29
+ gemspec path: Dir.pwd
@@ -8,14 +8,14 @@ group :development, :test do
8
8
  gem 'activemodel', '5.1.4'
9
9
  gem 'activerecord', '5.1.4'
10
10
 
11
- gem 'sqlite3', '<= 1.3.13', platforms: [:mri, :mswin, :mingw]
12
- gem 'mysql2', '0.4.10', platforms: [:mri, :mswin, :mingw]
13
- gem 'pg', '< 1.0.0', platforms: [:mri, :mingw]
11
+ gem 'sqlite3', '<= 1.3.13', platforms: %i[mri mswin mingw]
12
+ gem 'mysql2', '0.4.10', platforms: %i[mri mswin mingw]
13
+ gem 'pg', '< 1.0.0', platforms: %i[mri mingw]
14
14
 
15
- gem 'tiny_tds', platforms: [:mri, :mingw] if RUBY_PLATFORM =~ /windows/
15
+ gem 'tiny_tds', platforms: %i[mri mingw] if RUBY_PLATFORM.match?(/windows/)
16
16
  # gem "activerecord-sqlserver-adapter", platforms: [:mri, :mingw]
17
17
 
18
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
18
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
19
19
  gem 'activerecord-oracle_enhanced-adapter', '~> 1.8' if ENV.has_key? 'ORACLE_HOME'
20
20
 
21
21
  # for JRuby
@@ -27,4 +27,4 @@ group :development, :test do
27
27
  gem 'activerecord-jdbcmssql-adapter', platforms: :jruby
28
28
  end
29
29
 
30
- gemspec path: '../'
30
+ gemspec path: Dir.pwd
@@ -4,7 +4,7 @@ gem 'rails', '~> 5.2.0'
4
4
  gem 'arel', '~> 9'
5
5
 
6
6
  group :development, :test do
7
- gem 'bigdecimal', '1.3.5', platforms: [:mri, :mingw, :x64_mingw, :mswin]
7
+ gem 'bigdecimal', '1.3.5', platforms: %i[mri mingw x64_mingw mswin]
8
8
  gem 'activesupport', '~> 5.2.0'
9
9
  gem 'activemodel', '~> 5.2.0'
10
10
  gem 'activerecord', '~> 5.2.0'
@@ -13,10 +13,11 @@ group :development, :test do
13
13
  gem 'mysql2', '0.4.10', platforms: [:mri]
14
14
  gem 'pg', '< 1.0.0', platforms: [:mri]
15
15
 
16
- gem 'tiny_tds', platforms: [:mri, :mingw, :x64_mingw, :mswin]
17
- gem 'activerecord-sqlserver-adapter', '~> 5.2', platforms: [:mri, :mingw, :x64_mingw, :mswin]
16
+ gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
17
+ gem 'activerecord-sqlserver-adapter', '~> 5.2', platforms: %i[mri mingw x64_mingw mswin]
18
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]
18
19
 
19
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
20
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
20
21
  gem 'activerecord-oracle_enhanced-adapter', '~> 5.2.0' if ENV.has_key? 'ORACLE_HOME'
21
22
 
22
23
  # for JRuby
@@ -28,4 +29,4 @@ group :development, :test do
28
29
  gem 'activerecord-jdbcsqlserver-adapter', '~> 52.0', platforms: :jruby
29
30
  end
30
31
 
31
- gemspec path: '../'
32
+ gemspec path: Dir.pwd
@@ -12,10 +12,11 @@ group :development, :test do
12
12
  gem 'mysql2', '0.5.2', platforms: [:mri]
13
13
  gem 'pg', '< 1.0.0', platforms: [:mri]
14
14
 
15
- gem 'tiny_tds', platforms: [:mri, :mingw, :x64_mingw, :mswin]
16
- gem 'activerecord-sqlserver-adapter', '~> 6.0', platforms: [:mri, :mingw, :x64_mingw, :mswin]
15
+ gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
16
+ gem 'activerecord-sqlserver-adapter', '~> 6.0', platforms: %i[mri mingw x64_mingw mswin]
17
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]
17
18
 
18
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
19
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
19
20
  gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
20
21
 
21
22
  # for JRuby
@@ -26,4 +27,4 @@ group :development, :test do
26
27
  gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
27
28
  end
28
29
 
29
- gemspec path: '../'
30
+ gemspec path: Dir.pwd
@@ -12,10 +12,11 @@ group :development, :test do
12
12
  gem 'mysql2', '0.5.2', platforms: [:mri]
13
13
  gem 'pg', '~> 1.1', platforms: [:mri]
14
14
 
15
- gem 'tiny_tds', platforms: [:mri, :mingw, :x64_mingw, :mswin]
16
- gem 'activerecord-sqlserver-adapter', '~> 6.1.0', platforms: [:mri, :mingw, :x64_mingw, :mswin]
15
+ gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
16
+ gem 'activerecord-sqlserver-adapter', '~> 6.1.0', platforms: %i[mri mingw x64_mingw mswin]
17
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]
17
18
 
18
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
19
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
19
20
  gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
20
21
 
21
22
  # for JRuby
@@ -26,4 +27,4 @@ group :development, :test do
26
27
  gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
27
28
  end
28
29
 
29
- gemspec path: '../'
30
+ gemspec path: Dir.pwd
@@ -12,11 +12,12 @@ group :development, :test do
12
12
  gem 'mysql2', '0.5.2', platforms: [:mri]
13
13
  gem 'pg', '~> 1.1', platforms: [:mri]
14
14
 
15
- gem 'tiny_tds', platforms: [:mri, :mingw, :x64_mingw, :mswin]
16
- gem 'activerecord-sqlserver-adapter', '~> 7.0.0.0', platforms: [:mri, :mingw, :x64_mingw, :mswin]
15
+ gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
16
+ gem 'activerecord-sqlserver-adapter', '~> 7.0.0.0', platforms: %i[mri mingw x64_mingw mswin]
17
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]
17
18
 
18
- gem 'ruby-oci8', platforms: [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
19
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
19
20
  gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
20
21
  end
21
22
 
22
- gemspec path: '../'
23
+ gemspec path: Dir.pwd
@@ -38,8 +38,8 @@ module ArelExtensions
38
38
 
39
39
  def add_sql_functions(env_db = nil)
40
40
  env_db ||= @cnx.adapter_name
41
- env_db = 'mysql' if env_db =~ /mysql/i
42
- if env_db =~ /sqlite/i
41
+ env_db = 'mysql' if /mysql/i.match?(env_db)
42
+ if /sqlite/i.match?(env_db)
43
43
  begin
44
44
  add_sqlite_functions
45
45
  rescue => e
@@ -17,11 +17,11 @@ module ArelExtensions
17
17
 
18
18
  def self.column_of_via_arel_table(table_name, column_name)
19
19
  Arel::Table.engine.connection.schema_cache.columns_hash(table_name)[column_name]
20
- rescue NoMethodError
21
- nil
22
- rescue => e
23
- warn("Warning: Unexpected exception caught while fetching column name for #{table_name}.#{column_name} in `column_of_via_arel_table`\n#{e.class}: #{e}")
24
- nil
20
+ rescue NoMethodError
21
+ nil
22
+ rescue => e
23
+ warn("Warning: Unexpected exception caught while fetching column name for #{table_name}.#{column_name} in `column_of_via_arel_table`\n#{e.class}: #{e}")
24
+ nil
25
25
  end
26
26
 
27
27
  def self.column_of(table_name, column_name)
@@ -40,12 +40,12 @@ module ArelExtensions
40
40
  column_of_via_arel_table(table_name, column_name)
41
41
  end
42
42
  end
43
- rescue ActiveRecord::ConnectionNotEstablished
44
- column_of_via_arel_table(table_name, column_name)
45
- rescue ActiveRecord::StatementInvalid
46
- nil
47
- rescue => e
48
- warn("Warning: Unexpected exception caught while fetching column name for #{table_name}.#{column_name} in `column_of`\n#{e.class}: #{e}")
49
- nil
43
+ rescue ActiveRecord::ConnectionNotEstablished
44
+ column_of_via_arel_table(table_name, column_name)
45
+ rescue ActiveRecord::StatementInvalid
46
+ nil
47
+ rescue => e
48
+ warn("Warning: Unexpected exception caught while fetching column name for #{table_name}.#{column_name} in `column_of`\n#{e.class}: #{e}")
49
+ nil
50
50
  end
51
51
  end