arel_extensions 1.3.4 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -1
  3. data/.rubocop.yml +4 -31
  4. data/.travis/oracle/download.js +152 -0
  5. data/.travis/oracle/download.sh +30 -0
  6. data/.travis/oracle/download_ojdbc.js +116 -0
  7. data/.travis/oracle/install.sh +34 -0
  8. data/.travis/setup_accounts.sh +9 -0
  9. data/.travis/sqlite3/extension-functions.sh +6 -0
  10. data/.travis.yml +223 -0
  11. data/Gemfile +21 -16
  12. data/README.md +14 -125
  13. data/Rakefile +30 -41
  14. data/TODO +1 -0
  15. data/appveyor.yml +44 -0
  16. data/arel_extensions.gemspec +14 -14
  17. data/functions.html +3 -3
  18. data/gemfiles/rails3.gemfile +10 -10
  19. data/gemfiles/rails4.gemfile +14 -14
  20. data/gemfiles/rails5_0.gemfile +14 -14
  21. data/gemfiles/rails5_1_4.gemfile +14 -14
  22. data/gemfiles/rails5_2.gemfile +14 -15
  23. data/init/mssql.sql +4 -4
  24. data/init/mysql.sql +38 -38
  25. data/init/oracle.sql +0 -0
  26. data/init/postgresql.sql +21 -21
  27. data/init/sqlite.sql +0 -0
  28. data/lib/arel_extensions/attributes.rb +3 -4
  29. data/lib/arel_extensions/boolean_functions.rb +14 -53
  30. data/lib/arel_extensions/common_sql_functions.rb +16 -15
  31. data/lib/arel_extensions/comparators.rb +28 -27
  32. data/lib/arel_extensions/date_duration.rb +14 -13
  33. data/lib/arel_extensions/insert_manager.rb +15 -18
  34. data/lib/arel_extensions/math.rb +44 -31
  35. data/lib/arel_extensions/math_functions.rb +39 -46
  36. data/lib/arel_extensions/nodes/abs.rb +1 -0
  37. data/lib/arel_extensions/nodes/blank.rb +2 -1
  38. data/lib/arel_extensions/nodes/case.rb +16 -16
  39. data/lib/arel_extensions/nodes/cast.rb +6 -8
  40. data/lib/arel_extensions/nodes/ceil.rb +1 -1
  41. data/lib/arel_extensions/nodes/coalesce.rb +3 -2
  42. data/lib/arel_extensions/nodes/collate.rb +10 -9
  43. data/lib/arel_extensions/nodes/concat.rb +18 -9
  44. data/lib/arel_extensions/nodes/date_diff.rb +22 -38
  45. data/lib/arel_extensions/nodes/duration.rb +3 -0
  46. data/lib/arel_extensions/nodes/find_in_set.rb +1 -0
  47. data/lib/arel_extensions/nodes/floor.rb +1 -1
  48. data/lib/arel_extensions/nodes/format.rb +8 -35
  49. data/lib/arel_extensions/nodes/formatted_number.rb +23 -22
  50. data/lib/arel_extensions/nodes/function.rb +37 -42
  51. data/lib/arel_extensions/nodes/is_null.rb +0 -0
  52. data/lib/arel_extensions/nodes/json.rb +39 -48
  53. data/lib/arel_extensions/nodes/length.rb +0 -5
  54. data/lib/arel_extensions/nodes/levenshtein_distance.rb +1 -1
  55. data/lib/arel_extensions/nodes/locate.rb +1 -0
  56. data/lib/arel_extensions/nodes/log10.rb +2 -1
  57. data/lib/arel_extensions/nodes/matches.rb +7 -5
  58. data/lib/arel_extensions/nodes/md5.rb +1 -0
  59. data/lib/arel_extensions/nodes/power.rb +5 -5
  60. data/lib/arel_extensions/nodes/rand.rb +1 -0
  61. data/lib/arel_extensions/nodes/repeat.rb +4 -2
  62. data/lib/arel_extensions/nodes/replace.rb +8 -16
  63. data/lib/arel_extensions/nodes/round.rb +6 -5
  64. data/lib/arel_extensions/nodes/soundex.rb +15 -15
  65. data/lib/arel_extensions/nodes/std.rb +21 -18
  66. data/lib/arel_extensions/nodes/substring.rb +16 -8
  67. data/lib/arel_extensions/nodes/trim.rb +5 -3
  68. data/lib/arel_extensions/nodes/union.rb +8 -5
  69. data/lib/arel_extensions/nodes/union_all.rb +7 -4
  70. data/lib/arel_extensions/nodes/wday.rb +4 -0
  71. data/lib/arel_extensions/nodes.rb +1 -1
  72. data/lib/arel_extensions/null_functions.rb +7 -5
  73. data/lib/arel_extensions/predications.rb +43 -44
  74. data/lib/arel_extensions/railtie.rb +5 -5
  75. data/lib/arel_extensions/set_functions.rb +7 -5
  76. data/lib/arel_extensions/string_functions.rb +29 -58
  77. data/lib/arel_extensions/tasks.rb +6 -6
  78. data/lib/arel_extensions/version.rb +1 -1
  79. data/lib/arel_extensions/visitors/ibm_db.rb +31 -24
  80. data/lib/arel_extensions/visitors/mssql.rb +184 -269
  81. data/lib/arel_extensions/visitors/mysql.rb +206 -271
  82. data/lib/arel_extensions/visitors/oracle.rb +175 -191
  83. data/lib/arel_extensions/visitors/oracle12.rb +31 -18
  84. data/lib/arel_extensions/visitors/postgresql.rb +170 -244
  85. data/lib/arel_extensions/visitors/sqlite.rb +124 -138
  86. data/lib/arel_extensions/visitors/to_sql.rb +237 -269
  87. data/lib/arel_extensions/visitors.rb +59 -75
  88. data/lib/arel_extensions.rb +31 -149
  89. data/test/database.yml +7 -15
  90. data/test/helper.rb +18 -0
  91. data/test/real_db_test.rb +113 -102
  92. data/test/support/fake_record.rb +3 -3
  93. data/test/test_comparators.rb +17 -14
  94. data/test/visitors/test_bulk_insert_oracle.rb +10 -10
  95. data/test/visitors/test_bulk_insert_sqlite.rb +12 -11
  96. data/test/visitors/test_bulk_insert_to_sql.rb +12 -10
  97. data/test/visitors/test_oracle.rb +55 -55
  98. data/test/visitors/test_to_sql.rb +226 -419
  99. data/test/with_ar/all_agnostic_test.rb +357 -567
  100. data/test/with_ar/insert_agnostic_test.rb +19 -25
  101. data/test/with_ar/test_bulk_sqlite.rb +15 -16
  102. data/test/with_ar/test_math_sqlite.rb +26 -26
  103. data/test/with_ar/test_string_mysql.rb +33 -31
  104. data/test/with_ar/test_string_sqlite.rb +34 -30
  105. metadata +23 -29
  106. data/.github/workflows/ruby.yml +0 -389
  107. data/gemfiles/rails6.gemfile +0 -29
  108. data/gemfiles/rails6_1.gemfile +0 -29
  109. data/gemfiles/rails7.gemfile +0 -22
  110. data/gemspecs/arel_extensions-v1.gemspec +0 -28
  111. data/gemspecs/arel_extensions-v2.gemspec +0 -28
  112. data/generate_gems.sh +0 -15
  113. data/lib/arel_extensions/aliases.rb +0 -14
  114. data/lib/arel_extensions/helpers.rb +0 -51
  115. data/lib/arel_extensions/nodes/aggregate_function.rb +0 -13
  116. data/lib/arel_extensions/nodes/sum.rb +0 -7
  117. data/lib/arel_extensions/visitors/convert_format.rb +0 -37
  118. data/test/arelx_test_helper.rb +0 -71
  119. data/version_v1.rb +0 -3
  120. data/version_v2.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cccb0b1ca82955d6b7505600c43eb2fd64a79a7a002aa5d7c3ae73a20f0c81d
