arel_extensions 1.3.8 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -1
  3. data/.gitignore +6 -7
  4. data/.rubocop.yml +3 -67
  5. data/.travis/oracle/download.js +152 -0
  6. data/.travis/oracle/download.sh +30 -0
  7. data/.travis/oracle/download_ojdbc.js +116 -0
  8. data/.travis/oracle/install.sh +34 -0
  9. data/.travis/setup_accounts.sh +9 -0
  10. data/.travis/sqlite3/extension-functions.sh +6 -0
  11. data/.travis.yml +223 -0
  12. data/Gemfile +21 -16
  13. data/README.md +90 -282
  14. data/Rakefile +30 -48
  15. data/TODO +1 -0
  16. data/appveyor.yml +22 -60
  17. data/arel_extensions.gemspec +14 -13
  18. data/functions.html +3 -3
  19. data/gemfiles/rails3.gemfile +10 -10
  20. data/gemfiles/rails4.gemfile +29 -0
  21. data/gemfiles/rails5_0.gemfile +29 -0
  22. data/gemfiles/rails5_1_4.gemfile +14 -14
  23. data/gemfiles/rails5_2.gemfile +14 -16
  24. data/init/mssql.sql +4 -4
  25. data/init/mysql.sql +38 -38
  26. data/init/oracle.sql +0 -0
  27. data/init/postgresql.sql +21 -21
  28. data/init/sqlite.sql +0 -0
  29. data/lib/arel_extensions/attributes.rb +3 -4
  30. data/lib/arel_extensions/boolean_functions.rb +14 -53
  31. data/lib/arel_extensions/common_sql_functions.rb +17 -16
  32. data/lib/arel_extensions/comparators.rb +28 -27
  33. data/lib/arel_extensions/date_duration.rb +13 -17
  34. data/lib/arel_extensions/insert_manager.rb +15 -18
  35. data/lib/arel_extensions/math.rb +53 -55
  36. data/lib/arel_extensions/math_functions.rb +39 -46
  37. data/lib/arel_extensions/nodes/abs.rb +1 -0
  38. data/lib/arel_extensions/nodes/blank.rb +2 -1
  39. data/lib/arel_extensions/nodes/case.rb +19 -20
  40. data/lib/arel_extensions/nodes/cast.rb +8 -10
  41. data/lib/arel_extensions/nodes/ceil.rb +1 -1
  42. data/lib/arel_extensions/nodes/coalesce.rb +4 -3
  43. data/lib/arel_extensions/nodes/collate.rb +10 -9
  44. data/lib/arel_extensions/nodes/concat.rb +18 -9
  45. data/lib/arel_extensions/nodes/date_diff.rb +26 -42
  46. data/lib/arel_extensions/nodes/duration.rb +3 -0
  47. data/lib/arel_extensions/nodes/find_in_set.rb +1 -0
  48. data/lib/arel_extensions/nodes/floor.rb +1 -1
  49. data/lib/arel_extensions/nodes/format.rb +8 -35
  50. data/lib/arel_extensions/nodes/formatted_number.rb +23 -22
  51. data/lib/arel_extensions/nodes/function.rb +37 -42
  52. data/lib/arel_extensions/nodes/is_null.rb +0 -0
  53. data/lib/arel_extensions/nodes/json.rb +39 -52
  54. data/lib/arel_extensions/nodes/length.rb +0 -5
  55. data/lib/arel_extensions/nodes/levenshtein_distance.rb +1 -1
  56. data/lib/arel_extensions/nodes/locate.rb +2 -1
  57. data/lib/arel_extensions/nodes/log10.rb +2 -1
  58. data/lib/arel_extensions/nodes/matches.rb +7 -5
  59. data/lib/arel_extensions/nodes/md5.rb +1 -0
  60. data/lib/arel_extensions/nodes/power.rb +5 -5
  61. data/lib/arel_extensions/nodes/rand.rb +1 -0
  62. data/lib/arel_extensions/nodes/repeat.rb +5 -3
  63. data/lib/arel_extensions/nodes/replace.rb +8 -16
  64. data/lib/arel_extensions/nodes/round.rb +6 -5
  65. data/lib/arel_extensions/nodes/soundex.rb +15 -15
  66. data/lib/arel_extensions/nodes/std.rb +21 -18
  67. data/lib/arel_extensions/nodes/substring.rb +16 -8
  68. data/lib/arel_extensions/nodes/then.rb +1 -1
  69. data/lib/arel_extensions/nodes/trim.rb +6 -4
  70. data/lib/arel_extensions/nodes/union.rb +8 -5
  71. data/lib/arel_extensions/nodes/union_all.rb +7 -4
  72. data/lib/arel_extensions/nodes/wday.rb +4 -0
  73. data/lib/arel_extensions/nodes.rb +1 -1
  74. data/lib/arel_extensions/null_functions.rb +5 -19
  75. data/lib/arel_extensions/predications.rb +43 -44
  76. data/lib/arel_extensions/railtie.rb +5 -5
  77. data/lib/arel_extensions/set_functions.rb +7 -5
  78. data/lib/arel_extensions/string_functions.rb +29 -59
  79. data/lib/arel_extensions/tasks.rb +6 -6
  80. data/lib/arel_extensions/version.rb +1 -1
  81. data/lib/arel_extensions/visitors/ibm_db.rb +31 -24
  82. data/lib/arel_extensions/visitors/mssql.rb +180 -375
  83. data/lib/arel_extensions/visitors/mysql.rb +212 -350
  84. data/lib/arel_extensions/visitors/oracle.rb +178 -220
  85. data/lib/arel_extensions/visitors/oracle12.rb +31 -18
  86. data/lib/arel_extensions/visitors/postgresql.rb +173 -256
  87. data/lib/arel_extensions/visitors/sqlite.rb +126 -140
  88. data/lib/arel_extensions/visitors/to_sql.rb +237 -298
  89. data/lib/arel_extensions/visitors.rb +58 -82
  90. data/lib/arel_extensions.rb +31 -182
  91. data/test/database.yml +7 -15
  92. data/test/helper.rb +18 -0
  93. data/test/real_db_test.rb +116 -105
  94. data/test/support/fake_record.rb +3 -3
  95. data/test/test_comparators.rb +17 -14
  96. data/test/visitors/test_bulk_insert_oracle.rb +11 -11
  97. data/test/visitors/test_bulk_insert_sqlite.rb +13 -12
  98. data/test/visitors/test_bulk_insert_to_sql.rb +13 -11
  99. data/test/visitors/test_oracle.rb +55 -55
  100. data/test/visitors/test_to_sql.rb +226 -419
  101. data/test/with_ar/all_agnostic_test.rb +365 -709
  102. data/test/with_ar/insert_agnostic_test.rb +21 -27
  103. data/test/with_ar/test_bulk_sqlite.rb +16 -17
  104. data/test/with_ar/test_math_sqlite.rb +26 -26
  105. data/test/with_ar/test_string_mysql.rb +33 -31
  106. data/test/with_ar/test_string_sqlite.rb +34 -30
  107. metadata +34 -33
  108. data/.github/workflows/ruby.yml +0 -360
  109. data/NEWS.md +0 -32
  110. data/dev/compose.yaml +0 -29
  111. data/gemfiles/rails4_2.gemfile +0 -38
  112. data/gemfiles/rails5.gemfile +0 -29
  113. data/gemfiles/rails6.gemfile +0 -30
  114. data/gemfiles/rails6_1.gemfile +0 -30
  115. data/gemfiles/rails7.gemfile +0 -23
  116. data/gemfiles/rails7_1.gemfile +0 -22
  117. data/gemspecs/arel_extensions-v1.gemspec +0 -27
  118. data/gemspecs/arel_extensions-v2.gemspec +0 -27
  119. data/generate_gems.sh +0 -15
  120. data/lib/arel_extensions/aliases.rb +0 -14
  121. data/lib/arel_extensions/helpers.rb +0 -57
  122. data/lib/arel_extensions/nodes/aggregate_function.rb +0 -13
  123. data/lib/arel_extensions/nodes/formatted_date.rb +0 -42
  124. data/lib/arel_extensions/nodes/rollup.rb +0 -36
  125. data/lib/arel_extensions/nodes/select.rb +0 -10
  126. data/lib/arel_extensions/nodes/sum.rb +0 -7
  127. data/lib/arel_extensions/visitors/convert_format.rb +0 -37
  128. data/test/arelx_test_helper.rb +0 -67
  129. data/version_v1.rb +0 -3
  130. data/version_v2.rb +0 -3
