tb_core 1.3.10 → 1.4.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -20
  3. data/app/controllers/admin/application_controller.rb +2 -2
  4. data/app/controllers/admin/dashboard_controller.rb +4 -4
  5. data/app/controllers/admin/password_resets_controller.rb +9 -9
  6. data/app/controllers/admin/roles_controller.rb +8 -8
  7. data/app/controllers/admin/settings_controller.rb +11 -9
  8. data/app/controllers/admin/setup_controller.rb +5 -5
  9. data/app/controllers/admin/user_sessions_controller.rb +2 -2
  10. data/app/controllers/admin/users_controller.rb +13 -13
  11. data/app/controllers/password_resets_controller.rb +7 -7
  12. data/app/controllers/spud/admin/application_controller.rb +5 -1
  13. data/app/controllers/spud/application_controller.rb +15 -11
  14. data/app/controllers/user_sessions_controller.rb +11 -5
  15. data/app/helpers/admin/application_helper.rb +20 -14
  16. data/app/helpers/tb_core/application_helper.rb +20 -16
  17. data/app/mailers/tb_core_mailer.rb +9 -3
  18. data/app/models/spud/spud_user_model.rb +7 -13
  19. data/app/models/spud_role.rb +4 -4
  20. data/app/models/spud_user_setting.rb +2 -2
  21. data/config/routes.rb +3 -3
  22. data/lib/generators/spud/controller_spec_generator.rb +6 -3
  23. data/lib/generators/spud/module_generator.rb +56 -41
  24. data/lib/generators/spud/setup_generator.rb +26 -22
  25. data/lib/generators/spud/templates/admin_controller.rb.erb +9 -13
  26. data/lib/generators/spud/templates/controller.rb.erb +4 -6
  27. data/lib/generators/spud/templates/controller_spec.rb.erb +16 -21
  28. data/lib/generators/spud/templates/views/layouts/application.html.erb +1 -1
  29. data/lib/spud_core/catch_all_route.rb +1 -1
  30. data/lib/spud_core/configuration.rb +7 -3
  31. data/lib/spud_core/engine.rb +5 -18
  32. data/lib/spud_core/errors.rb +3 -4
  33. data/lib/spud_core/test_files.rb +3 -3
  34. data/lib/spud_core/version.rb +1 -1
  35. data/lib/tb_core/belongs_to_app.rb +6 -3
  36. data/lib/tb_core/form_builder.rb +40 -33
  37. data/lib/tb_core/responder.rb +2 -2
  38. data/lib/tb_core/test_helper.rb +2 -2
  39. data/spec/controllers/admin/application_controller_spec.rb +14 -14
  40. data/spec/controllers/admin/dashboard_controller_spec.rb +26 -23
  41. data/spec/controllers/admin/password_reset_controller_spec.rb +29 -30
  42. data/spec/controllers/admin/settings_controller_spec.rb +13 -13
  43. data/spec/controllers/admin/setup_controller_spec.rb +12 -12
  44. data/spec/controllers/admin/user_sessions_controller_spec.rb +3 -3
  45. data/spec/controllers/admin/users_controller_spec.rb +68 -65
  46. data/spec/controllers/spud/application_controller_spec.rb +1 -1
  47. data/spec/dummy/config/application.rb +6 -7
  48. data/spec/dummy/config/database.yml +7 -16
  49. data/spec/dummy/config/environments/production.rb +1 -1
  50. data/spec/dummy/config/environments/test.rb +5 -2
  51. data/spec/dummy/config/routes.rb +1 -1
  52. data/spec/dummy/db/schema.rb +53 -54
  53. data/spec/factories/spud_user_factories.rb +2 -2
  54. data/spec/helpers/spud/admin/application_helper_spec.rb +4 -4
  55. data/spec/lib/spud_core/configuration_spec.rb +2 -2
  56. data/spec/lib/tb_core/belongs_to_app_spec.rb +4 -4
  57. data/spec/models/spud_role_spec.rb +9 -9
  58. data/spec/models/spud_user_spec.rb +19 -32
  59. data/spec/rails_helper.rb +5 -6
  60. metadata +67 -77
  61. data/lib/responds_to_parent.rb +0 -69
  62. data/lib/tb_core/mysql2_extensions.rb +0 -45
  63. data/spec/dummy/db/migrate/20141214200804_create_spud_admin_permissions.tb_core.rb +0 -12
  64. data/spec/dummy/db/migrate/20141214200805_create_spud_users.tb_core.rb +0 -30
  65. data/spec/dummy/db/migrate/20141214200806_add_time_zone_to_spud_user.tb_core.rb +0 -7
  66. data/spec/dummy/db/migrate/20141214200807_add_scope_to_spud_admin_permissions.tb_core.rb +0 -7
  67. data/spec/dummy/db/migrate/20141214200808_create_spud_user_settings.tb_core.rb +0 -12
  68. data/spec/dummy/db/migrate/20141214200809_create_spud_roles.tb_core.rb +0 -11
  69. data/spec/dummy/db/migrate/20141214200810_create_spud_permissions.tb_core.rb +0 -11
  70. data/spec/dummy/db/migrate/20141214200811_create_spud_role_permissions.tb_core.rb +0 -12
  71. data/spec/dummy/db/migrate/20141214200812_drop_spud_admin_permissions.tb_core.rb +0 -16
  72. data/spec/dummy/db/migrate/20150610180845_add_requires_password_change_to_spud_users.tb_core.rb +0 -6
  73. data/spec/lib/tb_core/mysql2_extensions_spec.rb +0 -59
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 1.4.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2016-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.0
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: responders
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '2.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: authlogic
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.4.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.4.3
55
55
  - !ruby/object:Gem::Dependency
