arel_extensions 1.3.4 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +162 -222
  3. data/.gitignore +7 -6
  4. data/.rubocop.yml +37 -0
  5. data/Gemfile +3 -3
  6. data/NEWS.md +15 -0
  7. data/README.md +119 -75
  8. data/appveyor.yml +82 -0
  9. data/arel_extensions.gemspec +0 -1
  10. data/gemfiles/rails3.gemfile +5 -5
  11. data/gemfiles/rails4_2.gemfile +38 -0
  12. data/gemfiles/{rails5_0.gemfile → rails5.gemfile} +6 -6
  13. data/gemfiles/rails5_1_4.gemfile +6 -6
  14. data/gemfiles/rails5_2.gemfile +6 -5
  15. data/gemfiles/rails6.gemfile +5 -4
  16. data/gemfiles/rails6_1.gemfile +5 -4
  17. data/gemfiles/rails7.gemfile +5 -4
  18. data/gemspecs/arel_extensions-v1.gemspec +0 -1
  19. data/gemspecs/arel_extensions-v2.gemspec +0 -1
  20. data/lib/arel_extensions/common_sql_functions.rb +2 -2
  21. data/lib/arel_extensions/helpers.rb +12 -12
  22. data/lib/arel_extensions/math.rb +32 -17
  23. data/lib/arel_extensions/nodes/case.rb +4 -3
  24. data/lib/arel_extensions/nodes/cast.rb +2 -2
  25. data/lib/arel_extensions/nodes/coalesce.rb +1 -1
  26. data/lib/arel_extensions/nodes/collate.rb +1 -1
  27. data/lib/arel_extensions/nodes/date_diff.rb +6 -6
  28. data/lib/arel_extensions/nodes/locate.rb +1 -1
  29. data/lib/arel_extensions/nodes/repeat.rb +2 -2
  30. data/lib/arel_extensions/nodes/rollup.rb +36 -0
  31. data/lib/arel_extensions/nodes/select.rb +10 -0
  32. data/lib/arel_extensions/nodes/substring.rb +1 -1
  33. data/lib/arel_extensions/nodes/then.rb +1 -1
  34. data/lib/arel_extensions/nodes/trim.rb +2 -2
  35. data/lib/arel_extensions/nodes/union.rb +3 -3
  36. data/lib/arel_extensions/nodes/union_all.rb +2 -2
  37. data/lib/arel_extensions/null_functions.rb +16 -0
  38. data/lib/arel_extensions/string_functions.rb +1 -0
  39. data/lib/arel_extensions/version.rb +1 -1
  40. data/lib/arel_extensions/visitors/ibm_db.rb +1 -1
  41. data/lib/arel_extensions/visitors/mssql.rb +123 -17
  42. data/lib/arel_extensions/visitors/mysql.rb +78 -11
  43. data/lib/arel_extensions/visitors/oracle.rb +39 -17
  44. data/lib/arel_extensions/visitors/postgresql.rb +17 -12
  45. data/lib/arel_extensions/visitors/sqlite.rb +4 -4
  46. data/lib/arel_extensions/visitors/to_sql.rb +4 -1
  47. data/lib/arel_extensions/visitors.rb +8 -0
  48. data/lib/arel_extensions.rb +26 -0
  49. data/test/arelx_test_helper.rb +1 -1
  50. data/test/real_db_test.rb +5 -5
  51. data/test/support/fake_record.rb +1 -1
  52. data/test/visitors/test_bulk_insert_oracle.rb +3 -3
  53. data/test/visitors/test_bulk_insert_sqlite.rb +1 -1
  54. data/test/visitors/test_bulk_insert_to_sql.rb +1 -1
  55. data/test/visitors/test_to_sql.rb +6 -6
  56. data/test/with_ar/all_agnostic_test.rb +177 -70
  57. data/test/with_ar/insert_agnostic_test.rb +3 -3
  58. data/test/with_ar/test_bulk_sqlite.rb +1 -1
  59. data/version_v1.rb +1 -1
  60. data/version_v2.rb +1 -1
  61. metadata +8 -18
  62. data/gemfiles/rails4.gemfile +0 -29
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Arel Extensions
2
2
 
