arel_extensions 1.3.9 → 2.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +2 -1
- data/.gitignore +6 -7
- data/.rubocop.yml +3 -67
- data/.travis/oracle/download.js +152 -0
- data/.travis/oracle/download.sh +30 -0
- data/.travis/oracle/download_ojdbc.js +116 -0
- data/.travis/oracle/install.sh +34 -0
- data/.travis/setup_accounts.sh +9 -0
- data/.travis/sqlite3/extension-functions.sh +6 -0
- data/.travis.yml +223 -0
- data/Gemfile +21 -16
- data/README.md +90 -282
- data/Rakefile +30 -48
- data/TODO +1 -0
- data/appveyor.yml +22 -60
- data/arel_extensions.gemspec +14 -13
- data/functions.html +3 -3
- data/gemfiles/rails3.gemfile +10 -10
- data/gemfiles/rails4.gemfile +29 -0
- data/gemfiles/rails5_0.gemfile +29 -0
- data/gemfiles/rails5_1_4.gemfile +14 -14
- data/gemfiles/rails5_2.gemfile +14 -16
- data/init/mssql.sql +4 -4
- data/init/mysql.sql +38 -38
- data/init/oracle.sql +0 -0
- data/init/postgresql.sql +21 -21
- data/init/sqlite.sql +0 -0
- data/lib/arel_extensions/attributes.rb +3 -4
- data/lib/arel_extensions/boolean_functions.rb +14 -53
- data/lib/arel_extensions/common_sql_functions.rb +17 -16
- data/lib/arel_extensions/comparators.rb +28 -27
- data/lib/arel_extensions/date_duration.rb +13 -17
- data/lib/arel_extensions/insert_manager.rb +15 -18
- data/lib/arel_extensions/math.rb +53 -55
- data/lib/arel_extensions/math_functions.rb +39 -46
- data/lib/arel_extensions/nodes/abs.rb +1 -0
- data/lib/arel_extensions/nodes/blank.rb +2 -1
- data/lib/arel_extensions/nodes/case.rb +19 -20
- data/lib/arel_extensions/nodes/cast.rb +8 -10
- data/lib/arel_extensions/nodes/ceil.rb +1 -1
- data/lib/arel_extensions/nodes/coalesce.rb +4 -3
- data/lib/arel_extensions/nodes/collate.rb +10 -9
- data/lib/arel_extensions/nodes/concat.rb +18 -9
- data/lib/arel_extensions/nodes/date_diff.rb +26 -42
- data/lib/arel_extensions/nodes/duration.rb +3 -0
- data/lib/arel_extensions/nodes/find_in_set.rb +1 -0
- data/lib/arel_extensions/nodes/floor.rb +1 -1
- data/lib/arel_extensions/nodes/format.rb +8 -35
- data/lib/arel_extensions/nodes/formatted_number.rb +23 -22
- data/lib/arel_extensions/nodes/function.rb +37 -42
- data/lib/arel_extensions/nodes/is_null.rb +0 -0
- data/lib/arel_extensions/nodes/json.rb +39 -52
- data/lib/arel_extensions/nodes/length.rb +0 -5
- data/lib/arel_extensions/nodes/levenshtein_distance.rb +1 -1
- data/lib/arel_extensions/nodes/locate.rb +2 -1
- data/lib/arel_extensions/nodes/log10.rb +2 -1
- data/lib/arel_extensions/nodes/matches.rb +7 -5
- data/lib/arel_extensions/nodes/md5.rb +1 -0
- data/lib/arel_extensions/nodes/power.rb +5 -5
- data/lib/arel_extensions/nodes/rand.rb +1 -0
- data/lib/arel_extensions/nodes/repeat.rb +5 -3
- data/lib/arel_extensions/nodes/replace.rb +8 -16
- data/lib/arel_extensions/nodes/round.rb +6 -5
- data/lib/arel_extensions/nodes/soundex.rb +15 -15
- data/lib/arel_extensions/nodes/std.rb +21 -18
- data/lib/arel_extensions/nodes/substring.rb +16 -8
- data/lib/arel_extensions/nodes/then.rb +1 -1
- data/lib/arel_extensions/nodes/trim.rb +6 -4
- data/lib/arel_extensions/nodes/union.rb +8 -5
- data/lib/arel_extensions/nodes/union_all.rb +7 -4
- data/lib/arel_extensions/nodes/wday.rb +4 -0
- data/lib/arel_extensions/nodes.rb +1 -1
- data/lib/arel_extensions/null_functions.rb +5 -19
- data/lib/arel_extensions/predications.rb +43 -44
- data/lib/arel_extensions/railtie.rb +5 -5
- data/lib/arel_extensions/set_functions.rb +7 -5
- data/lib/arel_extensions/string_functions.rb +29 -59
- data/lib/arel_extensions/tasks.rb +6 -6
- data/lib/arel_extensions/version.rb +1 -1
- data/lib/arel_extensions/visitors/ibm_db.rb +31 -24
- data/lib/arel_extensions/visitors/mssql.rb +180 -375
- data/lib/arel_extensions/visitors/mysql.rb +212 -350
- data/lib/arel_extensions/visitors/oracle.rb +178 -220
- data/lib/arel_extensions/visitors/oracle12.rb +31 -18
- data/lib/arel_extensions/visitors/postgresql.rb +173 -256
- data/lib/arel_extensions/visitors/sqlite.rb +126 -140
- data/lib/arel_extensions/visitors/to_sql.rb +237 -298
- data/lib/arel_extensions/visitors.rb +58 -82
- data/lib/arel_extensions.rb +31 -202
- data/test/database.yml +7 -15
- data/test/helper.rb +18 -0
- data/test/real_db_test.rb +116 -105
- data/test/support/fake_record.rb +3 -3
- data/test/test_comparators.rb +17 -14
- data/test/visitors/test_bulk_insert_oracle.rb +11 -11
- data/test/visitors/test_bulk_insert_sqlite.rb +13 -12
- data/test/visitors/test_bulk_insert_to_sql.rb +13 -11
- data/test/visitors/test_oracle.rb +55 -55
- data/test/visitors/test_to_sql.rb +226 -419
- data/test/with_ar/all_agnostic_test.rb +365 -709
- data/test/with_ar/insert_agnostic_test.rb +21 -27
- data/test/with_ar/test_bulk_sqlite.rb +16 -17
- data/test/with_ar/test_math_sqlite.rb +26 -26
- data/test/with_ar/test_string_mysql.rb +33 -31
- data/test/with_ar/test_string_sqlite.rb +34 -30
- metadata +34 -37
- data/.github/workflows/publish.yml +0 -29
- data/.github/workflows/release.yml +0 -30
- data/.github/workflows/ruby.yml +0 -345
- data/NEWS.md +0 -62
- data/bin/build +0 -15
- data/bin/publish +0 -8
- data/dev/compose.yaml +0 -29
- data/gemfiles/rails4_2.gemfile +0 -38
- data/gemfiles/rails5.gemfile +0 -29
- data/gemfiles/rails6.gemfile +0 -30
- data/gemfiles/rails6_1.gemfile +0 -30
- data/gemfiles/rails7.gemfile +0 -23
- data/gemfiles/rails7_1.gemfile +0 -22
- data/gemspecs/arel_extensions-v1.gemspec +0 -27
- data/gemspecs/arel_extensions-v2.gemspec +0 -27
- data/generate_gems.sh +0 -15
- data/lib/arel_extensions/aliases.rb +0 -14
- data/lib/arel_extensions/helpers.rb +0 -57
- data/lib/arel_extensions/nodes/aggregate_function.rb +0 -13
- data/lib/arel_extensions/nodes/formatted_date.rb +0 -42
- data/lib/arel_extensions/nodes/rollup.rb +0 -36
- data/lib/arel_extensions/nodes/select.rb +0 -10
- data/lib/arel_extensions/nodes/sum.rb +0 -7
- data/lib/arel_extensions/visitors/convert_format.rb +0 -37
- data/test/arelx_test_helper.rb +0 -67
- data/version_v1.rb +0 -3
- data/version_v2.rb +0 -3
@@ -1,29 +0,0 @@
|
|
1
|
-
name: "Publish Gems"
|
2
|
-
on:
|
3
|
-
release:
|
4
|
-
types: [published]
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
publish_gems:
|
8
|
-
name: Publish to Rubygems
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
steps:
|
11
|
-
- uses: actions/checkout@v3
|
12
|
-
- name: setup ruby 3.2
|
13
|
-
uses: ruby/setup-ruby@v1
|
14
|
-
with:
|
15
|
-
ruby-version: 3.2
|
16
|
-
- name: Fetch Github Release Asset
|
17
|
-
uses: dsaltares/fetch-gh-release-asset@master
|
18
|
-
with:
|
19
|
-
file: "arel_extensions.*.gem"
|
20
|
-
regex: true
|
21
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
22
|
-
- name: List gems
|
23
|
-
run: ls -l *.gem
|
24
|
-
- name: Release Gems
|
25
|
-
uses: cadwallion/publish-rubygems-action@master
|
26
|
-
env:
|
27
|
-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
28
|
-
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
29
|
-
RELEASE_COMMAND: bin/publish
|
@@ -1,30 +0,0 @@
|
|
1
|
-
name: Release
|
2
|
-
on:
|
3
|
-
workflow_run:
|
4
|
-
workflows: ["Build and Test"]
|
5
|
-
branches: [master]
|
6
|
-
types:
|
7
|
-
- completed
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
build_gems:
|
11
|
-
name: Build Gemfiles
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- name: setup ruby 3.2
|
16
|
-
uses: ruby/setup-ruby@v1
|
17
|
-
with:
|
18
|
-
ruby-version: 3.2
|
19
|
-
- name: build gems
|
20
|
-
run: |
|
21
|
-
bin/build
|
22
|
-
- name: release
|
23
|
-
uses: softprops/action-gh-release@v1
|
24
|
-
with:
|
25
|
-
tag_name: ${{ github.ref }}-${{ steps.vars.outputs.sha_short }}
|
26
|
-
draft: true
|
27
|
-
files: |
|
28
|
-
./arel_extensions-*.gem
|
29
|
-
env:
|
30
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,345 +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: Setup Gemfile for arelx 2.x
|
53
|
-
if: ${{ matrix.versions.arelx == 2 }}
|
54
|
-
run: |
|
55
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
56
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
57
|
-
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
58
|
-
- name: bundle install
|
59
|
-
run: |
|
60
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
61
|
-
bundle install
|
62
|
-
- name: Run test to_sql
|
63
|
-
run: bundle exec rake test:to_sql
|
64
|
-
|
65
|
-
job_test_sqlite:
|
66
|
-
name: test sqlite
|
67
|
-
runs-on: ubuntu-latest
|
68
|
-
strategy:
|
69
|
-
fail-fast: false
|
70
|
-
matrix:
|
71
|
-
versions: [
|
72
|
-
{ruby: '3.2', rails: 7_1, arelx: 2},
|
73
|
-
{ruby: '3.2', rails: 7, arelx: 2},
|
74
|
-
{ruby: '3.2', rails: 6_1, arelx: 2},
|
75
|
-
{ruby: '3.1', rails: 7_1, arelx: 2},
|
76
|
-
{ruby: '3.1', rails: 7, arelx: 2},
|
77
|
-
{ruby: '3.1', rails: 6_1, arelx: 2},
|
78
|
-
{ruby: '3.0', rails: 7_1, arelx: 2},
|
79
|
-
{ruby: '3.0', rails: 7, arelx: 2},
|
80
|
-
{ruby: '3.0', rails: 6_1, arelx: 2},
|
81
|
-
{ruby: '2.7', rails: 7_1, arelx: 2},
|
82
|
-
{ruby: '2.7', rails: 7, arelx: 2},
|
83
|
-
{ruby: '2.7', rails: 6_1, arelx: 2},
|
84
|
-
{ruby: '2.7', rails: 6, arelx: 2},
|
85
|
-
{ruby: '2.7', rails: 5_2, arelx: 1},
|
86
|
-
{ruby: '2.7', rails: 4_2, arelx: 1},
|
87
|
-
{ruby: '2.5', rails: 6_1, arelx: 2},
|
88
|
-
{ruby: '2.5', rails: 6, arelx: 2},
|
89
|
-
{ruby: '2.5', rails: 5_2, arelx: 1},
|
90
|
-
{ruby: '2.5', rails: 4_2, arelx: 1},
|
91
|
-
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
92
|
-
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
93
|
-
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
94
|
-
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
95
|
-
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
96
|
-
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
97
|
-
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
98
|
-
]
|
99
|
-
steps:
|
100
|
-
- uses: actions/checkout@v2
|
101
|
-
- name: Set up Ruby
|
102
|
-
uses: ruby/setup-ruby@v1
|
103
|
-
with:
|
104
|
-
ruby-version: ${{ matrix.versions.ruby }}
|
105
|
-
- name: Install FreeTDS
|
106
|
-
run: |
|
107
|
-
sudo apt-get update -q
|
108
|
-
sudo apt-get install -y freetds-dev
|
109
|
-
- name: Setup Gemfile
|
110
|
-
if: ${{ matrix.versions.arelx == 2 }}
|
111
|
-
run: |
|
112
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
113
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
114
|
-
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
115
|
-
- name: bundle install
|
116
|
-
run: |
|
117
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
118
|
-
bundle install
|
119
|
-
- name: Run test sqlite
|
120
|
-
run: bundle exec rake test:sqlite
|
121
|
-
|
122
|
-
job_test_postgres:
|
123
|
-
name: test postgres
|
124
|
-
runs-on: ubuntu-latest
|
125
|
-
strategy:
|
126
|
-
fail-fast: false
|
127
|
-
matrix:
|
128
|
-
versions: [
|
129
|
-
{ruby: '3.2', rails: 7_1, arelx: 2},
|
130
|
-
{ruby: '3.2', rails: 7, arelx: 2},
|
131
|
-
{ruby: '3.2', rails: 6_1, arelx: 2},
|
132
|
-
{ruby: '3.1', rails: 7_1, arelx: 2},
|
133
|
-
{ruby: '3.1', rails: 7, arelx: 2},
|
134
|
-
{ruby: '3.1', rails: 6_1, arelx: 2},
|
135
|
-
{ruby: '3.0', rails: 7_1, arelx: 2},
|
136
|
-
{ruby: '3.0', rails: 7, arelx: 2},
|
137
|
-
{ruby: '3.0', rails: 6_1, arelx: 2},
|
138
|
-
{ruby: '2.7', rails: 7_1, arelx: 2},
|
139
|
-
{ruby: '2.7', rails: 7, arelx: 2},
|
140
|
-
{ruby: '2.7', rails: 6_1, arelx: 2},
|
141
|
-
{ruby: '2.7', rails: 6, arelx: 2},
|
142
|
-
{ruby: '2.7', rails: 5_2, arelx: 1},
|
143
|
-
{ruby: '2.7', rails: 4_2, arelx: 1},
|
144
|
-
{ruby: '2.5', rails: 6_1, arelx: 2},
|
145
|
-
{ruby: '2.5', rails: 6, arelx: 2},
|
146
|
-
{ruby: '2.5', rails: 5_2, arelx: 1},
|
147
|
-
{ruby: '2.5', rails: 4_2, arelx: 1},
|
148
|
-
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
149
|
-
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
150
|
-
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
151
|
-
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
152
|
-
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
153
|
-
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
154
|
-
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
155
|
-
]
|
156
|
-
steps:
|
157
|
-
- uses: actions/checkout@v2
|
158
|
-
# PostgreSQL requires locales to be installed on the system to be able
|
159
|
-
# to do time and currency conversions at runtime.
|
160
|
-
#
|
161
|
-
# That's why we're not launching it as a service; pre-built images
|
162
|
-
# lack loaclization.
|
163
|
-
#
|
164
|
-
# After we install locales, we'll install PostgreSQL binaries and start
|
165
|
-
# the service.
|
166
|
-
- name: setup locale
|
167
|
-
run: |
|
168
|
-
sudo locale-gen fr_FR.utf8
|
169
|
-
sudo update-locale
|
170
|
-
- name: setup postgres 11
|
171
|
-
run: |
|
172
|
-
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
173
|
-
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
174
|
-
sudo apt update
|
175
|
-
sudo apt -y install postgresql-11
|
176
|
-
sudo systemctl enable postgresql
|
177
|
-
sudo systemctl start postgresql
|
178
|
-
sudo su -c "psql -c \"alter user postgres with password 'secret'\"" postgres
|
179
|
-
sudo su -c "createdb arelx_test" postgres
|
180
|
-
- name: Set up Ruby
|
181
|
-
uses: ruby/setup-ruby@v1
|
182
|
-
with:
|
183
|
-
ruby-version: ${{ matrix.versions.ruby }}
|
184
|
-
- name: Install FreeTDS
|
185
|
-
run: |
|
186
|
-
sudo apt-get update -q
|
187
|
-
sudo apt-get install -y freetds-dev
|
188
|
-
- name: Setup Gemfile
|
189
|
-
if: ${{ matrix.versions.arelx == 2 }}
|
190
|
-
run: |
|
191
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
192
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
193
|
-
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
194
|
-
- name: bundle install
|
195
|
-
run: |
|
196
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
197
|
-
bundle install
|
198
|
-
- name: Run test Postgres
|
199
|
-
env:
|
200
|
-
PGHOST: localhost
|
201
|
-
PGUSER: postgres
|
202
|
-
run: bundle exec rake test:postgresql
|
203
|
-
|
204
|
-
job_test_mysql:
|
205
|
-
name: test mysql
|
206
|
-
runs-on: ubuntu-latest
|
207
|
-
strategy:
|
208
|
-
fail-fast: false
|
209
|
-
matrix:
|
210
|
-
versions: [
|
211
|
-
{ruby: '3.2', rails: 7_1, arelx: 2},
|
212
|
-
{ruby: '3.2', rails: 7, arelx: 2},
|
213
|
-
{ruby: '3.2', rails: 6_1, arelx: 2},
|
214
|
-
{ruby: '3.1', rails: 7_1, arelx: 2},
|
215
|
-
{ruby: '3.1', rails: 7, arelx: 2},
|
216
|
-
{ruby: '3.1', rails: 6_1, arelx: 2},
|
217
|
-
{ruby: '3.0', rails: 7_1, arelx: 2},
|
218
|
-
{ruby: '3.0', rails: 7, arelx: 2},
|
219
|
-
{ruby: '3.0', rails: 6_1, arelx: 2},
|
220
|
-
{ruby: '2.7', rails: 7_1, arelx: 2},
|
221
|
-
{ruby: '2.7', rails: 7, arelx: 2},
|
222
|
-
{ruby: '2.7', rails: 6_1, arelx: 2},
|
223
|
-
{ruby: '2.7', rails: 6, arelx: 2},
|
224
|
-
{ruby: '2.7', rails: 5_2, arelx: 1},
|
225
|
-
{ruby: '2.7', rails: 4_2, arelx: 1},
|
226
|
-
{ruby: '2.5', rails: 6_1, arelx: 2},
|
227
|
-
{ruby: '2.5', rails: 6, arelx: 2},
|
228
|
-
{ruby: '2.5', rails: 5_2, arelx: 1},
|
229
|
-
{ruby: '2.5', rails: 4_2, arelx: 1},
|
230
|
-
{ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
231
|
-
{ruby: jruby-9.2, rails: 6, arelx: 2},
|
232
|
-
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
233
|
-
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
234
|
-
{ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
235
|
-
{ruby: jruby-9.3, rails: 6, arelx: 2},
|
236
|
-
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
237
|
-
]
|
238
|
-
services:
|
239
|
-
mysql:
|
240
|
-
image: mysql:5.7
|
241
|
-
env:
|
242
|
-
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
243
|
-
MYSQL_USERNAME: root
|
244
|
-
MYSQL_DATABASE: arelx_test
|
245
|
-
ports:
|
246
|
-
- 3306:3306
|
247
|
-
options: >-
|
248
|
-
--health-cmd="mysqladmin ping"
|
249
|
-
--health-interval=10s
|
250
|
-
--health-timeout=5s
|
251
|
-
--health-retries=3
|
252
|
-
steps:
|
253
|
-
- uses: actions/checkout@v2
|
254
|
-
- name: Set up Ruby
|
255
|
-
uses: ruby/setup-ruby@v1
|
256
|
-
with:
|
257
|
-
ruby-version: ${{ matrix.versions.ruby }}
|
258
|
-
- name: Install FreeTDS
|
259
|
-
run: |
|
260
|
-
sudo apt-get update -q
|
261
|
-
sudo apt-get install -y freetds-dev
|
262
|
-
- name: Setup Gemfile
|
263
|
-
if: ${{ matrix.versions.arelx == 2 }}
|
264
|
-
run: |
|
265
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
266
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
267
|
-
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
268
|
-
- name: bundle install
|
269
|
-
run: |
|
270
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
271
|
-
bundle install
|
272
|
-
- name: Run test MySql
|
273
|
-
env:
|
274
|
-
DB_CONNECTION: mysql
|
275
|
-
DB_HOST: 127.0.0.1
|
276
|
-
DB_PORT: 3306
|
277
|
-
DB_DATABASE: arelx_test
|
278
|
-
DB_USERNAME: root
|
279
|
-
run: bundle exec rake test:mysql
|
280
|
-
|
281
|
-
job_test_mssql:
|
282
|
-
name: test mssql on linux
|
283
|
-
runs-on: ubuntu-latest
|
284
|
-
strategy:
|
285
|
-
fail-fast: false
|
286
|
-
matrix:
|
287
|
-
versions: [
|
288
|
-
# {ruby: '3.2', rails: 7, arelx: 2},
|
289
|
-
{ruby: '3.2', rails: 6_1, arelx: 2},
|
290
|
-
# {ruby: '3.1', rails: 7, arelx: 2},
|
291
|
-
{ruby: '3.1', rails: 6_1, arelx: 2},
|
292
|
-
# {ruby: '3.0', rails: 7, arelx: 2},
|
293
|
-
{ruby: '3.0', rails: 6_1, arelx: 2},
|
294
|
-
# {ruby: '2.7', rails: 7, arelx: 2},
|
295
|
-
{ruby: '2.7', rails: 6_1, arelx: 2},
|
296
|
-
{ruby: '2.7', rails: 6, arelx: 2},
|
297
|
-
{ruby: '2.7', rails: 5_2, arelx: 1},
|
298
|
-
{ruby: '2.7', rails: 4_2, arelx: 1},
|
299
|
-
{ruby: '2.5', rails: 6_1, arelx: 2},
|
300
|
-
{ruby: '2.5', rails: 6, arelx: 2},
|
301
|
-
{ruby: '2.5', rails: 5_2, arelx: 1},
|
302
|
-
{ruby: '2.5', rails: 4_2, arelx: 1},
|
303
|
-
# {ruby: jruby-9.2, rails: 6_1, arelx: 2},
|
304
|
-
# {ruby: jruby-9.2, rails: 6, arelx: 2},
|
305
|
-
{ruby: jruby-9.2, rails: 5_2, arelx: 1},
|
306
|
-
{ruby: jruby-9.2, rails: 4_2, arelx: 1},
|
307
|
-
# {ruby: jruby-9.3, rails: 6_1, arelx: 2},
|
308
|
-
# {ruby: jruby-9.3, rails: 6, arelx: 2},
|
309
|
-
{ruby: jruby-9.3, rails: 5_2, arelx: 1},
|
310
|
-
]
|
311
|
-
mssql: [2017, 2019]
|
312
|
-
steps:
|
313
|
-
- uses: actions/checkout@v2
|
314
|
-
- name: Set up Ruby
|
315
|
-
uses: ruby/setup-ruby@v1
|
316
|
-
with:
|
317
|
-
ruby-version: ${{ matrix.versions.ruby }}
|
318
|
-
- name: Install FreeTDS
|
319
|
-
run: |
|
320
|
-
sudo apt-get update -q
|
321
|
-
sudo apt-get install -y freetds-dev
|
322
|
-
- name: Install MSSQL ${{ matrix.mssql }}
|
323
|
-
uses: potatoqualitee/mssqlsuite@v1.5.1
|
324
|
-
with:
|
325
|
-
version: ${{ matrix.mssql }}
|
326
|
-
install: sqlengine, sqlclient, sqlpackage, localdb
|
327
|
-
sa-password: Password12!
|
328
|
-
- name: Setup Gemfile
|
329
|
-
if: ${{ matrix.versions.arelx == 2 }}
|
330
|
-
run: |
|
331
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
332
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
333
|
-
cp ./gemfiles/rails${{ matrix.versions.rails }}.gemfile ./Gemfile
|
334
|
-
- name: bundle install
|
335
|
-
run: |
|
336
|
-
bundle config set gemfile ./gemfiles/rails${{ matrix.versions.rails }}.gemfile
|
337
|
-
bundle install
|
338
|
-
- name: Run test mssql [mri]
|
339
|
-
if: ${{ !contains(matrix.versions.ruby, 'jruby') }}
|
340
|
-
run: bundle exec rake test:mssql
|
341
|
-
- name: Run test mssql [jruby]
|
342
|
-
if: ${{ contains(matrix.versions.ruby, 'jruby') }}
|
343
|
-
run: |
|
344
|
-
curl -LO https://github.com/microsoft/mssql-jdbc/releases/download/v8.4.1/mssql-jdbc-8.4.1.jre11.jar
|
345
|
-
CLASSPATH=".:mssql-jdbc-8.4.1.jre11.jar" bundle exec rake test:mssql
|
data/NEWS.md
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# News
|
2
|
-
|
3
|
-
## Release v2.1.9/v1.3.9
|
4
|
-
|
5
|
-
### Bug Fixes
|
6
|
-
|
7
|
-
- Postgres:
|
8
|
-
- Datetime formatting in postgres now behaves like mysql: if the target
|
9
|
-
timezone is a string, we automatically consider that you're trying to
|
10
|
-
convert from `UTC`.
|
11
|
-
- Datetime casting will now automatically ask for a
|
12
|
-
`timestamp without timezone`, also aligning with the expected befavior
|
13
|
-
in mysql. This also makes casting work better with timezone conversion,
|
14
|
-
especially if you don't pass the timezone from which you're converting
|
15
|
-
to.
|
16
|
-
```ruby
|
17
|
-
scope
|
18
|
-
.select(Arel.quoted('2022-02-01 10:42:00')
|
19
|
-
.cast(:datetime)
|
20
|
-
.format_date('%Y/%m/%d %H:%M:%S', 'Europe/Paris')
|
21
|
-
.as('res'))
|
22
|
-
```
|
23
|
-
Will produce:
|
24
|
-
```sql
|
25
|
-
SELECT TO_CHAR(
|
26
|
-
CAST('2022-02-01 10:42:00' AS timestamp without time zone) AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/Paris',
|
27
|
-
'YYYY/MM/DD HH24:MI:SS'
|
28
|
-
)
|
29
|
-
AS "res"
|
30
|
-
-- …
|
31
|
-
```
|
32
|
-
|
33
|
-
## Release v2.1.7/v1.3.7
|
34
|
-
|
35
|
-
### New Features
|
36
|
-
|
37
|
-
- `o.format_date` as an alternative to `o.format`
|
38
|
-
The actual behavior of `format` is inconsistent across DB vendors: in mysql we
|
39
|
-
can format dates and numbers with it, and in the other ones we only format
|
40
|
-
dates.
|
41
|
-
|
42
|
-
We're planning on normalizing this behavior. We want `format` to "cleverly"
|
43
|
-
format dates or numbers, and `format_date` / `format_number` to strictly
|
44
|
-
format dates / numbers.
|
45
|
-
|
46
|
-
The introduction of `format_date` is the first step in this direction.
|
47
|
-
|
48
|
-
## Release v2.1.6/v1.3.6
|
49
|
-
|
50
|
-
### Bug Fixes
|
51
|
-
|
52
|
-
- This used to fail.
|
53
|
-
```
|
54
|
-
Arel.when(a).then(b).format('%Y-%m-%d')
|
55
|
-
```
|
56
|
-
|
57
|
-
### New Features
|
58
|
-
|
59
|
-
- `o.present`, a synonym for `o.not_blank`
|
60
|
-
- `o.coalesce_blank(a, b, c)`
|
61
|
-
- `o.if_present`, if the value is `null` or blank, then it returns `null`,
|
62
|
-
otherwise, it returns the value. Inspired by rails' `presence`.
|
data/bin/build
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#! /usr/bin/env sh
|
2
|
-
set -e
|
3
|
-
|
4
|
-
# VERSION ~> 1
|
5
|
-
echo "Packaging v1"
|
6
|
-
cp ./version_v1.rb lib/arel_extensions/version.rb
|
7
|
-
cp ./gemspecs/arel_extensions-v1.gemspec ./arel_extensions.gemspec
|
8
|
-
gem build ./arel_extensions.gemspec
|
9
|
-
|
10
|
-
# VERSION ~> 2
|
11
|
-
echo "Packaging v2"
|
12
|
-
cp ./version_v2.rb lib/arel_extensions/version.rb
|
13
|
-
cp ./gemspecs/arel_extensions-v2.gemspec ./arel_extensions.gemspec
|
14
|
-
gem build ./arel_extensions.gemspec
|
15
|
-
|
data/bin/publish
DELETED
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
|
data/gemfiles/rails4_2.gemfile
DELETED
@@ -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
|
data/gemfiles/rails5.gemfile
DELETED
@@ -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
|
data/gemfiles/rails6.gemfile
DELETED
@@ -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
|
data/gemfiles/rails6_1.gemfile
DELETED
@@ -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
|
data/gemfiles/rails7.gemfile
DELETED
@@ -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
|