@@ -112,28 +112,28 @@ dependencies:
112
112
  name: will_paginate
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 3.0.7
117
+ version: '3.1'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 3.0.7
124
+ version: '3.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: will_paginate-bootstrap
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.0.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.0.1
139
139
  - !ruby/object:Gem::Dependency
@@ -142,26 +142,26 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '3.3'
145
+ version: 3.3.7
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '3.3'
152
+ version: 3.3.7
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: sass-rails
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '5.0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '5.0'
167
167
  - !ruby/object:Gem::Dependency
@@ -179,92 +179,106 @@ dependencies:
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: mysql2
182
+ name: pg
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - "<"
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: '0.4'
187
+ version: '0.15'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - "<"
192
+ - - ">="
193
193
  - !ruby/object:Gem::Version
194
- version: '0.4'
194
+ version: '0.15'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rspec-rails
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - "~>"
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: 3.1.0
201
+ version: '0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - "~>"
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rails-controller-testing
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
207
221
  - !ruby/object:Gem::Version
208
- version: 3.1.0
222
+ version: '0'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: factory_girl_rails
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
- - - "~>"
227
+ - - ">="
214
228
  - !ruby/object:Gem::Version
215
- version: 4.5.0
229
+ version: '0'
216
230
  type: :development
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
- - - "~>"
234
+ - - ">="
221
235
  - !ruby/object:Gem::Version
222
- version: 4.5.0
236
+ version: '0'
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: database_cleaner
225
239
  requirement: !ruby/object:Gem::Requirement
226
240
  requirements:
227
- - - "~>"
241
+ - - ">="
228
242
  - !ruby/object:Gem::Version
229
- version: 1.3.0
243
+ version: '0'
230
244
  type: :development
231
245
  prerelease: false
232
246
  version_requirements: !ruby/object:Gem::Requirement
233
247
  requirements:
234
- - - "~>"
248
+ - - ">="
235
249
  - !ruby/object:Gem::Version
236
- version: 1.3.0
250
+ version: '0'
237
251
  - !ruby/object:Gem::Dependency
238
252
  name: simplecov
239
253
  requirement: !ruby/object:Gem::Requirement
240
254
  requirements:
241
- - - "~>"
255
+ - - ">="
242
256
  - !ruby/object:Gem::Version
243
- version: 0.9.1
257
+ version: '0'
244
258
  type: :development
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
- - - "~>"
262
+ - - ">="
249
263
  - !ruby/object:Gem::Version
250
- version: 0.9.1
264
+ version: '0'
251
265
  - !ruby/object:Gem::Dependency
252
- name: shoulda
266
+ name: rubocop
253
267
  requirement: !ruby/object:Gem::Requirement
254
268
  requirements:
255
- - - "~>"
269
+ - - ">="
256
270
  - !ruby/object:Gem::Version