4
- data.tar.gz: 7d43ef3dd1245d583d99873a15245d1e734450612c0bae55f230e48a8a3ad569
3
+ metadata.gz: 66c2dbd555cb0f702ba816dfd15143d1206667a52d3e9ef531837cede739ce1b
4
+ data.tar.gz: 7bddb377ad0a827d95a9b1a6d0dbedf2a60edcacb65a7ca485b341dedeced96b
5
5
  SHA512:
6
- metadata.gz: c48cdf4cdc3ed8b607f0e3d16f577adc3847469509f18a81caa57315bd34afd159b04630ccc2e565452422f581193210cb02131a81d33656b5e1104397e2cc52
7
- data.tar.gz: 7e776e1b749e7fd1756df5f4095e88c6c95fd320a1ad902983452d0146ce38dd0e6b30ec252955db397a3b27e6c745a11af13bba306ad7fe11c507ca24eb2691
6
+ metadata.gz: 28b4685b962e6e2d608ed3e0a482a9ee2af533d8529438223caed947e07dbc286238c510b897b0c090e4abcb968261cc660a42929a909ddd21950c375669b2df
7
+ data.tar.gz: 5cd46969679f69c1dcc67c18c8f184c17f14f269e6e4de1e4ebd1c048a0e8844d9d25ef9c44c359534346f1b9439b1ee24b08497f434f8bf9bab07d461ca2a33
data/.codeclimate.yml CHANGED
@@ -21,4 +21,5 @@ ratings:
21
21
  - "**.rb"