@@ -1,360 +0,0 @@
1
- name: Build and Test
2
-
3
- # Ruby + Rails Compatibility Matrix from here:
4
- # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
5
-
6
- on: [push, pull_request]
7
-
8
- jobs:
9
- job_test_to_sql:
10
- name: test to_sql
11
- runs-on: ubuntu-latest
12
- strategy:
13
- fail-fast: false
14
- matrix:
15
- versions: [
16
- {ruby: '3.2', rails: 7_1, arelx: 2},
17
- {ruby: '3.2', rails: 7, arelx: 2},
18
- {ruby: '3.2', rails: 6_1, arelx: 2},
19
- {ruby: '3.1', rails: 7_1, arelx: 2},
20
- {ruby: '3.1', rails: 7, arelx: 2},
21
- {ruby: '3.1', rails: 6_1, arelx: 2},
22
- {ruby: '3.0', rails: 7_1, arelx: 2},
23
- {ruby: '3.0', rails: 7, arelx: 2},
24
- {ruby: '3.0', rails: 6_1, arelx: 2},
25
- {ruby: '2.7', rails: 7_1, arelx: 2},
26
- {ruby: '2.7', rails: 7, arelx: 2},
27
- {ruby: '2.7', rails: 6_1, arelx: 2},
28
- {ruby: '2.7', rails: 6, arelx: 2},
29
- {ruby: '2.7', rails: 5_2, arelx: 1},
30
- {ruby: '2.7', rails: 4_2, arelx: 1},
31
- {ruby: '2.5', rails: 6_1, arelx: 2},
32
- {ruby: '2.5', rails: 6, arelx: 2},
33
- {ruby: '2.5', rails: 5_2, arelx: 1},
34
- {ruby: '2.5', rails: 4_2, arelx: 1},
35
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
36
- {ruby: jruby-9.2, rails: 6, arelx: 2},
37
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
38
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
39
- {ruby: jruby-9.3, rails: 6, arelx: 2},
40
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
41
- ]
42
- steps:
43
- - uses: actions/checkout@v2
44
- - name: Set up Ruby
45
- uses: ruby/setup-ruby@v1
46
- with:
47
- ruby-version: ${{ matrix.versions.ruby }}
48
- - name: Install FreeTDS
49
- run: |
50
- sudo apt-get update -q
51
- sudo apt-get install -y freetds-dev
52
- - name: Update system-wide gems
53
- if: ${{ !contains(fromJson('["2.5", "jruby-9.2"]'), matrix.versions.ruby) }}
54
- run: gem update --system --no-document
55
- - name: Setup Gemfile for arelx 2.x
56
- if: ${{ matrix.versions.arelx == 2 }}
57
- run: |
58
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
59
- cp ./version_v2.rb lib/arel_extensions/version.rb
60
- cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
61
- - name: bundle install
62
- run: |
63
- bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
64
- bundle install
65
- - name: Run test to_sql
66
- run: bundle exec rake test:to_sql
67
-
68
- job_test_sqlite:
69
- name: test sqlite
70
- runs-on: ubuntu-latest
71
- strategy:
72
- fail-fast: false
73
- matrix:
74
- versions: [
75
- {ruby: '3.2', rails: 7_1, arelx: 2},
76
- {ruby: '3.2', rails: 7, arelx: 2},
77
- {ruby: '3.2', rails: 6_1, arelx: 2},
78
- {ruby: '3.1', rails: 7_1, arelx: 2},
79
- {ruby: '3.1', rails: 7, arelx: 2},
80
- {ruby: '3.1', rails: 6_1, arelx: 2},
81
- {ruby: '3.0', rails: 7_1, arelx: 2},
82
- {ruby: '3.0', rails: 7, arelx: 2},
83
- {ruby: '3.0', rails: 6_1, arelx: 2},
84
- {ruby: '2.7', rails: 7_1, arelx: 2},
85
- {ruby: '2.7', rails: 7, arelx: 2},
86
- {ruby: '2.7', rails: 6_1, arelx: 2},
87
- {ruby: '2.7', rails: 6, arelx: 2},
88
- {ruby: '2.7', rails: 5_2, arelx: 1},
89
- {ruby: '2.7', rails: 4_2, arelx: 1},
90
- {ruby: '2.5', rails: 6_1, arelx: 2},
91
- {ruby: '2.5', rails: 6, arelx: 2},
92
- {ruby: '2.5', rails: 5_2, arelx: 1},
93
- {ruby: '2.5', rails: 4_2, arelx: 1},
94
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
95
- {ruby: jruby-9.2, rails: 6, arelx: 2},
96
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
97
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
98
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
99
- {ruby: jruby-9.3, rails: 6, arelx: 2},
100
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
101
- ]
102
- steps:
103
- - uses: actions/checkout@v2
104
- - name: Set up Ruby
105
- uses: ruby/setup-ruby@v1
106
- with:
107
- ruby-version: ${{ matrix.versions.ruby }}
108
- - name: Install FreeTDS
109
- run: |
110
- sudo apt-get update -q
111
- sudo apt-get install -y freetds-dev
112
- - name: Update system-wide gems
113
- if: ${{ !contains(fromJson('["2.5", "jruby-9.2"]'), matrix.versions.ruby) }}
114
- run: gem update --system --no-document
115
- - name: Setup Gemfile
116
- if: ${{ matrix.versions.arelx == 2 }}
117
- run: |
118
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
119
- cp ./version_v2.rb lib/arel_extensions/version.rb
120
- cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
121
- - name: bundle install
122
- run: |
123
- bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
124
- bundle install
125
- - name: Run test sqlite
126
- run: bundle exec rake test:sqlite
127
-
128
- job_test_postgres:
129
- name: test postgres
130
- runs-on: ubuntu-latest
131
- strategy:
132
- fail-fast: false
133
- matrix:
134
- versions: [
135
- {ruby: '3.2', rails: 7_1, arelx: 2},
136
- {ruby: '3.2', rails: 7, arelx: 2},
137
- {ruby: '3.2', rails: 6_1, arelx: 2},
138
- {ruby: '3.1', rails: 7_1, arelx: 2},
139
- {ruby: '3.1', rails: 7, arelx: 2},
140
- {ruby: '3.1', rails: 6_1, arelx: 2},
141
- {ruby: '3.0', rails: 7_1, arelx: 2},
142
- {ruby: '3.0', rails: 7, arelx: 2},
143
- {ruby: '3.0', rails: 6_1, arelx: 2},
144
- {ruby: '2.7', rails: 7_1, arelx: 2},
145
- {ruby: '2.7', rails: 7, arelx: 2},
146
- {ruby: '2.7', rails: 6_1, arelx: 2},
147
- {ruby: '2.7', rails: 6, arelx: 2},
148
- {ruby: '2.7', rails: 5_2, arelx: 1},
149
- {ruby: '2.7', rails: 4_2, arelx: 1},
150
- {ruby: '2.5', rails: 6_1, arelx: 2},
151
- {ruby: '2.5', rails: 6, arelx: 2},
152
- {ruby: '2.5', rails: 5_2, arelx: 1},
153
- {ruby: '2.5', rails: 4_2, arelx: 1},
154
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
155
- {ruby: jruby-9.2, rails: 6, arelx: 2},
156
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
157
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
158
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
159
- {ruby: jruby-9.3, rails: 6, arelx: 2},
160
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
161
- ]
162
- steps:
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
186
- - name: Set up Ruby
187
- uses: ruby/setup-ruby@v1
188
- with:
189
- ruby-version: ${{ matrix.versions.ruby }}
190
- - name: Install FreeTDS
191
- run: |
192
- sudo apt-get update -q
193
- sudo apt-get install -y freetds-dev
194
- - name: Update system-wide gems
195
- if: ${{ !contains(fromJson('["2.5", "jruby-9.2"]'), matrix.versions.ruby) }}
196
- run: gem update --system --no-document
197
- - name: Setup Gemfile
198
- if: ${{ matrix.versions.arelx == 2 }}
199
- run: |
200
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
201
- cp ./version_v2.rb lib/arel_extensions/version.rb
202
- cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
203
- - name: bundle install
204
- run: |
205
- bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
206
- bundle install
207
- - name: Run test Postgres
208
- env:
209
- PGHOST: localhost
210
- PGUSER: postgres
211
- run: bundle exec rake test:postgresql
212
-
213
- job_test_mysql:
214
- name: test mysql
215
- runs-on: ubuntu-latest
216
- strategy:
217
- fail-fast: false
218
- matrix:
219
- versions: [
220
- {ruby: '3.2', rails: 7_1, arelx: 2},
221
- {ruby: '3.2', rails: 7, arelx: 2},
222
- {ruby: '3.2', rails: 6_1, arelx: 2},
223
- {ruby: '3.1', rails: 7_1, arelx: 2},
224
- {ruby: '3.1', rails: 7, arelx: 2},
225
- {ruby: '3.1', rails: 6_1, arelx: 2},
226
- {ruby: '3.0', rails: 7_1, arelx: 2},
227
- {ruby: '3.0', rails: 7, arelx: 2},
228
- {ruby: '3.0', rails: 6_1, arelx: 2},
229
- {ruby: '2.7', rails: 7_1, arelx: 2},
230
- {ruby: '2.7', rails: 7, arelx: 2},
231
- {ruby: '2.7', rails: 6_1, arelx: 2},
232
- {ruby: '2.7', rails: 6, arelx: 2},
233
- {ruby: '2.7', rails: 5_2, arelx: 1},
234
- {ruby: '2.7', rails: 4_2, arelx: 1},
235
- {ruby: '2.5', rails: 6_1, arelx: 2},
236
- {ruby: '2.5', rails: 6, arelx: 2},
237
- {ruby: '2.5', rails: 5_2, arelx: 1},
238
- {ruby: '2.5', rails: 4_2, arelx: 1},
239
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
240
- {ruby: jruby-9.2, rails: 6, arelx: 2},
241
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
242
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
243
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
244
- {ruby: jruby-9.3, rails: 6, arelx: 2},
245
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
246
- ]
247
- services:
248
- mysql:
249
- image: mysql:5.7
250
- env:
251
- MYSQL_ALLOW_EMPTY_PASSWORD: true
252
- MYSQL_USERNAME: root
253
- MYSQL_DATABASE: arelx_test
254
- ports:
255
- - 3306:3306
256
- options: >-
257
- --health-cmd="mysqladmin ping"
258
- --health-interval=10s
259
- --health-timeout=5s
260
- --health-retries=3
261
- steps:
262
- - uses: actions/checkout@v2
263
- - name: Set up Ruby
264
- uses: ruby/setup-ruby@v1
265
- with:
266
- ruby-version: ${{ matrix.versions.ruby }}
267
- - name: Install FreeTDS
268
- run: |
269
- sudo apt-get update -q
270
- sudo apt-get install -y freetds-dev
271
- - name: Update system-wide gems
272
- if: ${{ !contains(fromJson('["2.5", "jruby-9.2"]'), matrix.versions.ruby) }}
273
- run: gem update --system --no-document
274
- - name: Setup Gemfile
275
- if: ${{ matrix.versions.arelx == 2 }}
276
- run: |
277
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
278
- cp ./version_v2.rb lib/arel_extensions/version.rb
279
- cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
280
- - name: bundle install
281
- run: |
282
- bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
283
- bundle install
284
- - name: Run test MySql
285
- env:
286
- DB_CONNECTION: mysql
287
- DB_HOST: 127.0.0.1
288
- DB_PORT: 3306
289
- DB_DATABASE: arelx_test
290
- DB_USERNAME: root
291
- run: bundle exec rake test:mysql
292
-
293
- job_test_mssql:
294
- name: test mssql on linux
295
- runs-on: ubuntu-latest
296
- strategy:
297
- fail-fast: false
298
- matrix:
299
- versions: [
300
- # {ruby: '3.2', rails: 7, arelx: 2},
301
- {ruby: '3.2', rails: 6_1, arelx: 2},
302
- # {ruby: '3.1', rails: 7, arelx: 2},
303
- {ruby: '3.1', rails: 6_1, arelx: 2},
304
- # {ruby: '3.0', rails: 7, arelx: 2},
305
- {ruby: '3.0', rails: 6_1, arelx: 2},
306
- # {ruby: '2.7', rails: 7, arelx: 2},
307
- {ruby: '2.7', rails: 6_1, arelx: 2},
308
- {ruby: '2.7', rails: 6, arelx: 2},
309
- {ruby: '2.7', rails: 5_2, arelx: 1},
310
- {ruby: '2.7', rails: 4_2, arelx: 1},
311
- {ruby: '2.5', rails: 6_1, arelx: 2},
312
- {ruby: '2.5', rails: 6, arelx: 2},
313
- {ruby: '2.5', rails: 5_2, arelx: 1},
314
- {ruby: '2.5', rails: 4_2, arelx: 1},
315
- # {ruby: jruby-9.2, rails: 6_1, arelx: 2},
316
- # {ruby: jruby-9.2, rails: 6, arelx: 2},
317
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
318
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
319
- # {ruby: jruby-9.3, rails: 6_1, arelx: 2},
320
- # {ruby: jruby-9.3, rails: 6, arelx: 2},
321
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
322
- ]
323
- mssql: [2017, 2019]
324
- steps:
325
- - uses: actions/checkout@v2
326
- - name: Set up Ruby
327
- uses: ruby/setup-ruby@v1
328
- with:
329
- ruby-version: ${{ matrix.versions.ruby }}
330
- - name: Install FreeTDS
331
- run: |
332
- sudo apt-get update -q
333
- sudo apt-get install -y freetds-dev
334
- - name: Install MSSQL ${{ matrix.mssql }}
335
- uses: potatoqualitee/mssqlsuite@v1.5.1
336
- with:
337
- version: ${{ matrix.mssql }}
338
- install: sqlengine, sqlclient, sqlpackage, localdb
339
- sa-password: Password12!
340
- - name: Update system-wide gems
341
- if: ${{ !contains(fromJson('["2.5", "jruby-9.2"]'), matrix.versions.ruby) }}
342
- run: gem update --system --no-document
343
- - name: Setup Gemfile
344
- if: ${{ matrix.versions.arelx == 2 }}
345
- run: |
346
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
347
- cp ./version_v2.rb lib/arel_extensions/version.rb
348
- cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
349
- - name: bundle install
350
- run: |
351
- bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
352
- bundle install
353
- - name: Run test mssql [mri]
354
- if: ${{ !contains(matrix.versions.ruby, 'jruby') }}
355
- run: bundle exec rake test:mssql
356
- - name: Run test mssql [jruby]
357
- if: ${{ contains(matrix.versions.ruby, 'jruby') }}
358
- run: |
359
- curl -LO https://github.com/microsoft/mssql-jdbc/releases/download/v8.4.1/mssql-jdbc-8.4.1.jre11.jar
360
- CLASSPATH=".:mssql-jdbc-8.4.1.jre11.jar" bundle exec rake test:mssql
data/NEWS.md DELETED
@@ -1,32 +0,0 @@
1
- # News
2
-
3
- ## Current Release
4
-
5
- ### New Features
6
-
7
- - `o.format_date` as an alternative to `o.format`
8
- The actual behavior of `format` is inconsistent across DB vendors: in mysql we
9
- can format dates and numbers with it, and in the other ones we only format
10
- dates.
11
-
12
- We're planning on normalizing this behavior. We want `format` to "cleverly"
13
- format dates or numbers, and `format_date` / `format_number` to strictly
14
- format dates / numbers.
15
-
16
- The introduction of `format_date` is the first step in this direction.
17
-
18
- ## Release v2.1.6/v1.3.6
19
-
20
- ### Bug Fixes
21
-
22
- - This used to fail.
23
- ```
24
- Arel.when(a).then(b).format('%Y-%m-%d')
25
- ```
26
-
27
- ### New Features
28
-
29
- - `o.present`, a synonym for `o.not_blank`
30
- - `o.coalesce_blank(a, b, c)`
31
- - `o.if_present`, if the value is `null` or blank, then it returns `null`,
32
- otherwise, it returns the value. Inspired by rails' `presence`.
data/dev/compose.yaml DELETED
@@ -1,29 +0,0 @@
1
- name: arelx-dbs
2
- services:
3
- mariadb:
4
- image: mariadb:11.0
5
- container_name: mariadb
6
- environment:
7
- MARIADB_DATABASE: arelx_test
8
- MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
9
- ports:
10
- - "3306:3306"
11
- healthcheck:
12
- test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
13
- interval: 10s
14
- timeout: 5s
15
- retries: 3
16
- postgres:
17
- image: postgres:15
18
- container_name: postgres
19
- environment:
20
- POSTGRES_USER: postgres
21
- POSTGRES_PASSWORD: secret
22
- POSTGRES_DB: arelx_test
23
- ports:
24
- - "5432:5432"
25
- healthcheck:
26
- test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
27
- interval: 10s
28
- timeout: 5s
29
- retries: 3
@@ -1,38 +0,0 @@
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
@@ -1,29 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'arel', '~> 7.0'
4
-
5
- group :development, :test do
6
- gem 'activesupport', '~> 5.0'
7
- gem 'activemodel', '~> 5.0'
8
- gem 'activerecord', '5.0.6'
9
-
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
-
14
- gem 'tiny_tds', platforms: %i[mri mingw] if RUBY_PLATFORM.match?(/windows/)
15
- # gem "activerecord-sqlserver-adapter", platforms: [:mri, :mingw]
16
-
17
- gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
18
- gem 'activerecord-oracle_enhanced-adapter', '~> 1.7' if ENV.has_key? 'ORACLE_HOME'
19
-
20
- # for JRuby
21
- gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', tag: 'v50.0', platforms: :jruby
22
- gem 'jdbc-sqlite3', platforms: :jruby
23
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
24
- gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
25
- gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
26
- gem 'activerecord-jdbcmssql-adapter', platforms: :jruby
27
- end
28
-
29
- gemspec path: Dir.pwd
@@ -1,30 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 6.0.0'
4
-
5
-
6
- group :development, :test do
7
- gem 'activesupport', '~> 6.0.0'
8
- gem 'activemodel', '~> 6.0.0'
9
- gem 'activerecord', '~> 6.0.0'
10
-
11
- gem 'sqlite3', '~> 1.4', platforms: [:mri]
12
- gem 'mysql2', '0.5.2', platforms: [:mri]
13
- gem 'pg', '< 1.0.0', platforms: [:mri]
14
-
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]
18
-
19
- gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
20
- gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
21
-
22
- # for JRuby
23
- gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', tag: 'v60.4', platforms: :jruby
24
- gem 'jdbc-sqlite3', platforms: :jruby
25
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
26
- gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
27
- gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
28
- end
29
-
30
- gemspec path: Dir.pwd
@@ -1,30 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 6.1.0'
4
-
5
-
6
- group :development, :test do
7
- gem 'activesupport', '~> 6.1.0'
8
- gem 'activemodel', '~> 6.1.0'
9
- gem 'activerecord', '~> 6.1.0'
10
-
11
- gem 'sqlite3', '~> 1.4', platforms: [:mri]
12
- gem 'mysql2', '~>0.5', platforms: [:mri]
13
- gem 'pg', '~> 1.1', platforms: [:mri]
14
-
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]
18
-
19
- gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
20
- gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
21
-
22
- # for JRuby
23
- gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', tag: 'v61.1', platforms: :jruby
24
- gem 'jdbc-sqlite3', platforms: :jruby
25
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
26
- gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
27
- gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
28
- end
29
-
30
- gemspec path: Dir.pwd
@@ -1,23 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 7.0.1'
4
-
5
-
6
- group :development, :test do
7
- gem 'activesupport', '~> 7.0.1'
8
- gem 'activemodel', '~> 7.0.1'
9
- gem 'activerecord', '~> 7.0.1'
10
-
11
- gem 'sqlite3', '~> 1.4', platforms: [:mri]
12
- gem 'mysql2', '~>0.5', platforms: [:mri]
13
- gem 'pg', '~> 1.1', platforms: [:mri]
14
-
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]
18
-
19
- gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
20
- gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
21
- end
22
-
23
- gemspec path: Dir.pwd
@@ -1,22 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 7.1'
4
-
5
- group :development, :test do
6
- gem 'activesupport', '~> 7.1'
7
- gem 'activemodel', '~> 7.1'
8
- gem 'activerecord', '~> 7.1'
9
-
10
- gem 'sqlite3', '~> 1.6', platforms: [:mri]
11
- gem 'mysql2', '~>0.5', platforms: [:mri]
12
- gem 'pg', '~> 1.5', platforms: [:mri]
13
-
14
- gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
15
- gem 'activerecord-sqlserver-adapter', '~> 7.1.0.beta1', platforms: %i[mri mingw x64_mingw mswin]
16
- gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]
17
-
18
- gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
19
- gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' if ENV.has_key? 'ORACLE_HOME'
20
- end
21
-
22
- gemspec path: Dir.pwd
@@ -1,27 +0,0 @@
1
- $:.push File.expand_path('../lib', __FILE__)
2
- require 'arel_extensions/version'
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'arel_extensions'
6
- s.version = ArelExtensions::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ['Yann Azoury', 'Félix Bellanger', 'Julien Delporte']
9
- s.email = ['yann.azoury@faveod.com', 'felix.bellanger@faveod.com', 'julien.delporte@faveod.com']
10
- s.homepage = 'https://github.com/Faveod/arel-extensions'
11
- s.description = 'Adds new features to Arel'
12
- s.summary = 'Extending Arel'
13
- s.license = 'MIT'
14
-
15
- s.rdoc_options = ['--main', 'README.md']
16
- s.extra_rdoc_files = ['MIT-LICENSE.txt', 'README.md', 'functions.html']
17
-
18
- # Manifest
19
- s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
- s.require_paths = ['lib']
22
-
23
- s.add_dependency('arel', '>= 6.0')
24
-
25
- s.add_development_dependency('minitest', '~> 5.9')
26
- s.add_development_dependency('rake', '~> 12.3.3')
27
- end
@@ -1,27 +0,0 @@
1
- $:.push File.expand_path('../lib', __FILE__)
2
- require 'arel_extensions/version'
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'arel_extensions'
6
- s.version = ArelExtensions::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ['Yann Azoury', 'Félix Bellanger', 'Julien Delporte']
9
- s.email = ['yann.azoury@faveod.com', 'felix.bellanger@faveod.com', 'julien.delporte@faveod.com']
10
- s.homepage = 'https://github.com/Faveod/arel-extensions'
11
- s.description = 'Adds new features to Arel'
12
- s.summary = 'Extending Arel'
13
- s.license = 'MIT'
14
-
15
- s.rdoc_options = ['--main', 'README.md']
16
- s.extra_rdoc_files = ['MIT-LICENSE.txt', 'README.md', 'functions.html']
17
-
18
- # Manifest
19
- s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
- s.require_paths = ['lib']
22
-
23
- s.add_dependency('activerecord', '>= 6.0')
24
-
25
- s.add_development_dependency('minitest', '~> 5.9')
26
- s.add_development_dependency('rake', '~> 12.3.3')
27
- end
data/generate_gems.sh DELETED
@@ -1,15 +0,0 @@
1
-
2
- #gem uninstall arel_extensions
3
-
4
- # VERSION ~> 1
5
- cp ./version_v1.rb lib/arel_extensions/version.rb
6
- cp ./gemspecs/arel_extensions-v1.gemspec ./arel_extensions.gemspec
7
- gem build ./arel_extensions.gemspec
8
-
9
- # VERSION ~> 2
10
- cp ./version_v2.rb lib/arel_extensions/version.rb
11
- mv ./arel_extensions.gemspec ./arel_extensions.gemspec.bck
12
- cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
13
- gem build ./arel_extensions.gemspec
14
- cp ./version_v1.rb lib/arel_extensions/version.rb
15
- cp ./gemspecs/arel_extensions-v1.gemspec ./arel_extensions.gemspec