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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +162 -222
- data/.gitignore +7 -6
- data/.rubocop.yml +37 -0
- data/Gemfile +3 -3
- data/NEWS.md +15 -0
- data/README.md +119 -75
- data/appveyor.yml +82 -0
- data/arel_extensions.gemspec +0 -1
- data/gemfiles/rails3.gemfile +5 -5
- data/gemfiles/rails4_2.gemfile +38 -0
- data/gemfiles/{rails5_0.gemfile → rails5.gemfile} +6 -6
- data/gemfiles/rails5_1_4.gemfile +6 -6
- data/gemfiles/rails5_2.gemfile +6 -5
- data/gemfiles/rails6.gemfile +5 -4
- data/gemfiles/rails6_1.gemfile +5 -4
- data/gemfiles/rails7.gemfile +5 -4
- data/gemspecs/arel_extensions-v1.gemspec +0 -1
- data/gemspecs/arel_extensions-v2.gemspec +0 -1
- data/lib/arel_extensions/common_sql_functions.rb +2 -2
- data/lib/arel_extensions/helpers.rb +12 -12
- data/lib/arel_extensions/math.rb +32 -17
- data/lib/arel_extensions/nodes/case.rb +4 -3
- data/lib/arel_extensions/nodes/cast.rb +2 -2
- data/lib/arel_extensions/nodes/coalesce.rb +1 -1
- data/lib/arel_extensions/nodes/collate.rb +1 -1
- data/lib/arel_extensions/nodes/date_diff.rb +6 -6
- data/lib/arel_extensions/nodes/locate.rb +1 -1
- data/lib/arel_extensions/nodes/repeat.rb +2 -2
- data/lib/arel_extensions/nodes/rollup.rb +36 -0
- data/lib/arel_extensions/nodes/select.rb +10 -0
- data/lib/arel_extensions/nodes/substring.rb +1 -1
- data/lib/arel_extensions/nodes/then.rb +1 -1
- data/lib/arel_extensions/nodes/trim.rb +2 -2
- data/lib/arel_extensions/nodes/union.rb +3 -3
- data/lib/arel_extensions/nodes/union_all.rb +2 -2
- data/lib/arel_extensions/null_functions.rb +16 -0
- data/lib/arel_extensions/string_functions.rb +1 -0
- data/lib/arel_extensions/version.rb +1 -1
- data/lib/arel_extensions/visitors/ibm_db.rb +1 -1
- data/lib/arel_extensions/visitors/mssql.rb +123 -17
- data/lib/arel_extensions/visitors/mysql.rb +78 -11
- data/lib/arel_extensions/visitors/oracle.rb +39 -17
- data/lib/arel_extensions/visitors/postgresql.rb +17 -12
- data/lib/arel_extensions/visitors/sqlite.rb +4 -4
- data/lib/arel_extensions/visitors/to_sql.rb +4 -1
- data/lib/arel_extensions/visitors.rb +8 -0
- data/lib/arel_extensions.rb +26 -0
- data/test/arelx_test_helper.rb +1 -1
- data/test/real_db_test.rb +5 -5
- data/test/support/fake_record.rb +1 -1
- data/test/visitors/test_bulk_insert_oracle.rb +3 -3
- data/test/visitors/test_bulk_insert_sqlite.rb +1 -1
- data/test/visitors/test_bulk_insert_to_sql.rb +1 -1
- data/test/visitors/test_to_sql.rb +6 -6
- data/test/with_ar/all_agnostic_test.rb +177 -70
- data/test/with_ar/insert_agnostic_test.rb +3 -3
- data/test/with_ar/test_bulk_sqlite.rb +1 -1
- data/version_v1.rb +1 -1
- data/version_v2.rb +1 -1
- metadata +8 -18
- data/gemfiles/rails4.gemfile +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0076504922a3f08d3770d9bedca4b24f0b2d19b080abcfd925f3ab928a1d7802'
|
4
|
+
data.tar.gz: '080a98b49a9a43f1ad319933c77befd0a8947b0d3f3fc503058cfc81b863d815'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d658b44c16c1af76c9c6e55c084186a663683269c974757e70333755b8986b2226e7561261776ce0fb41acf063469628f215627ea80991e977968d47851af831
|
7
|
+
data.tar.gz: c9f0b4f123fac561f1aedcf93bc162d8bfa0f31740b539efe599f7f12725b995279b541dd7d501d3d8bdec636880ceade3eb1346f6c5fed90d67ea7124d6e9fd
|
data/.github/workflows/ruby.yml
CHANGED
@@ -6,197 +6,182 @@ name: Build and Test
|
|
6
6
|
on: [push, pull_request]
|
7
7
|
|
8
8
|
jobs:
|
9
|
-
job_build_gem:
|
10
|
-
name: build
|
11
|
-
runs-on: ubuntu-latest
|
12
|
-
strategy:
|
13
|
-
matrix:
|
14
|
-
ruby: [3.1, 3.0, 2.7, 2.5, jruby-9.2, jruby-9.3]
|
15
|
-
rails: [7, 6_1, 6, 5_2]
|
16
|
-
exclude: [
|
17
|
-
{ruby: 3.1, rails: 6 },
|
18
|
-
{ruby: 3.1, rails: 5_2},
|
19
|
-
{ruby: 3.0, rails: 6 },
|
20
|
-
{ruby: 3.0, rails: 5_2},
|
21
|
-
{ruby: 2.7, rails: 5_2},
|
22
|
-
{ruby: 2.5, rails: 7 },
|
23
|
-
{ruby: jruby-9.2, rails: 7 },
|
24
|
-
{ruby: jruby-9.3, rails: 7 },
|
25
|
-
]
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@v2
|
28
|
-
- name: Set up Ruby
|
29
|
-
uses: ruby/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
- name: Setup gemspec
|
33
|
-
if: ${{ matrix.rails != '5_2' }}
|
34
|
-
run: |
|
35
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
36
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
37
|
-
cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
|
38
|
-
- name: Build source gem
|
39
|
-
run: gem build arel_extensions.gemspec
|
40
|
-
- name: Upload source gem
|
41
|
-
uses: actions/upload-artifact@v2
|
42
|
-
with:
|
43
|
-
name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
|
44
|
-
path: "*.gem"
|
45
|
-
|
46
9
|
job_test_to_sql:
|
47
10
|
name: test to_sql
|
48
|
-
needs: job_build_gem
|
49
11
|
runs-on: ubuntu-latest
|
50
12
|
strategy:
|
51
13
|
fail-fast: false
|
52
14
|
matrix:
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
{ruby: 3.
|
57
|
-
{ruby: 3.
|
58
|
-
{ruby:
|
59
|
-
{ruby:
|
60
|
-
{ruby: 2.7, rails:
|
61
|
-
{ruby: 2.
|
62
|
-
{ruby:
|
63
|
-
{ruby:
|
15
|
+
versions: [
|
16
|
+
{ruby: 3.1, rails: 7, arelx: 2},
|
17
|
+
{ruby: 3.1, rails: 6_1, arelx: 2},
|
18
|
+
{ruby: 3.0, rails: 7, arelx: 2},
|
19
|
+
{ruby: 3.0, rails: 6_1, arelx: 2},
|
20
|
+
{ruby: 2.7, rails: 7, arelx: 2},
|
21
|
+
{ruby: 2.7, rails: 6_1, arelx: 2},
|
22
|
+
{ruby: 2.7, rails: 6, arelx: 2},
|
23
|
+
{ruby: 2.7, rails: 5_2, arelx: 1},
|
24
|
+
{ruby: 2.7, rails: 4_2, arelx: 1},
|
25
|
+
{ruby: 2.5, rails: 6_1, arelx: 2},
|
26
|
+
{ruby: 2.5, rails: 6, arelx: 2},
|
27
|
+
{ruby: 2.5, rails: 5_2, arelx: 1},
|
28
|
+
{ruby: 2.5, rails: 4_2, arelx: 1},
|
29
|
+
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
30
|
+
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
31
|
+
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
32
|
+
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
33
|
+
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
34
|
+
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
64
35
|
]
|
65
36
|
steps:
|
66
37
|
- uses: actions/checkout@v2
|
67
38
|
- name: Set up Ruby
|
68
39
|
uses: ruby/setup-ruby@v1
|
69
40
|
with:
|
70
|
-
ruby-version: ${{ matrix.ruby }}
|
41
|
+
ruby-version: ${{ matrix.versions.ruby }}
|
71
42
|
- name: Install FreeTDS
|
72
43
|
run: |
|
73
44
|
sudo apt-get update -q
|
74
45
|
sudo apt-get install -y freetds-dev
|
75
46
|
- name: Update system-wide gems
|
76
|
-
run: gem update --system
|
77
|
-
- name:
|
78
|
-
|
79
|
-
with:
|
80
|
-
name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
|
81
|
-
- name: Setup Gemfile
|
82
|
-
if: ${{ matrix.rails != '5_2' }}
|
47
|
+
run: gem update --system --no-document
|
48
|
+
- name: Setup Gemfile for arelx 2.x
|
49
|
+
if: ${{ matrix.versions.arelx == 2 }}
|
83
50
|
run: |
|
84
51
|
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
85
52
|
cp ./version_v2.rb lib/arel_extensions/version.rb
|
86
|
-
cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
|
53
|
+
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
87
54
|
- name: bundle install
|
88
55
|
run: |
|
89
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.rails }}.gemfile
|
56
|
+
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
90
57
|
bundle install
|
91
58
|
- name: Run test to_sql
|
92
59
|
run: bundle exec rake test:to_sql
|
93
60
|
|
94
61
|
job_test_sqlite:
|
95
62
|
name: test sqlite
|
96
|
-
needs: job_build_gem
|
97
63
|
runs-on: ubuntu-latest
|
98
64
|
strategy:
|
99
65
|
fail-fast: false
|
100
66
|
matrix:
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
{ruby: 3.
|
105
|
-
{ruby: 3.
|
106
|
-
{ruby:
|
107
|
-
{ruby:
|
108
|
-
{ruby: 2.7, rails:
|
109
|
-
{ruby: 2.
|
110
|
-
{ruby:
|
111
|
-
{ruby:
|
67
|
+
versions: [
|
68
|
+
{ruby: 3.1, rails: 7, arelx: 2},
|
69
|
+
{ruby: 3.1, rails: 6_1, arelx: 2},
|
70
|
+
{ruby: 3.0, rails: 7, arelx: 2},
|
71
|
+
{ruby: 3.0, rails: 6_1, arelx: 2},
|
72
|
+
{ruby: 2.7, rails: 7, arelx: 2},
|
73
|
+
{ruby: 2.7, rails: 6_1, arelx: 2},
|
74
|
+
{ruby: 2.7, rails: 6, arelx: 2},
|
75
|
+
{ruby: 2.7, rails: 5_2, arelx: 1},
|
76
|
+
{ruby: 2.7, rails: 4_2, arelx: 1},
|
77
|
+
{ruby: 2.5, rails: 6_1, arelx: 2},
|
78
|
+
{ruby: 2.5, rails: 6, arelx: 2},
|
79
|
+
{ruby: 2.5, rails: 5_2, arelx: 1},
|
80
|
+
{ruby: 2.5, rails: 4_2, arelx: 1},
|
81
|
+
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
82
|
+
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
83
|
+
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
84
|
+
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
85
|
+
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
86
|
+
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
87
|
+
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
112
88
|
]
|
113
89
|
steps:
|
114
90
|
- uses: actions/checkout@v2
|
115
91
|
- name: Set up Ruby
|
116
92
|
uses: ruby/setup-ruby@v1
|
117
93
|
with:
|
118
|
-
ruby-version: ${{ matrix.ruby }}
|
94
|
+
ruby-version: ${{ matrix.versions.ruby }}
|
119
95
|
- name: Install FreeTDS
|
120
96
|
run: |
|
121
97
|
sudo apt-get update -q
|
122
98
|
sudo apt-get install -y freetds-dev
|
123
99
|
- name: Update system-wide gems
|
124
|
-
run: gem update --system
|
125
|
-
- name: Download gem from build job
|
126
|
-
uses: actions/download-artifact@v2
|
127
|
-
with:
|
128
|
-
name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
|
100
|
+
run: gem update --system --no-document
|
129
101
|
- name: Setup Gemfile
|
130
|
-
if: ${{ matrix.
|
102
|
+
if: ${{ matrix.versions.arelx == 2 }}
|
131
103
|
run: |
|
132
104
|
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
133
105
|
cp ./version_v2.rb lib/arel_extensions/version.rb
|
134
|
-
cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
|
106
|
+
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
135
107
|
- name: bundle install
|
136
108
|
run: |
|
137
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.rails }}.gemfile
|
109
|
+
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
138
110
|
bundle install
|
139
111
|
- name: Run test sqlite
|
140
112
|
run: bundle exec rake test:sqlite
|
141
113
|
|
142
114
|
job_test_postgres:
|
143
115
|
name: test postgres
|
144
|
-
needs: job_build_gem
|
145
116
|
runs-on: ubuntu-latest
|
146
117
|
strategy:
|
147
118
|
fail-fast: false
|
148
119
|
matrix:
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
{ruby: 3.
|
153
|
-
{ruby: 3.
|
154
|
-
{ruby:
|
155
|
-
{ruby:
|
156
|
-
{ruby: 2.7, rails:
|
157
|
-
{ruby: 2.
|
158
|
-
{ruby:
|
159
|
-
{ruby:
|
120
|
+
versions: [
|
121
|
+
{ruby: 3.1, rails: 7, arelx: 2},
|
122
|
+
{ruby: 3.1, rails: 6_1, arelx: 2},
|
123
|
+
{ruby: 3.0, rails: 7, arelx: 2},
|
124
|
+
{ruby: 3.0, rails: 6_1, arelx: 2},
|
125
|
+
{ruby: 2.7, rails: 7, arelx: 2},
|
126
|
+
{ruby: 2.7, rails: 6_1, arelx: 2},
|
127
|
+
{ruby: 2.7, rails: 6, arelx: 2},
|
128
|
+
{ruby: 2.7, rails: 5_2, arelx: 1},
|
129
|
+
{ruby: 2.7, rails: 4_2, arelx: 1},
|
130
|
+
{ruby: 2.5, rails: 6_1, arelx: 2},
|
131
|
+
{ruby: 2.5, rails: 6, arelx: 2},
|
132
|
+
{ruby: 2.5, rails: 5_2, arelx: 1},
|
133
|
+
{ruby: 2.5, rails: 4_2, arelx: 1},
|
134
|
+
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
135
|
+
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
136
|
+
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
137
|
+
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
138
|
+
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
139
|
+
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
140
|
+
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
160
141
|
]
|
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
|
175
142
|
steps:
|
176
143
|
- uses: actions/checkout@v2
|
144
|
+
# PostgreSQL requires locales to be installed on the system to be able
|
145
|
+
# to do time and currency conversions at runtime.
|
146
|
+
#
|
147
|
+
# That's why we're not launching it as a service; pre-built images
|
148
|
+
# lack loaclization.
|
149
|
+
#
|
150
|
+
# After we install locales, we'll install PostgreSQL binaries and start
|
151
|
+
# the service.
|
152
|
+
- name: setup locale
|
153
|
+
run: |
|
154
|
+
sudo locale-gen fr_FR.utf8
|
155
|
+
sudo update-locale
|
156
|
+
- name: setup postgres 11
|
157
|
+
run: |
|
158
|
+
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
159
|
+
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
160
|
+
sudo apt update
|
161
|
+
sudo apt -y install postgresql-11
|
162
|
+
sudo systemctl enable postgresql
|
163
|
+
sudo systemctl start postgresql
|
164
|
+
sudo su -c "psql -c \"alter user postgres with password 'secret'\"" postgres
|
165
|
+
sudo su -c "createdb arelx_test" postgres
|
177
166
|
- name: Set up Ruby
|
178
167
|
uses: ruby/setup-ruby@v1
|
179
168
|
with:
|
180
|
-
ruby-version: ${{ matrix.ruby }}
|
169
|
+
ruby-version: ${{ matrix.versions.ruby }}
|
181
170
|
- name: Install FreeTDS
|
182
171
|
run: |
|
183
172
|
sudo apt-get update -q
|
184
173
|
sudo apt-get install -y freetds-dev
|
185
174
|
- name: Update system-wide gems
|
186
|
-
run: gem update --system
|
187
|
-
- name: Download gem from build job
|
188
|
-
uses: actions/download-artifact@v2
|
189
|
-
with:
|
190
|
-
name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
|
175
|
+
run: gem update --system --no-document
|
191
176
|
- name: Setup Gemfile
|
192
|
-
if: ${{ matrix.
|
177
|
+
if: ${{ matrix.versions.arelx == 2 }}
|
193
178
|
run: |
|
194
179
|
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
195
180
|
cp ./version_v2.rb lib/arel_extensions/version.rb
|
196
|
-
cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
|
181
|
+
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
197
182
|
- name: bundle install
|
198
183
|
run: |
|
199
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.rails }}.gemfile
|
184
|
+
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
200
185
|
bundle install
|
201
186
|
- name: Run test Postgres
|
202
187
|
env:
|
@@ -206,22 +191,31 @@ jobs:
|
|
206
191
|
|
207
192
|
job_test_mysql:
|
208
193
|
name: test mysql
|
209
|
-
needs: job_build_gem
|
210
194
|
runs-on: ubuntu-latest
|
211
195
|
strategy:
|
212
196
|
fail-fast: false
|
213
197
|
matrix:
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
{ruby: 3.
|
218
|
-
{ruby: 3.
|
219
|
-
{ruby:
|
220
|
-
{ruby:
|
221
|
-
{ruby: 2.7, rails:
|
222
|
-
{ruby: 2.
|
223
|
-
{ruby:
|
224
|
-
{ruby:
|
198
|
+
versions: [
|
199
|
+
{ruby: 3.1, rails: 7, arelx: 2},
|
200
|
+
{ruby: 3.1, rails: 6_1, arelx: 2},
|
201
|
+
{ruby: 3.0, rails: 7, arelx: 2},
|
202
|
+
{ruby: 3.0, rails: 6_1, arelx: 2},
|
203
|
+
{ruby: 2.7, rails: 7, arelx: 2},
|
204
|
+
{ruby: 2.7, rails: 6_1, arelx: 2},
|
205
|
+
{ruby: 2.7, rails: 6, arelx: 2},
|
206
|
+
{ruby: 2.7, rails: 5_2, arelx: 1},
|
207
|
+
{ruby: 2.7, rails: 4_2, arelx: 1},
|
208
|
+
{ruby: 2.5, rails: 6_1, arelx: 2},
|
209
|
+
{ruby: 2.5, rails: 6, arelx: 2},
|
210
|
+
{ruby: 2.5, rails: 5_2, arelx: 1},
|
211
|
+
{ruby: 2.5, rails: 4_2, arelx: 1},
|
212
|
+
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
213
|
+
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
214
|
+
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
215
|
+
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
216
|
+
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
217
|
+
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
218
|
+
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
225
219
|
]
|
226
220
|
services:
|
227
221
|
mysql:
|
@@ -242,26 +236,22 @@ jobs:
|
|
242
236
|
- name: Set up Ruby
|
243
237
|
uses: ruby/setup-ruby@v1
|
244
238
|
with:
|
245
|
-
ruby-version: ${{ matrix.ruby }}
|
239
|
+
ruby-version: ${{ matrix.versions.ruby }}
|
246
240
|
- name: Install FreeTDS
|
247
241
|
run: |
|
248
242
|
sudo apt-get update -q
|
249
243
|
sudo apt-get install -y freetds-dev
|
250
244
|
- name: Update system-wide gems
|
251
|
-
run: gem update --system
|
252
|
-
- name: Download gem from build job
|
253
|
-
uses: actions/download-artifact@v2
|
254
|
-
with:
|
255
|
-
name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
|
245
|
+
run: gem update --system --no-document
|
256
246
|
- name: Setup Gemfile
|
257
|
-
if: ${{ matrix.
|
247
|
+
if: ${{ matrix.versions.arelx == 2 }}
|
258
248
|
run: |
|
259
249
|
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
260
250
|
cp ./version_v2.rb lib/arel_extensions/version.rb
|
261
|
-
cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
|
251
|
+
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
262
252
|
- name: bundle install
|
263
253
|
run: |
|
264
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.rails }}.gemfile
|
254
|
+
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
265
255
|
bundle install
|
266
256
|
- name: Run test MySql
|
267
257
|
env:
|
@@ -274,116 +264,66 @@ jobs:
|
|
274
264
|
|
275
265
|
job_test_mssql:
|
276
266
|
name: test mssql on linux
|
277
|
-
needs: job_build_gem
|
278
267
|
runs-on: ubuntu-latest
|
279
268
|
strategy:
|
280
269
|
fail-fast: false
|
281
270
|
matrix:
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
{ruby: 3.
|
286
|
-
{ruby: 3.
|
287
|
-
{ruby:
|
288
|
-
{ruby:
|
289
|
-
{ruby: 2.7,
|
290
|
-
{ruby: 2.
|
291
|
-
{ruby:
|
292
|
-
{ruby:
|
293
|
-
{ruby:
|
294
|
-
{ruby:
|
295
|
-
{ruby:
|
296
|
-
{ruby: jruby-9.
|
271
|
+
versions: [
|
272
|
+
# {ruby: 3.1, rails: 7, arelx: 2},
|
273
|
+
{ruby: 3.1, rails: 6_1, arelx: 2},
|
274
|
+
# {ruby: 3.0, rails: 7, arelx: 2},
|
275
|
+
{ruby: 3.0, rails: 6_1, arelx: 2},
|
276
|
+
# {ruby: 2.7, rails: 7, arelx: 2},
|
277
|
+
{ruby: 2.7, rails: 6_1, arelx: 2},
|
278
|
+
{ruby: 2.7, rails: 6, arelx: 2},
|
279
|
+
{ruby: 2.7, rails: 5_2, arelx: 1},
|
280
|
+
{ruby: 2.7, rails: 4_2, arelx: 1},
|
281
|
+
{ruby: 2.5, rails: 6_1, arelx: 2},
|
282
|
+
{ruby: 2.5, rails: 6, arelx: 2},
|
283
|
+
{ruby: 2.5, rails: 5_2, arelx: 1},
|
284
|
+
{ruby: 2.5, rails: 4_2, arelx: 1},
|
285
|
+
# {ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
286
|
+
# {ruby: jruby-9.2, rails: 6, arelx: 2},
|
287
|
+
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
288
|
+
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
289
|
+
# {ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
290
|
+
# {ruby: jruby-9.3, rails: 6, arelx: 2},
|
291
|
+
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
297
292
|
]
|
293
|
+
mssql: [2017, 2019]
|
298
294
|
steps:
|
299
295
|
- uses: actions/checkout@v2
|
300
296
|
- name: Set up Ruby
|
301
297
|
uses: ruby/setup-ruby@v1
|
302
298
|
with:
|
303
|
-
ruby-version: ${{ matrix.ruby }}
|
299
|
+
ruby-version: ${{ matrix.versions.ruby }}
|
304
300
|
- name: Install FreeTDS
|
305
301
|
run: |
|
306
302
|
sudo apt-get update -q
|
307
303
|
sudo apt-get install -y freetds-dev
|
308
|
-
- name: Install MSSQL
|
309
|
-
uses: potatoqualitee/mssqlsuite@v1
|
304
|
+
- name: Install MSSQL ${{ matrix.mssql }}
|
305
|
+
uses: potatoqualitee/mssqlsuite@v1.5.1
|
310
306
|
with:
|
307
|
+
version: ${{ matrix.mssql }}
|
311
308
|
install: sqlengine, sqlclient, sqlpackage, localdb
|
312
309
|
sa-password: Password12!
|
313
310
|
- name: Update system-wide gems
|
314
|
-
run: gem update --system
|
315
|
-
- name: Download gem from build job
|
316
|
-
uses: actions/download-artifact@v2
|
317
|
-
with:
|
318
|
-
name: ${{ matrix.ruby }}-${{ matrix.rails }}-gem
|
311
|
+
run: gem update --system --no-document
|
319
312
|
- name: Setup Gemfile
|
320
|
-
if: ${{ matrix.
|
313
|
+
if: ${{ matrix.versions.arelx == 2 }}
|
321
314
|
run: |
|
322
315
|
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
323
316
|
cp ./version_v2.rb lib/arel_extensions/version.rb
|
324
|
-
cp ./gemfiles/rails${{ matrix.rails }}.gemfile ./Gemfile
|
317
|
+
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
325
318
|
- name: bundle install
|
326
319
|
run: |
|
327
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.rails }}.gemfile
|
320
|
+
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
328
321
|
bundle install
|
329
|
-
- name: Run test mssql
|
322
|
+
- name: Run test mssql [mri]
|
323
|
+
if: ${{ !contains(matrix.versions.ruby, 'jruby') }}
|
330
324
|
run: bundle exec rake test:mssql
|
331
|
-
|
332
|
-
|
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' }}
|
325
|
+
- name: Run test mssql [jruby]
|
326
|
+
if: ${{ contains(matrix.versions.ruby, 'jruby') }}
|
374
327
|
run: |
|
375
|
-
|
376
|
-
|
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
|
328
|
+
curl -LO https://github.com/microsoft/mssql-jdbc/releases/download/v8.4.1/mssql-jdbc-8.4.1.jre11.jar
|
329
|
+
CLASSPATH=".:mssql-jdbc-8.4.1.jre11.jar" bundle exec rake test:mssql
|
data/.gitignore
CHANGED
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: [
|
16
|
-
gem 'activerecord-sqlserver-adapter', '~> 6.0', platforms: [
|
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: [
|
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/NEWS.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Release
|
2
|
+
|
3
|
+
## Bug Fixes
|
4
|
+
|
5
|
+
- This used to fail.
|
6
|
+
```
|
7
|
+
Arel.when(a).then(b).format('%Y-%m-%d')
|
8
|
+
```
|
9
|
+
|
10
|
+
## New Features
|
11
|
+
|
12
|
+
- `o.present`, a synonym for `o.not_blank`
|
13
|
+
- `o.coalesce_blank(a, b, c)`
|
14
|
+
- `o.if_present`, if the value is `null` or blank, then it returns `null`,
|
15
|
+
otherwise, it returns the value. Inspired by rails' `presence`.
|