3
3
  ![GitHub workflow](https://github.com/Faveod/arel-extensions/actions/workflows/ruby.yml/badge.svg)
4
- [![Security](https://hakiri.io/github/Faveod/arel-extensions/master.svg)](https://hakiri.io/github/Faveod/arel-extensions/master)
4
+ [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/jdelporte/arel-extensions.svg?label=AppVeyor%20build)](https://ci.appveyor.com/project/jdelporte/arel-extensions)
5
5
  ![](http://img.shields.io/badge/license-MIT-brightgreen.svg)
6
6
 
7
7
  Gem: [![Latest Release](https://img.shields.io/gem/v/arel_extensions.svg)](https://rubygems.org/gems/arel_extensions)
8
8
  [![Gem](https://ruby-gem-downloads-badge.herokuapp.com/arel_extensions?type=total)](https://rubygems.org/gems/arel_extensions)
9
9
  [![Gem](https://ruby-gem-downloads-badge.herokuapp.com/arel_extensions?label=downloads-current-version)](https://rubygems.org/gems/arel_extensions)
10
10
 
11
- Arel Extensions adds shortcuts, fixes and new ORM mappings (ruby to SQL) to Arel.
12
- It aims to ensure pure ruby syntax for the biggest number of usual cases.
11
+ Arel Extensions adds shortcuts, fixes and new ORM mappings (Ruby to SQL) to Arel.
12
+ It aims to ensure pure Ruby syntax for most usual cases.
13
13
  It allows to use more advanced SQL functions for any supported RDBMS.
14
14
 
15
15
 
@@ -292,6 +292,15 @@ User.connection.execute(insert_manager.to_sql)
292
292
  <td class="ok">✔</td>
293
293
  <td class="ok">✔</td>
294
294
  </tr>
295
+ <tr>
296
+ <td class="tg-yw4l">POSIX FORMATTING<br>column.format_number("$ %7.2f","en_US")</td>
297
+ <td class="ok">✔</td>
298
+ <td class="ok">✔</td>
299
+ <td class="ok">✔</td>
300
+ <td class="ok">✔</td>
301
+ <td class="ok">✔</td>
302
+ <td class="ko">not implemented</td>
303
+ </tr>
295
304
  <tr>
296
305
  <td class="tg-yw4l">RAND<br>Arel.rand</td>
297
306
  <td class="ok">✔</td>
@@ -320,24 +329,33 @@ User.connection.execute(insert_manager.to_sql)
320
329
  <td class="ok">✔</td>
321
330
  </tr>
322
331
  <tr>
323
- <td class="tg-yw4l">POSIX FORMATTING<br>column.format_number("$ %7.2f","en_US")</td>
324
- <td class="ok">✔</td>
332
+ <th class="tg-ffjm" rowspan="17"><div>String functions</div></th>
333
+ <td class="tg-yw4l">CONCAT<br>column + "string"</td>
325
334
  <td class="ok">✔</td>
326
335
  <td class="ok">✔</td>
336
+ <td class="tg-j6lv"> ||</td>
327
337
  <td class="ok">✔</td>
338
+ <td class="tg-j6lv">+</td>
328
339
  <td class="ok">✔</td>
329
- <td class="ko">not implemented</td>
330
340
  </tr>
331
341
  <tr>
332
- <th class="tg-ffjm" rowspan="17"><div>String functions</div></th>
333
- <td class="tg-yw4l">CONCAT<br>column + "string"</td>
342
+ <td class="tg-yw4l">FIND_IN_SET<br>column &amp; ("l")</td>
334
343
  <td class="ok">✔</td>
335
344
  <td class="ok">✔</td>
336
- <td class="tg-j6lv"> ||</td>
345
+ <td class="tg-orpl">Ruby function</td>
346
+ <td class="ok">✔</td>
337
347
  <td class="ok">✔</td>
338
- <td class="tg-j6lv">+</td>
339
348
  <td class="ok">✔</td>
340
349
  </tr>
350
+ <tr>
351
+ <td class="tg-yw4l">ILIKE (in Arel6)<br/>column.imatches('%pattern')</td>
352
+ <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
353
+ <td class="ok">✔</td>
354
+ <td class="ok">✔</td>
355
+ <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
356
+ <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
357
+ <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
358
+ </tr>
341
359
  <tr>
342
360
  <td class="tg-yw4l">LENGTH<br>column.length</td>
343
361
  <td class="ok">✔</td>
@@ -357,30 +375,57 @@ User.connection.execute(insert_manager.to_sql)
357
375
  <td class="ok">✔</td>
358
376
  </tr>
359
377
  <tr>
360
- <td class="tg-yw4l">SUBSTRING<br/>column[1..2]<br/>column.substring(1)<br/>column.substring(1, 1)</td>
361
- <td class="ok">✔</td>
362
- <td class="tg-j6lv">SUBSTR()</td>
363
- <td class="tg-j6lv">SUBSTR()</td>
364
- <td class="tg-j6lv">SUBSTR()</td>
378
+ <td class="tg-yw4l">Matching Accent/Case Insensitive<br>column.ai_imatches('blah')</td>
365
379
  <td class="ok">✔</td>
380
+ <td class="tg-j6lv">unaccent required</td>
381
+ <td class="tg-j6lv">not supported</td>
366
382
  <td class="ok">✔</td>
383
+ <td class="tg-j6lv">✔</td>
384
+ <td class="tg-j6lv">?</td>
367
385
  </tr>
368
386
  <tr>
369
- <td class="tg-yw4l">FIND_IN_SET<br>column &amp; ("l")</td>
370
- <td class="ok">✔</td>
371
- <td class="ok">✔</td>
372
- <td class="tg-orpl">Ruby function</td>
387
+ <td class="tg-yw4l">Matching Accent Insensitive<br>column.ai_matches('blah')</td>
388
+ <td class="ok">not supported</td>
389
+ <td class="tg-j6lv">not supported</td>
390
+ <td class="tg-j6lv">not supported</td>
391
+ <td class="ok">not supported</td>
392
+ <td class="tg-j6lv">✔</td>
393
+ <td class="tg-j6lv">?</td>
394
+ </tr>
395
+ <tr>
396
+ <td class="tg-yw4l">Matching Case Insensitive<br>column.imatches('blah')</td>
397
+ <td class="ok">not supported</td>
398
+ <td class="tg-j6lv">✔</td>
399
+ <td class="tg-j6lv">✔</td>
373
400
  <td class="ok">✔</td>
401
+ <td class="tg-j6lv">✔</td>
402
+ <td class="tg-j6lv">?</td>
403
+ </tr>
404
+ <tr>
405
+ <td class="tg-yw4l">Matching Accent/Case Sensitive<br>column.smatches('blah')</td>
374
406
  <td class="ok">✔</td>
407
+ <td class="tg-j6lv">✔</td>
408
+ <td class="tg-j6lv">not supported</td>
375
409
  <td class="ok">✔</td>
410
+ <td class="tg-j6lv">✔</td>
411
+ <td class="tg-j6lv">?</td>
376
412
  </tr>
377
413
  <tr>
378
- <td class="tg-yw4l">SOUNDEX<br>column.soundex</td>
414
+ <td class="tg-yw4l">NOT_REGEXP<br>column != "pattern"</td>
379
415
  <td class="ok">✔</td>
380
- <td class="tg-3oug">require fuzzystrmatch</td>
416
+ <td class="ok">✔<br></td>
417
+ <td class="tg-3oug">require pcre.so</td>
418
+ <td class="tg-j6lv">NOT REGEXP_LIKE </td>
419
+ <td class="tg-j6lv">NOT LIKE</td>
381
420
  <td class="ok">✔</td>
421
+ </tr>
422
+ <tr>
423
+ <td class="tg-yw4l">REGEXP<br>column =~ "pattern"<br></td>
382
424
  <td class="ok">✔</td>
383
425
  <td class="ok">✔</td>
426
+ <td class="tg-3oug">require pcre.so</td>
427
+ <td class="tg-j6lv">REGEXP_LIKE</td>
428
+ <td class="tg-j6lv">LIKE</td>
384
429
  <td class="ok">✔</td>
385
430
  </tr>
386
431
  <tr>
@@ -393,31 +438,22 @@ User.connection.execute(insert_manager.to_sql)
393
438
  <td class="ok">✔</td>
394
439
  </tr>
395
440
  <tr>
396
- <td class="tg-yw4l">REGEXP<br>column =~ "pattern"<br></td>
441
+ <td class="tg-yw4l">SOUNDEX<br>column.soundex</td>
397
442
  <td class="ok">✔</td>
443
+ <td class="tg-3oug">require fuzzystrmatch</td>
398
444
  <td class="ok">✔</td>
399
- <td class="tg-3oug">require pcre.so</td>
400
- <td class="tg-j6lv">REGEXP_LIKE</td>
401
- <td class="tg-j6lv">LIKE</td>
402
445
  <td class="ok">✔</td>
403
- </tr>
404
- <tr>
405
- <td class="tg-yw4l">NOT_REGEXP<br>column != "pattern"</td>
406
446
  <td class="ok">✔</td>
407
- <td class="ok">✔<br></td>
408
- <td class="tg-3oug">require pcre.so</td>
409
- <td class="tg-j6lv">NOT REGEXP_LIKE </td>
410
- <td class="tg-j6lv">NOT LIKE</td>
411
447
  <td class="ok">✔</td>
412
448
  </tr>
413
449
  <tr>
414
- <td class="tg-yw4l">ILIKE (in Arel6)<br/>column.imatches('%pattern')</td>
415
- <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
450
+ <td class="tg-yw4l">SUBSTRING<br/>column[1..2]<br/>column.substring(1)<br/>column.substring(1, 1)</td>
451
+ <td class="ok">✔</td>
452
+ <td class="tg-j6lv">SUBSTR()</td>
453
+ <td class="tg-j6lv">SUBSTR()</td>
454
+ <td class="tg-j6lv">SUBSTR()</td>
416
455
  <td class="ok">✔</td>
417
456
  <td class="ok">✔</td>
418
- <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
419
- <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
420
- <td class="tg-j6lv">LOWER() LIKE LOWER()</td>
421
457
  </tr>
422
458
  <tr>
423
459
  <td class="tg-yw4l">TRIM (leading)<br>column.trim("LEADING","M")</td>
@@ -446,43 +482,6 @@ User.connection.execute(insert_manager.to_sql)
446
482
  <td class="tg-j6lv">LTRIM(RTRIM())</td>
447
483
  <td class="tg-j6lv">TRIM()</td>
448
484
  </tr>
449
- <tr>
450
- <td class="tg-yw4l">Matching Accent/Case Insensitive<br>column.ai_imatches('blah')</td>
451
- <td class="ok">✔</td>
452
- <td class="tg-j6lv">unaccent required</td>
453
- <td class="tg-j6lv">not supported</td>
454
- <td class="ok">✔</td>
455
- <td class="tg-j6lv">✔</td>
456
- <td class="tg-j6lv">?</td>
457
- </tr>
458
- <tr>
459
- <td class="tg-yw4l">Matching Accent Insensitive<br>column.ai_matches('blah')</td>
460
- <td class="ok">not supported</td>
461
- <td class="tg-j6lv">not supported</td>
462
- <td class="tg-j6lv">not supported</td>
463
- <td class="ok">not supported</td>
464
- <td class="tg-j6lv">✔</td>
465
- <td class="tg-j6lv">?</td>
466
- </tr>
467
- <tr>
468
- <td class="tg-yw4l">Matching Case Insensitive<br>column.imatches('blah')</td>
469
- <td class="ok">not supported</td>
470
- <td class="tg-j6lv">✔</td>
471
- <td class="tg-j6lv">✔</td>
472
- <td class="ok">✔</td>
473
- <td class="tg-j6lv">✔</td>
474
- <td class="tg-j6lv">?</td>
475
- </tr>
476
- <tr>
477
- <td class="tg-yw4l">Matching Accent/Case Sensitive<br>column.smatches('blah')</td>
478
- <td class="ok">✔</td>
479
- <td class="tg-j6lv">✔</td>
480
- <td class="tg-j6lv">not supported</td>
481
- <td class="ok">✔</td>
482
- <td class="tg-j6lv">✔</td>
483
- <td class="tg-j6lv">?</td>
484
- </tr>
485
-
486
485
  <tr>
487
486
  <th class="tg-4rp9" rowspan="6"><div>Date functions</div></th>
488
487
  <td class="tg-yw4l">DATEADD<br>column + 2.year<br></td>
@@ -539,7 +538,16 @@ User.connection.execute(insert_manager.to_sql)
539
538
  <td class="ok">✔</td>
540
539
  </tr>
541
540
  <tr>
542
- <th class="tg-72dn" rowspan="8"><div>Comparators functions</div></th>
541
+ <th class="tg-72dn" rowspan="13"><div>Comparators functions</div></th>
542
+ <td class="tg-yw4l">BLANK<br>column.blank<br></td>
543
+ <td class="ok">✔</td>
544
+ <td class="ok">✔</td>
545
+ <td class="ok">✔</td>
546
+ <td class="ok">✔</td>
547
+ <td class="ok">✔</td>
548
+ <td class="ok">✔</td>
549
+ </tr>
550
+ <tr>
543
551
  <td class="tg-yw4l">COALESCE<br>column.coalesce(var)</td>
544
552
  <td class="ok">✔</td>
545
553
  <td class="ok">✔</td>
@@ -548,6 +556,24 @@ User.connection.execute(insert_manager.to_sql)
548
556
  <td class="ok">✔</td>
549
557
  <td class="ok">✔</td>
550
558
  </tr>
559
+ <tr>
560
+ <td class="tg-yw4l">COALESCE_BLANK<br>column.coalesce_blank(var)</td>
561
+ <td class="ok">✔</td>
562
+ <td class="ok">✔</td>
563
+ <td class="ok">✔</td>
564
+ <td class="ok">✔</td>
565
+ <td class="ok">✔</td>
566
+ <td class="ok">✔</td>
567
+ </tr>
568
+ <tr>
569
+ <td class="tg-yw4l">IF_PRESENT</td>
570
+ <td class="ok">✔</td>
571
+ <td class="ok">✔</td>
572
+ <td class="ok">✔</td>
573
+ <td class="ok">✔</td>
574
+ <td class="ok">✔</td>
575
+ <td class="ok">✔</td>
576
+ </tr>
551
577
  <tr>
552
578
  <td class="tg-yw4l">ISNULL<br>column.isnull()</td>
553
579
  <td class="tg-j6lv">IFNULL()</td>
@@ -557,6 +583,24 @@ User.connection.execute(insert_manager.to_sql)
557
583
  <td class="ok">✔</td>
558
584
  <td class="ok">✔</td>
559
585
  </tr>
586
+ <tr>
587
+ <td class="tg-yw4l">NOT_BLANK<br>column.not_blank<br></td>
588
+ <td class="ok">✔</td>
589
+ <td class="ok">✔</td>
590
+ <td class="ok">✔</td>
591
+ <td class="ok">✔</td>
592
+ <td class="ok">✔</td>
593
+ <td class="ok">✔</td>
594
+ </tr>
595
+ <tr>
596
+ <td class="tg-yw4l">PRESENT<br>column.present<br>alias to NOT_BLANK<br></td>
597
+ <td class="ok">✔</td>
598
+ <td class="ok">✔</td>
599
+ <td class="ok">✔</td>
600
+ <td class="ok">✔</td>
601
+ <td class="ok">✔</td>
602
+ <td class="ok">✔</td>
603
+ </tr>
560
604
  <tr>
561
605
  <td class="tg-yw4l">==<br>column == integer</td>
562
606
  <td class="ok">✔</td>
data/appveyor.yml ADDED
@@ -0,0 +1,82 @@
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: 4_2
12
+ SQL: MSSQL$SQL2012SP1
13
+ - RUBY_VERSION: 25-x64
14
+ RAILS: 4_2
15
+ SQL: MSSQL$SQL2014
16
+ - RUBY_VERSION: 25-x64
17
+ RAILS: 4_2
18
+ SQL: MSSQL$SQL2016
19
+ - RUBY_VERSION: 25-x64
20
+ RAILS: 5_2
21
+ SQL: MSSQL$SQL2012SP1
22
+ - RUBY_VERSION: 25-x64
23
+ RAILS: 5_2
24
+ SQL: MSSQL$SQL2014
25
+ - RUBY_VERSION: 25-x64
26
+ RAILS: 5_2
27
+ SQL: MSSQL$SQL2016
28
+ - RUBY_VERSION: 25-x64
29
+ RAILS: 6
30
+ SQL: MSSQL$SQL2012SP1
31
+ - RUBY_VERSION: 25-x64
32
+ RAILS: 6
33
+ SQL: MSSQL$SQL2014
34
+ - RUBY_VERSION: 25-x64
35
+ RAILS: 6
36
+ SQL: MSSQL$SQL2016
37
+ - RUBY_VERSION: 25-x64
38
+ RAILS: 6_1
39
+ SQL: MSSQL$SQL2012SP1
40
+ - RUBY_VERSION: 25-x64
41
+ RAILS: 6_1
42
+ SQL: MSSQL$SQL2014
43
+ - RUBY_VERSION: 25-x64
44
+ RAILS: 6_1
45
+ SQL: MSSQL$SQL2016
46
+
47
+ install:
48
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
49
+ - gem update --system
50
+ - gem install rubygems-update && update_rubygems
51
+ - bundle config --local path vendor/bundle
52
+ - cp ./gemfiles/rails%RAILS%.gemfile ./Gemfile
53
+ - bundle config set gemfile ./gemfiles/rails%RAILS%.gemfile
54
+ - bundle install
55
+
56
+ build: off
57
+
58
+ before_test:
59
+ - ruby -v
60
+ - gem -v
61
+ - bundle -v
62
+
63
+ test_script:
64
+ - ps: Get-Service '*SQL*'
65
+ - net start %SQL%
66
+ - bundle exec rake test:mssql
67
+
68
+ for:
69
+ -
70
+ matrix:
71
+ except:
72
+ - RAILS: 5_2
73
+ install:
74
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
75
+ - cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
76
+ - cp ./version_v2.rb lib/arel_extensions/version.rb
77
+ - cp ./gemfiles/rails%RAILS%.gemfile ./Gemfile
78
+ - gem update --system
79
+ - gem install rubygems-update && update_rubygems
80
+ - bundle config --local path vendor/bundle
81
+ - bundle config set gemfile ./gemfiles/rails%RAILS%.gemfile
82
+ - bundle install
@@ -23,6 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency('arel', '>= 6.0')
24
24
 
25
25
  s.add_development_dependency('minitest', '~> 5.9')
26
- s.add_development_dependency('rdoc', '>= 6.3.1')
27
26
  s.add_development_dependency('rake', '~> 12.3.3')
28
27
  end
@@ -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
@@ -0,0 +1,38 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'arel', '~> 6.0'
4
+
5
+ group :development, :test do
6
+ # We need to explicitly include bigdecimal for ruby 2.7 .
7
+ # See https://github.com/ruby/bigdecimal for details.
8
+ rb_version = Gem::Version.new(RUBY_VERSION)
9
+ if Gem::Version.new('2.7') <= rb_version && rb_version < Gem::Version.new('2.8')
10
+ gem 'bigdecimal', '~> 1.3.5', platforms: %i[mri mingw x64_mingw mswin]
11
+ end
12
+
13
+ gem 'activesupport', '~> 4.0'
14
+ gem 'activemodel', '~> 4.0'
15
+ gem 'activerecord', '~> 4.0'
16
+
17
+ gem 'sqlite3', '<= 1.3.13', platforms: %i[mri mswin mingw]
18
+ gem 'mysql2', '0.4.10', platforms: %i[mri mswin mingw]
19
+ gem 'pg', '< 1.0.0', platforms: %i[mri mingw]
20
+
21
+ gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
22
+ gem 'activerecord-sqlserver-adapter', '~> 4.2.0', platforms: %i[mri mingw x64_mingw mswin]
23
+
24
+ gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
25
+ gem 'activerecord-oracle_enhanced-adapter', '~> 1.6.0' if ENV.has_key? 'ORACLE_HOME'
26
+
27
+ # for JRuby
28
+ gem 'activerecord-jdbc-adapter', '~> 1.3', platforms: :jruby
29
+ gem 'jdbc-sqlite3', '~> 3.28', platforms: :jruby
30
+ gem 'jdbc-postgres', '~> 42.2', platforms: :jruby
31
+ gem 'jdbc-mysql', '~> 5.1', platforms: :jruby
32
+ gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
33
+ gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
34
+ gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
35
+ gem 'activerecord-jdbcmssql-adapter', platforms: :jruby
36
+ end
37
+
38
+ 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
@@ -23,6 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency('arel', '>= 6.0')
24
24
 
25
25
  s.add_development_dependency('minitest', '~> 5.9')
26
- s.add_development_dependency('rdoc', '>= 6.3.1')
27
26
  s.add_development_dependency('rake', '~> 12.3.3')
28
27
  end
@@ -23,6 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency('activerecord', '>= 6.0')
24
24
 
25
25
  s.add_development_dependency('minitest', '~> 5.9')
26
- s.add_development_dependency('rdoc', '>= 6.3.1')
27
26
  s.add_development_dependency('rake', '~> 12.3.3')
28
27
  end
@@ -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