257
- version: 3.5.0
271
+ version: '0'
258
272
  type: :development
259
273
  prerelease: false
260
274
  version_requirements: !ruby/object:Gem::Requirement
261
275
  requirements:
262
- - - "~>"
276
+ - - ">="
263
277
  - !ruby/object:Gem::Version
264
- version: 3.5.0
278
+ version: '0'
265
279
  description: Twice Baked Core Engine
266
280
  email:
267
- - greg@westlakedesign.com
281
+ - greg.woods@moserit.com
268
282
  executables: []
269
283
  extensions: []
270
284
  extra_rdoc_files: []
@@ -395,7 +409,6 @@ files:
395
409
  - lib/generators/spud/templates/views/frontend/show.html.erb
396
410
  - lib/generators/spud/templates/views/layouts/application.html.erb
397
411
  - lib/generators/spud/templates/views/layouts/error_page.html.erb
398
- - lib/responds_to_parent.rb
399
412
  - lib/spud_core/catch_all_route.rb
400
413
  - lib/spud_core/configuration.rb
401
414
  - lib/spud_core/engine.rb
@@ -407,7 +420,6 @@ files:
407
420
  - lib/tb_core.rb
408
421
  - lib/tb_core/belongs_to_app.rb
409
422
  - lib/tb_core/form_builder.rb
410
- - lib/tb_core/mysql2_extensions.rb
411
423
  - lib/tb_core/responder.rb
412
424
  - lib/tb_core/test_helper.rb
413
425
  - spec/controllers/admin/application_controller_spec.rb
@@ -443,16 +455,6 @@ files:
443
455
  - spec/dummy/config/initializers/wrap_parameters.rb
444
456
  - spec/dummy/config/locales/en.yml
445
457
  - spec/dummy/config/routes.rb
446
- - spec/dummy/db/migrate/20141214200804_create_spud_admin_permissions.tb_core.rb
447
- - spec/dummy/db/migrate/20141214200805_create_spud_users.tb_core.rb
448
- - spec/dummy/db/migrate/20141214200806_add_time_zone_to_spud_user.tb_core.rb
449
- - spec/dummy/db/migrate/20141214200807_add_scope_to_spud_admin_permissions.tb_core.rb
450
- - spec/dummy/db/migrate/20141214200808_create_spud_user_settings.tb_core.rb
451
- - spec/dummy/db/migrate/20141214200809_create_spud_roles.tb_core.rb
452
- - spec/dummy/db/migrate/20141214200810_create_spud_permissions.tb_core.rb
453
- - spec/dummy/db/migrate/20141214200811_create_spud_role_permissions.tb_core.rb
454
- - spec/dummy/db/migrate/20141214200812_drop_spud_admin_permissions.tb_core.rb
455
- - spec/dummy/db/migrate/20150610180845_add_requires_password_change_to_spud_users.tb_core.rb
456
458
  - spec/dummy/db/schema.rb
457
459
  - spec/dummy/public/404.html
458
460
  - spec/dummy/public/422.html
@@ -465,12 +467,11 @@ files:
465
467
  - spec/helpers/spud/admin/application_helper_spec.rb
466
468
  - spec/lib/spud_core/configuration_spec.rb
467
469
  - spec/lib/tb_core/belongs_to_app_spec.rb
468
- - spec/lib/tb_core/mysql2_extensions_spec.rb
469
470
  - spec/models/spud_role_spec.rb
470
471
  - spec/models/spud_user_spec.rb
471
472
  - spec/rails_helper.rb
472
473
  - spec/spec_helper.rb
473
- homepage: http://bitbucket.org/westlakedesign/tb_core
474
+ homepage: http://bitbucket.org/moser-inc/tb_core
474
475
  licenses: []
475
476
  metadata: {}
476
477
  post_install_message:
@@ -484,12 +485,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
484
485
  version: '2.1'
485
486
  required_rubygems_version: !ruby/object:Gem::Requirement
486
487
  requirements:
487
- - - ">="
488
+ - - ">"
488
489
  - !ruby/object:Gem::Version
489
- version: '0'
490
+ version: 1.3.1
490
491
  requirements: []
491
492
  rubyforge_project:
492
- rubygems_version: 2.4.8
493
+ rubygems_version: 2.5.1
493
494
  signing_key:
494
495
  specification_version: 4
495
496
  summary: Twice Baked Core Engine
@@ -525,16 +526,6 @@ test_files:
525
526
  - spec/dummy/config/locales/en.yml
526
527
  - spec/dummy/config/routes.rb
527
528
  - spec/dummy/config.ru
528
- - spec/dummy/db/migrate/20141214200804_create_spud_admin_permissions.tb_core.rb
529
- - spec/dummy/db/migrate/20141214200805_create_spud_users.tb_core.rb
530
- - spec/dummy/db/migrate/20141214200806_add_time_zone_to_spud_user.tb_core.rb
531
- - spec/dummy/db/migrate/20141214200807_add_scope_to_spud_admin_permissions.tb_core.rb
532
- - spec/dummy/db/migrate/20141214200808_create_spud_user_settings.tb_core.rb
533
- - spec/dummy/db/migrate/20141214200809_create_spud_roles.tb_core.rb
534
- - spec/dummy/db/migrate/20141214200810_create_spud_permissions.tb_core.rb
535
- - spec/dummy/db/migrate/20141214200811_create_spud_role_permissions.tb_core.rb
536
- - spec/dummy/db/migrate/20141214200812_drop_spud_admin_permissions.tb_core.rb
537
- - spec/dummy/db/migrate/20150610180845_add_requires_password_change_to_spud_users.tb_core.rb
538
529
  - spec/dummy/db/schema.rb
539
530
  - spec/dummy/public/404.html
540
531
  - spec/dummy/public/422.html
@@ -549,7 +540,6 @@ test_files:
549
540
  - spec/helpers/spud/admin/application_helper_spec.rb
550
541
  - spec/lib/spud_core/configuration_spec.rb
551
542
  - spec/lib/tb_core/belongs_to_app_spec.rb
552
- - spec/lib/tb_core/mysql2_extensions_spec.rb
553
543
  - spec/models/spud_role_spec.rb
554
544
  - spec/models/spud_user_spec.rb
555
545
  - spec/rails_helper.rb