22
22
  - "**.md"
23
23
  exclude_paths:
24
- - test/**/*
24
+ - .travis/**/*
25
+ - test/**/*
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  DisabledByDefault: true
3
3
  Exclude:
4
- - "vendor/**/*"
4
+ - "test/**/*"
5
5
 
6
6
  Layout/EndOfLine:
7
7
  Enabled: true
@@ -9,28 +9,10 @@ Layout/EndOfLine:
9
9
  Layout/ExtraSpacing:
10
10
  Enabled: true
11
11
 
12
- Layout/IndentationWidth:
13
- Enabled: true
14
-
15
- Layout/LineLength:
16
- Enabled: false
17
-
18
- Layout/SpaceAfterComma:
19
- Enabled: true
20
-
21
12
  Layout/SpaceAroundEqualsInParameterDefault:
22
13
  Enabled: true
23
14
 
24
- Layout/SpaceAroundOperators:
25
- Enabled: true
26
-
27
- Layout/TrailingEmptyLines:
28
- Enabled: true
29
-
30
- Metrics/BlockLength:
31
- Enabled: false
32
-
33
- Naming/FileName:
15
+ Layout/TrailingBlankLines:
34
16
  Enabled: true
35
17
 
36
18
  Style/CollectionMethods:
@@ -51,21 +33,12 @@ Style/EmptyElse:
51
33
  Style/Encoding:
52
34
  Enabled: true
53
35
 
54
- Style/MethodCallWithArgsParentheses:
55
- Enabled: false
56
-
57
- Style/MethodCallWithoutArgsParentheses:
36
+ Style/FileName:
58
37
  Enabled: true
59
38
 
60
- Style/NegatedIf:
39
+ Style/MethodCallWithArgsParentheses:
61
40
  Enabled: false
62
41
 
63
- Style/StringLiterals:
64
- Enabled: true
65
-
66
- # Performance cops have been transferred to rubocop-performance gem.
67
- require: rubocop-performance
68
-
69
42
  Performance/DoubleStartEndWith:
70
43
  Enabled: true
71
44
 