@@ -1,69 +0,0 @@
1
- # Copyright (c) 2006 Sean Treadway
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining
4
- # a copy of this software and associated documentation files (the
5
- # "Software"), to deal in the Software without restriction, including
6
- # without limitation the rights to use, copy, modify, merge, publish,
7
- # distribute, sublicense, and/or sell copies of the Software, and to
8
- # permit persons to whom the Software is furnished to do so, subject to
9
- # the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be
12
- # included in all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-
22
-
23
- # Module containing the methods useful for child IFRAME to parent window communication
24
- module RespondsToParent
25
-
26
- # Executes the response body as JavaScript in the context of the parent window.
27
- # Use this method of you are posting a form to a hidden IFRAME or if you would like
28
- # to use IFRAME base RPC.
29
- def responds_to_parent(&block)
30
- yield
31
-
32
- if performed?
33
- # We're returning HTML instead of JS or XML now
34
- response.headers['Content-Type'] = 'text/html; charset=UTF-8'
35
-
36
- # Either pull out a redirect or the request body
37
- script = if response.headers['Location']
38
- #TODO: erase_redirect_results is missing in rails 3.0 has to be implemented
39
- # erase redirect
40
- "document.location.href = #{location.to_s.inspect}"
41
- else
42
- response.body
43
- end
44
-
45
- # Escape quotes, linebreaks and slashes, maintaining previously escaped slashes
46
- # Suggestions for improvement?
47
- script = (script || '').
48
- gsub('\\', '\\\\\\').
49
- gsub(/\r\n|\r|\n/, '\\n').
50
- gsub(/['"]/, '\\\\\&').
51
- gsub('</script>','</scr"+"ipt>')
52
-
53
- # Clear out the previous render to prevent double render
54
- response.request.env['action_controller.instance'].instance_variable_set(:@_response_body, nil)
55
-
56
- # Eval in parent scope and replace document location of this frame
57
- # so back button doesn't replay action on targeted forms
58
- # loc = document.location to be set after parent is updated for IE
59
- # with(window.parent) - pull in variables from parent window
60
- # setTimeout - scope the execution in the windows parent for safari
61
- # window.eval - legal eval for Opera
62
- render :text => "<html><body><script type='text/javascript' charset='utf-8'>
63
- var loc = document.location;
64
- with(window.parent) { setTimeout(function() { window.eval('#{script}'); if (typeof(loc) !== 'undefined') loc.replace('about:blank'); }, 1) };
65
- </script></body></html>".html_safe
66
- end
67
- end
68
- alias respond_to_parent responds_to_parent
69
- end
@@ -1,45 +0,0 @@
1
- module TbCore::Mysql2Extensions
2
-
3
- # Create a new table
4
- #
5
- def create_table(table_name, options = {})
6
- if @connection.query_options[:encoding] == 'utf8mb4'
7
- super(table_name, options.reverse_merge(:options => 'ROW_FORMAT=DYNAMIC ENGINE=InnoDB'))
8
- else
9
- super
10
- end
11
- end
12
-
13
- # Build a hash of length options for a given table and column name
14
- #
15
- # column_name can be either a symbol or an array of symbols
16
- #
17
- def length_options_for_utf8mb4_string_index(table_name, column_names)
18
- length_options = {}
19
- column_names = [column_names] unless column_names.is_a?(Array)
20
- column_names.each do |column_name|
21
- begin
22
- column = column_for(table_name, column_name)
23
- if column && column.type == :string
24
- length_options[column_name] = ActiveRecord::ConnectionAdapters::Mysql2Adapter::MAX_INDEX_LENGTH_FOR_UTF8MB4
25
- end
26
- rescue ActiveRecord::ActiveRecordError => e
27
- logger.info e.message
28
- end
29
- end
30
- return length_options
31
- end
32
-
33
- # Adds an index to the table
34
- #
35
- # See parent method implementation here:
36
- # http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_index
37
- #
38
- def add_index(table_name, column_name, options = {})
39
- if options[:length].nil? && @connection.query_options[:encoding] == 'utf8mb4'
40
- options[:length] = length_options_for_utf8mb4_string_index(table_name, column_name)
41
- end
42
- super(table_name, column_name, options)
43
- end
44
-
45
- end
@@ -1,12 +0,0 @@
1
- # This migration comes from tb_core (originally 20111214161011)
2
- class CreateSpudAdminPermissions < ActiveRecord::Migration
3
- def change
4
- create_table :spud_admin_permissions do |t|
5
- t.integer :user_id
6
- t.string :name
7
- t.boolean :access
8
-
9
- t.timestamps
10
- end
11
- end
12
- end
@@ -1,30 +0,0 @@
1
- # This migration comes from tb_core (originally 20111214161146)
2
- class CreateSpudUsers < ActiveRecord::Migration
3
- def change
4
- create_table :spud_users do |t|
5
-
6
- t.string :first_name
7
- t.string :last_name
8
- t.boolean :super_admin
9
- t.string :login, :null => false # optional, you can use email instead, or both
10
- t.string :email, :null => false # optional, you can use login instead, or both
11
- t.string :crypted_password, :null => false # optional, see below
12
- t.string :password_salt, :null => false # optional, but highly recommended
13
- t.string :persistence_token, :null => false # required
14
- t.string :single_access_token, :null => false # optional, see Authlogic::Session::Params
15
- t.string :perishable_token, :null => false # optional, see Authlogic::Session::Perishability
16
-
17
- # Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
18
- t.integer :login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
19
- t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
20
- t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
21
- t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
22
- t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
23
- t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
24
- t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
25
- t.timestamps
26
- end
27
- add_index :spud_users,:login
28
- add_index :spud_users,:email
29
- end
30
- end
@@ -1,7 +0,0 @@
1
- # This migration comes from tb_core (originally 20120327124229)
2
- class AddTimeZoneToSpudUser < ActiveRecord::Migration
3
- def change
4
- add_column :spud_users, :time_zone, :string
5
-
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # This migration comes from tb_core (originally 20120328235431)
2
- class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
3
- def change
4
- add_column :spud_admin_permissions, :scope, :string
5
-
6
- end
7
- end
@@ -1,12 +0,0 @@
1
- # This migration comes from tb_core (originally 20120329174000)
2
- class CreateSpudUserSettings < ActiveRecord::Migration
3
- def change
4
- create_table :spud_user_settings do |t|
5
- t.integer :spud_user_id
6
- t.string :key
7
- t.string :value
8
-
9
- t.timestamps
10
- end
11
- end
12
- end
@@ -1,11 +0,0 @@
1
- # This migration comes from tb_core (originally 20130620143010)
2
- class CreateSpudRoles < ActiveRecord::Migration
3
- def change
4
- create_table :spud_roles do |t|
5
- t.string :name
6
- t.timestamps
7
- end
8
- add_column :spud_users, :spud_role_id, :integer
9
- add_index :spud_users, :spud_role_id
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # This migration comes from tb_core (originally 20130620143941)
2
- class CreateSpudPermissions < ActiveRecord::Migration
3
- def change
4
- create_table :spud_permissions do |t|
5
- t.string :name, :null => false
6
- t.string :tag, :null => false
7
- t.timestamps
8
- end
9
- add_index :spud_permissions, :tag, :unique => true
10
- end
11
- end
@@ -1,12 +0,0 @@
1
- # This migration comes from tb_core (originally 20130620151132)
2
- class CreateSpudRolePermissions < ActiveRecord::Migration
3
- def change
4
- create_table :spud_role_permissions do |t|
5
- t.integer :spud_role_id, :null => false
6
- t.string :spud_permission_tag, :null => false
7
- t.timestamps
8
- end
9
- add_index :spud_role_permissions, :spud_role_id
10
- add_index :spud_role_permissions, :spud_permission_tag
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- # This migration comes from tb_core (originally 20130620163144)
2
- class DropSpudAdminPermissions < ActiveRecord::Migration
3
- def up
4
- drop_table :spud_admin_permissions
5
- end
6
-
7
- def down
8
- create_table :spud_admin_permissions do |t|
9
- t.integer :user_id
10
- t.string :name
11
- t.boolean :access
12
- t.string :scope
13
- t.timestamps
14
- end
15
- end
16
- end
@@ -1,6 +0,0 @@
1
- # This migration comes from tb_core (originally 20150610143438)
2
- class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration
3
- def change
4
- add_column :spud_users, :requires_password_change, :boolean, :default => false
5
- end
6
- end
@@ -1,59 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe TbCore::Mysql2Extensions do
4
-
5
- let(:adapter){
6
- SpudUser.connection
7
- }
8
-
9
- describe '#create_table' do
10
- before(:each){
11
- allow_any_instance_of(ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter).to receive(:create_table) do |abstract_adapter, table_name, arguments|
12
- arguments[:options]
13
- end
14
- }
15
-
16
- it 'should pass the dynamic option' do
17
- options = adapter.create_table(:tests)
18
- expect(options).to match('ROW_FORMAT=DYNAMIC')
19
- end
20
- end
21
-
22
- describe '#length_options_for_utf8mb4_string_index' do
23
- it 'should return a hash with a single value' do
24
- options = adapter.length_options_for_utf8mb4_string_index(:spud_users, :first_name)
25
- expect(options).to eq({:first_name => 191})
26
- end
27
-
28
- it 'should return a hash with multiple values' do
29
- options = adapter.length_options_for_utf8mb4_string_index(:spud_users, [:first_name, :last_name])
30
- expect(options[:first_name]).to eq(191)
31
- expect(options[:last_name]).to eq(191)
32
- end
33
-
34
- it 'should not assign a length for a non-string column' do
35
- options = adapter.length_options_for_utf8mb4_string_index(:spud_users, [:first_name, :last_name, :super_admin])
36
- expect(options[:super_admin]).to eq(nil)
37
- end
38
- end
39
-
40
- describe '#add_index' do
41
- before(:each){
42
- # Mock the add_index method to simply return the options hash rather than adding an index, so that we can inspect the contents of options
43
- allow_any_instance_of(ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter).to receive(:add_index) do |abstract_adapter, table_name, column_name, options|
44
- options
45
- end
46
- }
47
-
48
- it 'should pass a length option' do
49
- options = adapter.add_index(:spud_users, :first_name)
50
- expect(options[:length]).to eq({:first_name => 191})
51
- end
52
-
53
- it 'should not override the given length option' do
54
- options = adapter.add_index(:spud_users, :first_name, :length => 20)
55
- expect(options[:length]).to eq(20)
56
- end
57
- end
58
-
59
- end