@@ -0,0 +1,152 @@
1
+ // vim: set et sw=2 ts=2:
2
+ "use strict";
3
+ var env = process.env;
4
+ var url = require('url');
5
+ var Promise = require('bluebird');
6
+ var Phantom = Promise.promisifyAll(require('node-phantom-simple'));
7
+
8
+ var login = {
9
+ begin: url.parse(env['ORACLE_LOGIN_BEGIN'] || "https://www.oracle.com/webapps/redirect/signon?nexturl=https://www.oracle.com/favicon.ico"),
10
+ end: url.parse(env['ORCALE_LOGIN_END'] || "https://www.oracle.com/favicon.ico"),
11
+ };
12
+ delete env['ORACLE_LOGIN_BEGIN'];
13
+ delete env['ORACLE_LOGIN_END'];
14
+
15
+ var credentials = Object.keys(env)
16
+ .filter(function (key) { return key.indexOf('ORACLE_LOGIN_') == 0 })
17
+ .map(function (key) { return [key.substr(13), env[key]] });
18
+
19
+ if (credentials.length <= 0) {
20
+ console.error("Missing ORACLE_LOGIN environment variables!");
21
+ process.exit(1);
22
+ }
23
+
24
+ Phantom.createAsync({ parameters: { 'ssl-protocol': 'tlsv1' } }).then(function (browser) {
25
+ browser = Promise.promisifyAll(browser, { suffix: 'Promise' });
26
+ browser.addCookie({'name': 'oraclelicense', 'value': "accept-" + env['ORACLE_COOKIE'] + "-cookie", 'domain': '.oracle.com' });
27
+
28
+ // Open a tab, configure it
29
+ return browser.createPagePromise().then(function (page) {
30
+ page = Promise.promisifyAll(page, { suffix: 'Promise' });
31
+
32
+ var received = "";
33
+ page.onNavigationRequested = function () { console.info("%s %j", (new Date()).toISOString(), arguments["0"]); };
34
+ page.onResourceError = console.error.bind(console);
35
+ page.onResourceReceived = function (response) { if (response.stage == "end") received = response.url; };
36
+ page.set('settings.loadImages', false);
37
+
38
+ return page
39
+ .setPromise('settings.userAgent', env['USER_AGENT']) // PhantomJS configures the UA per tab
40
+
41
+ // Begin login, wait for the login page
42
+ .then(function () {
43
+ return page.openPromise(login.begin.href).then(function (status) {
44
+ if (status != 'success') throw "Unable to connect to " + login.begin.host;
45
+
46
+ return new Promise(function (resolve, reject) {
47
+ var deadline = Date.now() + 6000;
48
+ var interval = 100;
49
+
50
+ var check = function () {
51
+ if (deadline < Date.now()) return reject("Timeout waiting for form");
52
+
53
+ page.evaluate(function () {
54
+ return window['jQuery'] && document.querySelectorAll('input[type=password]').length;
55
+ }, function (err, result) {
56
+ if (result) { resolve(); } else { setTimeout(check, interval); }
57
+ });
58
+ };
59
+
60
+ check();
61
+ });
62
+ })
63
+ .tapCatch(function (err) {
64
+ return page.getPromise('plainText').then(function (text) {
65
+ console.error("Unable to load login page. Last response was:\n" + text);
66
+ });
67
+ });
68
+ })
69
+
70
+ // Submit the login form
71
+ .then(function () {
72
+ return page.evaluatePromise(function (credentials) {
73
+ var $form = jQuery(document.forms[0]);
74
+ return credentials.filter(function (tuple) {
75
+ return $form.find("[name='"+tuple[0]+"']").val(tuple[1]).length == 0;
76
+ })
77
+ .map(function (tuple) { return tuple[0]; });
78
+ }, credentials)
79
+ .then(function (unapplied) {
80
+ if (unapplied.length > 0) {
81
+ console.warn("Unable to use all ORACLE_LOGIN environment variables: %j", unapplied);
82
+ }
83
+ return page.evaluatePromise(function () {
84
+ jQuery(function () { document.forms[0].submit(); });
85
+ });
86
+ });
87
+ })
88
+
89
+ // Wait for login result
90
+ .then(function () {
91
+ return new Promise(function (resolve, reject) {
92
+ var deadline = Date.now() + 6000;
93
+ var interval = 100;
94
+
95
+ var check = function () {
96
+ if (deadline < Date.now()) return reject("Timeout waiting for " + login.end.href);
97
+ if (received == login.end.href) { resolve(); } else { setTimeout(check, interval); }
98
+ };
99
+
100
+ check();
101
+ })
102
+ .tapCatch(function (err) {
103
+ return page.getPromise('plainText').then(function (text) {
104
+ console.error("Unable to load login result. Last response was:\n" + text);
105
+ });
106
+ });
107
+ })
108
+
109
+ // Export cookies for cURL
110
+ .then(function () {
111
+ return browser.getPromise('cookies').then(function (cookies) {
112
+ var data = "";
113
+ for (var i = 0; i < cookies.length; ++i) {
114
+ var cookie = cookies[i];
115
+ data += cookie.domain + "\tTRUE\t" + cookie.path + "\t"
116
+ + (cookie.secure ? "TRUE" : "FALSE") + "\t0\t"
117
+ + cookie.name + "\t" + cookie.value + "\n";
118
+ }
119
+ return Promise.promisify(require('fs').writeFile)(env['COOKIES'], data);
120
+ });
121
+ })
122
+
123
+ // Download file using cURL
124
+ .then(function () {
125
+ return browser.exitPromise().then(function () {
126
+ var cmd = ['curl', [
127
+ '--cookie', env['COOKIES'],
128
+ '--cookie-jar', env['COOKIES'],
129
+ '--location',
130
+ '--output', env['ORACLE_DOWNLOAD_FILE'],
131
+ '--user-agent', env['USER_AGENT'],
132
+ "https://edelivery.oracle.com/akam/otn/linux/" + env['ORACLE_FILE']
133
+ ]];
134
+
135
+ console.info("Executing %j", cmd);
136
+
137
+ var child_process = require('child_process');
138
+ var child = child_process.spawn.apply(child_process, cmd.concat({ stdio: [0, 1, 2] }));
139
+ child.on('exit', process.exit);
140
+ });
141
+ })
142
+ .catch(function (err) {
143
+ console.error(err);
144
+ browser.on('exit', function () { process.exit(1); });
145
+ browser.exit();
146
+ });
147
+ });
148
+ })
149
+ .catch(function (err) {
150
+ console.error(err);
151
+ process.exit(1);
152
+ });
@@ -0,0 +1,30 @@
1
+ #!/bin/sh -e
2
+ # vim: set et sw=2 ts=2:
3
+
4
+ [ -n "$ORACLE_COOKIE" ] || { echo "Missing ORACLE_COOKIE environment variable!"; exit 1; }
5
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
6
+
7
+ ORACLE_DOWNLOAD_FILE="$(basename "$ORACLE_FILE")"
8
+
9
+ if [ -n "$ORACLE_DOWNLOAD_DIR" ]; then
10
+ mkdir -p "$ORACLE_DOWNLOAD_DIR"
11
+ ORACLE_DOWNLOAD_FILE="$(readlink -f "$ORACLE_DOWNLOAD_DIR")/$ORACLE_DOWNLOAD_FILE"
12
+ fi
13
+
14
+ if [ "${*#*--unless-exists}" != "$*" ] && [ -f "$ORACLE_DOWNLOAD_FILE" ]; then
15
+ exit 0
16
+ fi
17
+
18
+ cd "$(dirname "$(readlink -f "$0")")"
19
+
20
+ echo "PhantomJS version $(phantomjs --version)"
21
+ npm install bluebird node-phantom-simple
22
+
23
+ export ORACLE_DOWNLOAD_FILE
24
+ export COOKIES='cookies.txt'
25
+ export USER_AGENT='Mozilla/5.0'
26
+
27
+ echo > "$COOKIES"
28
+ chmod 600 "$COOKIES"
29
+
30
+ exec node download.js
@@ -0,0 +1,116 @@
1
+ // vim: set et sw=2 ts=2:
2
+ "use strict";
3
+ var env = process.env;
4
+ var Promise = require('bluebird');
5
+ var Phantom = Promise.promisifyAll(require('node-phantom-simple'));
6
+ var PhantomError = require('node-phantom-simple/headless_error');
7
+
8
+ var credentials = Object.keys(env)
9
+ .filter(function (key) { return key.indexOf('ORACLE_LOGIN_') == 0 })
10
+ .map(function (key) { return [key.substr(13), env[key]] });
11
+
12
+ if (credentials.length <= 0) {
13
+ console.error("Missing ORACLE_LOGIN environment variables!");
14
+ process.exit(1);
15
+ }
16
+
17
+ Phantom.createAsync({ parameters: { 'ssl-protocol': 'tlsv1' } }).then(function (browser) {
18
+ browser = Promise.promisifyAll(browser, { suffix: 'Promise' });
19
+
20
+ // Configure the browser, open a tab
21
+ return browser
22
+ .addCookiePromise({'name': 'oraclelicense', 'value': "accept-" + env['ORACLE_COOKIE'] + "-cookie", 'domain': '.oracle.com' })
23
+ .then(function () {
24
+ return browser.createPagePromise();
25
+ })
26
+ .then(function (page) {
27
+ page = Promise.promisifyAll(page, { suffix: 'Promise' });
28
+
29
+ // Configure the tab
30
+ page.onResourceError = console.error.bind(console);
31
+ return page
32
+ .setPromise('settings.userAgent', env['USER_AGENT']) // PhantomJS configures the UA per tab
33
+
34
+ // Request the file, wait for the login page
35
+ .then(function () {
36
+ return page.openPromise("https://edelivery.oracle.com/akam/otn/linux/" + env['ORACLE_FILE']).then(function (status) {
37
+ if (status != 'success') throw "Unable to connect to oracle.com";
38
+ return page.waitForSelectorPromise('input[type=password]', 5000);
39
+ })
40
+ .catch(PhantomError, function (err) {
41
+ return page.getPromise('plainText').then(function (text) {
42
+ console.error("Unable to load login page. Last response was:\n" + text);
43
+ throw err;
44
+ });
45
+ });
46
+ })
47
+
48
+ // Export cookies for cURL
49
+ .then(function () {
50
+ return page.getPromise('cookies').then(function (cookies) {
51
+ var data = "";
52
+ for (var i = 0; i < cookies.length; ++i) {
53
+ var cookie = cookies[i];
54
+ data += cookie.domain + "\tTRUE\t" + cookie.path + "\t"
55
+ + (cookie.secure ? "TRUE" : "FALSE") + "\t0\t"
56
+ + cookie.name + "\t" + cookie.value + "\n";
57
+ }
58
+ return Promise.promisifyAll(require('fs')).writeFileAsync(env['COOKIES'], data);
59
+ });
60
+ })
61
+
62
+ // Submit the login form using cURL
63
+ .then(function () {
64
+ return page.evaluatePromise(function () {
65
+ var $form = jQuery(document.forms[0]);
66
+ return {
67
+ action: $form.prop('action'),
68
+ data: $form.serialize()
69
+ };
70
+ })
71
+ .then(function (form) {
72
+ return browser.exitPromise().then(function () {
73
+ var unapplied = credentials.filter(function (tuple) {
74
+ var applied = false;
75
+ form.data = form.data.replace(tuple[0] + '=', function (name) {
76
+ applied = true;
77
+ return name + encodeURIComponent(tuple[1]);
78
+ });
79
+ return !applied;
80
+ })
81
+ .map(function (tuple) { return tuple[0] });
82
+
83
+ if (unapplied.length > 0) {
84
+ console.warn("Unable to use all ORACLE_LOGIN environment variables: %j", unapplied);
85
+ }
86
+
87
+ var cmd = ['curl', [
88
+ '--cookie', env['COOKIES'],
89
+ '--cookie-jar', env['COOKIES'],
90
+ '--data', '@-',
91
+ '--location',
92
+ '--output', require('path').basename('ojdbc6.jar'),
93
+ '--user-agent', env['USER_AGENT'],
94
+ env['ORACLE_OJDBC_URL']
95
+ ]];
96
+
97
+ console.info("Executing %j", cmd);
98
+
99
+ var child_process = require('child_process');
100
+ var child = child_process.spawn.apply(child_process, cmd.concat({ stdio: ['pipe', 1, 2] }));
101
+ child.on('exit', process.exit);
102
+ child.stdin.end(form.data);
103
+ });
104
+ });
105
+ })
106
+ .catch(function (err) {
107
+ console.error(err);
108
+ browser.on('exit', function () { process.exit(1); });
109
+ browser.exit();
110
+ });
111
+ });
112
+ })
113
+ .catch(function (err) {
114
+ console.error(err);
115
+ process.exit(1);
116
+ });
@@ -0,0 +1,34 @@
1
+ #!/bin/sh -e
2
+ # vim: set et sw=2 ts=2:
3
+
4
+ [ -z "$ORACLE_DOWNLOAD_DIR" ] || ORACLE_DOWNLOAD_DIR="$(readlink -f "$ORACLE_DOWNLOAD_DIR")/"
5
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
6
+ [ -n "$ORACLE_HOME" ] || { echo "Missing ORACLE_HOME environment variable!"; exit 1; }
7
+
8
+ ORACLE_RPM="$(basename "$ORACLE_FILE" .zip)"
9
+
10
+ cd "$(dirname "$(readlink -f "$0")")"
11
+
12
+ dpkg -s bc libaio1 rpm unzip > /dev/null 2>&1 ||
13
+ ( sudo apt-get -qq update && sudo apt-get --no-install-recommends -qq install bc libaio1 rpm unzip )
14
+
15
+ df -B1 /dev/shm | awk 'END { if ($1 != "shmfs" && $1 != "tmpfs" || $2 < 2147483648) exit 1 }' ||
16
+ ( sudo rm -r /dev/shm && sudo mkdir /dev/shm && sudo mount -t tmpfs shmfs -o size=2G /dev/shm )
17
+
18
+ test -f /sbin/chkconfig ||
19
+ ( echo '#!/bin/sh' | sudo tee /sbin/chkconfig > /dev/null && sudo chmod u+x /sbin/chkconfig )
20
+
21
+ test -d /var/lock/subsys || sudo mkdir /var/lock/subsys
22
+
23
+ unzip -j "${ORACLE_DOWNLOAD_DIR}$(basename "$ORACLE_FILE")" "*/$ORACLE_RPM"
24
+ sudo rpm --install --nodeps --nopre "$ORACLE_RPM"
25
+
26
+ echo 'OS_AUTHENT_PREFIX=""' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null
27
+ sudo usermod -aG dba $USER
28
+
29
+ ( echo ; echo ; echo travis ; echo travis ; echo n ) | sudo AWK='/usr/bin/awk' /etc/init.d/oracle-xe configure
30
+
31
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
32
+ CREATE USER $USER IDENTIFIED EXTERNALLY;
33
+ GRANT CONNECT, RESOURCE TO $USER;
34
+ SQL
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ set -ev
4
+
5
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
6
+ @@test/support/alter_system_user_password.sql
7
+ @@test/support/create_oracle_enhanced_users.sql
8
+ exit
9
+ SQL
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -ex
4
+
5
+ sudo curl -L https://sqlite.org/contrib/download/extension-functions.c?get=25 -o /tmp/extension-functions.c
6
+ sudo gcc -fPIC -lm -shared /tmp/extension-functions.c -o /usr/lib/sqlite3/extension-functions.so
data/.travis.yml ADDED
@@ -0,0 +1,223 @@
1
+ language: ruby
2
+ sudo: required
3
+ cache:
4
+ bundler: true
5
+ directories:
6
+ - $ORACLE_HOME
7
+ before_install:
8
+ - chmod +x .travis/sqlite3/extension-functions.sh
9
+ # - chmod +x .travis/oracle/download.sh
10
+ # - chmod +x .travis/oracle/install.sh
11
+ # - chmod +x .travis/setup_accounts.sh
12
+ - sudo apt-get install -y sqlite3-pcre curl
13
+ - .travis/sqlite3/extension-functions.sh
14
+ # - .travis/oracle/download.sh
15
+ # - sh -ex .travis/oracle/install.sh
16
+ # - .travis/setup_accounts.sh
17
+ install:
18
+ - gem install bundler -v 1.17.3
19
+ - bundle install
20
+ gemfile:
21
+ - gemfiles/rails4.gemfile
22
+ - gemfiles/rails5_0.gemfile
23
+ - gemfiles/rails5_1_4.gemfile
24
+ - gemfiles/rails5_2.gemfile
25
+ services:
26
+ - mysql
27
+ - postgresql
28
+ before_script:
29
+ - mysql -e 'create database arext_test;'
30
+ - psql -c 'create database arext_test;' -U postgres
31
+ script:
32
+ - gem build arel_extensions.gemspec
33
+ - bundle exec rake test
34
+ - bundle exec rake test:sqlite
35
+ - bundle exec rake test:mysql
36
+ - bundle exec rake test:postgresql
37
+ #- bundle exec rake test:oracle # service unavailable
38
+ env:
39
+ global:
40
+ - JRUBY_OPTS='--dev -J-Xmx1024M'
41
+ # - ORACLE_COOKIE=sqldev
42
+ # - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
43
+ # - ORACLE_OJDBC_URL=http://download.oracle.com/otn/utilities_drivers/jdbc/11204/ojdbc6.jar
44
+ - TNS_ADMIN=$ORACLE_HOME/network/admin
45
+ # - ORACLE_BASE=/u01/app/oracle
46
+ # - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
47
+ # - ORACLE_SID=XE
48
+ - DATABASE_NAME=XE
49
+ - NLS_LANG=AMERICAN_AMERICA.AL32UTF8
50
+ - secure: 0RUuF4l0e3J8UIIMlgb8x/aYy2pH6Wb+EWylOr2W1EQechivoFw6IEYD1EZWIOZ/uNpkQ2h/urbUqW3/HpKhZn+NYP2sQI41Xyu1TD+6HPWAHpEvLzemhQSJV6eIeLRQoVDLUmqF23nUZDtKQAwOOyJVMeqHMahJi5K7N/cfQmifs2QcBnMxPnANIcrSXxOCBoqCl6BERG9JTeKERG/lWG1I9vRIe9ISNyOPUQVVI6SfTJwhJP5NLkxSJG1q2PLPK7p6zQ684sS4zSnS5oV23yDsQWWIwxk78CVu1jnFBu8Qq3ngWsInlkHrPotjtaxmTxM8JQd4fgE5NMO2Pjnj8w7zg+sbl+3OVtareX+M9+OLdUD5xBQhecPpzflMqib2qZ0fr9tdoT8kAZJTiXtQrptZfaXleZlH74l2dO/PYxkoWMusYQnSbQl0G3AoyYH+l7YpefL4arm0s5IIiOK+ZiCoZ14pl26rYAA1iPUe5AT+hecKi+fwqhyFE7fMX+zC+AvzsQL8jrP0CXL/hmPkoFYxvcDgUoYhvOq+mmQHdOfU7ny4hH5z5d9691qceduHFvF7fNZ4pSofj03eGqfTTk+SDNeZIo6NXNlayayjV2L/DxL6d7vetxkWwipx47PI76gBAqJlxgODJuzoOtyQkPyIVsDlzI1UPoS+UbrU51w=
51
+ rvm:
52
+ - 2.0.0
53
+ - 2.1
54
+ - 2.2.5
55
+ - 2.3.1
56
+ - 2.4.0
57
+ - 2.5.0
58
+ - rbx-2
59
+ - jruby-9.0.5.0
60
+ - jruby-9.2.0.0
61
+ - jruby-head
62
+ - ruby-head
63
+ jdk:
64
+ - openjdk7
65
+ - oraclejdk8
66
+ - oraclejdk9
67
+ - openjdk10
68
+ - oraclejdk10
69
+ - openjdk11
70
+ - oraclejdk11
71
+ matrix:
72
+ fast_finish: true
73
+ exclude:
74
+ - rvm: rbx-2
75
+ jdk: openjdk7
76
+ - rvm: 2.0.0
77
+ jdk: openjdk7
78
+ - rvm: 2.1
79
+ jdk: openjdk7
80
+ - rvm: 2.2.5
81
+ jdk: openjdk7
82
+ - rvm: 2.3.1
83
+ jdk: openjdk7
84
+ - rvm: 2.4.0
85
+ jdk: openjdk7
86
+ - rvm: 2.5.0
87
+ jdk: openjdk7
88
+ - rvm: ruby-head
89
+ jdk: openjdk7
90
+ - rvm: rbx-2
91
+ jdk: oraclejdk8
92
+ - rvm: 2.0.0
93
+ jdk: oraclejdk8
94
+ - rvm: 2.1
95
+ jdk: oraclejdk8
96
+ - rvm: 2.2.5
97
+ jdk: oraclejdk8
98
+ - rvm: 2.3.1
99
+ jdk: oraclejdk8
100
+ - rvm: 2.4.0
101
+ jdk: oraclejdk8
102
+ - rvm: 2.5.0
103
+ jdk: oraclejdk8
104
+ - rvm: ruby-head
105
+ jdk: oraclejdk8
106
+ - rvm: rbx-2
107
+ jdk: oraclejdk10
108
+ - rvm: 2.0.0
109
+ jdk: oraclejdk10
110
+ - rvm: 2.1
111
+ jdk: oraclejdk10
112
+ - rvm: 2.2.5
113
+ jdk: oraclejdk10
114
+ - rvm: 2.3.1
115
+ jdk: oraclejdk10
116
+ - rvm: 2.4.0
117
+ jdk: oraclejdk10
118
+ - rvm: 2.5.0
119
+ jdk: oraclejdk10
120
+ - rvm: ruby-head
121
+ jdk: oraclejdk10
122
+ - rvm: rbx-2
123
+ jdk: openjdk10
124
+ - rvm: 2.0.0
125
+ jdk: openjdk10
126
+ - rvm: 2.1
127
+ jdk: openjdk10
128
+ - rvm: 2.2.5
129
+ jdk: openjdk10
130
+ - rvm: 2.3.1
131
+ jdk: openjdk10
132
+ - rvm: 2.4.0
133
+ jdk: openjdk10
134
+ - rvm: 2.5.0
135
+ jdk: openjdk10
136
+ - rvm: ruby-head
137
+ jdk: openjdk10
138
+ - rvm: rbx-2
139
+ jdk: oraclejdk11
140
+ - rvm: 2.0.0
141
+ jdk: oraclejdk11
142
+ - rvm: 2.1
143
+ jdk: oraclejdk11
144
+ - rvm: 2.2.5
145
+ jdk: oraclejdk11
146
+ - rvm: 2.3.1
147
+ jdk: oraclejdk11
148
+ - rvm: 2.4.0
149
+ jdk: oraclejdk11
150
+ - rvm: 2.5.0
151
+ jdk: oraclejdk11
152
+ - rvm: ruby-head
153
+ jdk: oraclejdk11
154
+ - rvm: rbx-2
155
+ jdk: openjdk11
156
+ - rvm: 2.0.0
157
+ jdk: openjdk11
158
+ - rvm: 2.1
159
+ jdk: openjdk11
160
+ - rvm: 2.2.5
161
+ jdk: openjdk11
162
+ - rvm: 2.3.1
163
+ jdk: openjdk11
164
+ - rvm: 2.4.0
165
+ jdk: openjdk11
166
+ - rvm: 2.5.0
167
+ jdk: openjdk11
168
+ - rvm: ruby-head
169
+ jdk: openjdk11
170
+ - rvm: jruby-9.2.0.0
171
+ jdk: openjdk7
172
+ - rvm: jruby-head
173
+ jdk: openjdk7
174
+ - rvm: 2.0.0
175
+ gemfile: gemfiles/rails5_1_4.gemfile
176
+ - rvm: 2.1
177
+ gemfile: gemfiles/rails5_1_4.gemfile
178
+ - rvm: 2.2.5
179
+ gemfile: gemfiles/rails5_1_4.gemfile
180
+ - rvm: ruby-head
181
+ gemfile: gemfiles/rails4.gemfile
182
+ - rvm: 2.0.0
183
+ gemfile: gemfiles/rails5_0.gemfile
184
+ - rvm: 2.1
185
+ gemfile: gemfiles/rails5_0.gemfile
186
+ - rvm: jruby-9.0.5.0
187
+ gemfile: gemfiles/rails5_1_4.gemfile
188
+ - rvm: 2.0.0
189
+ gemfile: gemfiles/rails5_2.gemfile
190
+ - rvm: 2.1
191
+ gemfile: gemfiles/rails5_2.gemfile
192
+ allow_failures:
193
+ - rvm: rbx-2
194
+ gemfile: gemfiles/rails4.gemfile
195
+ - rvm: rbx-2
196
+ gemfile: gemfiles/rails5_0.gemfile
197
+ - rvm: rbx-2
198
+ gemfile: gemfiles/rails5_1_4.gemfile
199
+ - rvm: rbx-2
200
+ gemfile: gemfiles/rails5_2.gemfile
201
+ - rvm: rbx-2
202
+ gemfile: gemfiles/rails5_1_4.gemfile
203
+ - rvm: jruby-9.0.5.0
204
+ gemfile: gemfiles/rails5_2.gemfile
205
+ - rvm: jruby-9.2.0.0
206
+ jdk: oraclejdk9
207
+ gemfile: gemfiles/rails5_2.gemfile
208
+ - jdk: openjdk10
209
+ - jdk: oraclejdk10
210
+ - jdk: openjdk11
211
+ - jdk: oraclejdk11
212
+ - rvm: ruby-head
213
+ - rvm: jruby-head
214
+ - rvm: jruby-9.2.0.0
215
+ jdk: oraclejdk9
216
+ - rvm: jruby-9.0.5.0
217
+ jdk: oraclejdk9
218
+ bundler_args: "--jobs 3 --retry 2"
219
+ notifications:
220
+ email:
221
+ notifications:
222
+ - julien.delporte@faveod.com
223
+ - yann.azoury@faveod.com