glib-web 6.10.2 → 7.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/auth/policy.rb +1 -5
  3. data/app/helpers/glib/json_ui/action_builder/bottom_banners.rb +0 -1
  4. data/app/helpers/glib/json_ui/action_builder/components.rb +1 -16
  5. data/app/helpers/glib/json_ui/action_builder/logics.rb +1 -2
  6. data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -16
  7. data/app/helpers/glib/json_ui/response_helper.rb +0 -12
  8. data/app/helpers/glib/json_ui/view_builder/fields.rb +4 -86
  9. data/app/views/json_ui/garage/actions/_components.json.jbuilder +2 -2
  10. data/app/views/json_ui/garage/forms/bulk_edit_post.json.jbuilder +1 -1
  11. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +3 -3
  12. data/app/views/json_ui/garage/forms/selects.json.jbuilder +5 -5
  13. data/app/views/json_ui/garage/forms/update_options.json.jbuilder +1 -1
  14. data/app/views/json_ui/garage/panels/flow.json.jbuilder +6 -6
  15. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +10 -10
  16. data/app/views/json_ui/garage/panels/responsive.json.jbuilder +10 -10
  17. data/app/views/json_ui/garage/panels/ul.json.jbuilder +2 -2
  18. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +10 -10
  19. data/app/views/json_ui/garage/tables/bulk_edit.json.jbuilder +8 -8
  20. data/app/views/json_ui/garage/test_page/calendar.json.jbuilder +6 -6
  21. data/app/views/json_ui/garage/test_page/carousel.json.jbuilder +4 -4
  22. data/app/views/json_ui/garage/test_page/charts.json.jbuilder +4 -4
  23. data/app/views/json_ui/garage/test_page/column.json.jbuilder +3 -3
  24. data/app/views/json_ui/garage/test_page/components.json.jbuilder +7 -7
  25. data/app/views/json_ui/garage/test_page/custom.json.jbuilder +3 -3
  26. data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +0 -21
  27. data/app/views/json_ui/garage/test_page/fields_creditCard.json.jbuilder +6 -6
  28. data/app/views/json_ui/garage/test_page/fields_date_time.json.jbuilder +8 -8
  29. data/app/views/json_ui/garage/test_page/fields_dynamicSelect.json.jbuilder +8 -8
  30. data/app/views/json_ui/garage/test_page/fields_location.json.jbuilder +6 -6
  31. data/app/views/json_ui/garage/test_page/fields_otp.json.jbuilder +8 -8
  32. data/app/views/json_ui/garage/test_page/fields_phone.json.jbuilder +9 -9
  33. data/app/views/json_ui/garage/test_page/fields_radio.json.jbuilder +4 -4
  34. data/app/views/json_ui/garage/test_page/fields_rating.json.jbuilder +10 -10
  35. data/app/views/json_ui/garage/test_page/fields_richText.json.jbuilder +10 -10
  36. data/app/views/json_ui/garage/test_page/fields_select.json.jbuilder +8 -8
  37. data/app/views/json_ui/garage/test_page/fields_sign.json.jbuilder +8 -56
  38. data/app/views/json_ui/garage/test_page/fields_stripeExternalAccount.json.jbuilder +6 -6
  39. data/app/views/json_ui/garage/test_page/fields_stripeToken.json.jbuilder +6 -6
  40. data/app/views/json_ui/garage/test_page/fields_text.json.jbuilder +5 -5
  41. data/app/views/json_ui/garage/test_page/fields_timer.json.jbuilder +6 -6
  42. data/app/views/json_ui/garage/test_page/flow.json.jbuilder +6 -6
  43. data/app/views/json_ui/garage/test_page/form.json.jbuilder +9 -9
  44. data/app/views/json_ui/garage/test_page/grid.json.jbuilder +4 -4
  45. data/app/views/json_ui/garage/test_page/horizontal.json.jbuilder +5 -5
  46. data/app/views/json_ui/garage/test_page/image.json.jbuilder +9 -9
  47. data/app/views/json_ui/garage/test_page/lifecycle.json.jbuilder +6 -6
  48. data/app/views/json_ui/garage/test_page/list.json.jbuilder +6 -6
  49. data/app/views/json_ui/garage/test_page/multimedia_docx.json.jbuilder +5 -5
  50. data/app/views/json_ui/garage/test_page/multimedia_video.json.jbuilder +6 -6
  51. data/app/views/json_ui/garage/test_page/pagination.json.jbuilder +6 -6
  52. data/app/views/json_ui/garage/test_page/panels_bulkEdit2.json.jbuilder +13 -13
  53. data/app/views/json_ui/garage/test_page/panels_bulkEdit3.json.jbuilder +1 -1
  54. data/app/views/json_ui/garage/test_page/progressCircle.json.jbuilder +8 -8
  55. data/app/views/json_ui/garage/test_page/responsive.json.jbuilder +4 -4
  56. data/app/views/json_ui/garage/test_page/scroll.json.jbuilder +5 -5
  57. data/app/views/json_ui/garage/test_page/split.json.jbuilder +1 -1
  58. data/app/views/json_ui/garage/test_page/table.json.jbuilder +5 -5
  59. data/app/views/json_ui/garage/test_page/timeline.json.jbuilder +5 -5
  60. data/app/views/json_ui/garage/test_page/ul.json.jbuilder +4 -4
  61. data/app/views/json_ui/garage/test_page/vertical.json.jbuilder +5 -5
  62. data/app/views/json_ui/garage/test_page/web.json.jbuilder +5 -5
  63. data/app/views/json_ui/garage/views/_expand_shrink_ex.json.jbuilder +4 -4
  64. data/app/views/json_ui/garage/views/controls.json.jbuilder +4 -4
  65. data/app/views/json_ui/garage/views/{components_set.json.jbuilder → logics_set.json.jbuilder} +2 -2
  66. data/lib/glib/engine.rb +0 -32
  67. data/lib/glib/json_crawler/router.rb +0 -24
  68. data/lib/glib/json_ui/config.rb +1 -1
  69. data/lib/glib/test/changed_files_rubocop.rb +55 -0
  70. data/lib/glib/test_helpers.rb +6 -9
  71. metadata +5 -35
  72. data/app/controllers/concerns/glib/auth/token_authenticatable.rb +0 -37
  73. data/app/controllers/glib/api_controller.rb +0 -52
  74. data/app/jobs/glib/purge_unattached_job.rb +0 -28
  75. data/app/models/concerns/glib/snapshot_v2.rb +0 -462
  76. data/app/models/glib/model.rb +0 -40
  77. data/app/models/glib/plain_model.rb +0 -23
  78. data/app/models/snapshot_blob_reference.rb +0 -20
  79. data/lib/generators/glib/snapshot_v2_generator.rb +0 -54
  80. data/lib/generators/templates/snapshot_v2/add_snapshot_v2_columns.rb +0 -18
  81. data/lib/generators/templates/snapshot_v2/create_snapshot_blob_references.rb +0 -10
  82. data/lib/glib/test/full_suite_rubocop.rb +0 -87
  83. data/lib/glib/test/rubocop_guards.rb +0 -42
@@ -53,21 +53,21 @@ page.body(
53
53
  flow.button(
54
54
  text: 'Compact style',
55
55
  onClick: ->(action) do
56
- action.components_set targetId: 'table_main', data: { styleClass: 'table--compact' }
56
+ action.logics_set targetId: 'table_main', data: { styleClass: 'table--compact' }
57
57
  end
58
58
  )
59
59
  flow.spacer width: 4
60
60
  flow.button(
61
61
  text: 'Striped style',
62
62
  onClick: ->(action) do
63
- action.components_set targetId: 'table_main', data: { styleClass: 'table--striped' }
63
+ action.logics_set targetId: 'table_main', data: { styleClass: 'table--striped' }
64
64
  end
65
65
  )
66
66
  flow.spacer width: 4
67
67
  flow.button(
68
68
  text: 'Clear style',
69
69
  onClick: ->(action) do
70
- action.components_set targetId: 'table_main', data: { styleClass: nil }
70
+ action.logics_set targetId: 'table_main', data: { styleClass: nil }
71
71
  end
72
72
  )
73
73
  end
@@ -85,10 +85,10 @@ page.body(
85
85
  scroll.panels_table(
86
86
  height: 'matchParent',
87
87
  onScrollToTop: ->(action) do
88
- action.components_set targetId: 'table_event_status', data: { text: 'Scroll events: top reached' }
88
+ action.logics_set targetId: 'table_event_status', data: { text: 'Scroll events: top reached' }
89
89
  end,
90
90
  onScrollToBottom: ->(action) do
91
- action.components_set targetId: 'table_event_status', data: { text: 'Scroll events: bottom reached' }
91
+ action.logics_set targetId: 'table_event_status', data: { text: 'Scroll events: bottom reached' }
92
92
  end,
93
93
  sections: [
94
94
  ->(section) do
@@ -44,25 +44,25 @@ page.body(
44
44
  flow.button(
45
45
  text: 'Vertical',
46
46
  onClick: ->(action) do
47
- action.components_set targetId: 'timeline_main', data: { direction: 'vertical', side: 'start', truncateLine: nil }
47
+ action.logics_set targetId: 'timeline_main', data: { direction: 'vertical', side: 'start', truncateLine: nil }
48
48
  end
49
49
  )
50
50
  flow.spacer width: 4
51
51
  flow.button(
52
52
  text: 'Horizontal',
53
53
  onClick: ->(action) do
54
- action.components_set targetId: 'timeline_main', data: { direction: 'horizontal', side: 'end', truncateLine: nil }
54
+ action.logics_set targetId: 'timeline_main', data: { direction: 'horizontal', side: 'end', truncateLine: nil }
55
55
  end
56
56
  )
57
57
  flow.spacer width: 4
58
58
  # flow.button text: 'Outlined dots', onClick: ->(action) do
59
- # action.components_set targetId: 'timeline_main', data: { events: outline_events }
59
+ # action.logics_set targetId: 'timeline_main', data: { events: outline_events }
60
60
  # end
61
61
  # flow.spacer width: 4
62
62
  flow.button(
63
63
  text: 'Truncate both',
64
64
  onClick: ->(action) do
65
- action.components_set targetId: 'timeline_main', data: { truncateLine: 'both' }
65
+ action.logics_set targetId: 'timeline_main', data: { truncateLine: 'both' }
66
66
  end
67
67
  )
68
68
  end
@@ -80,7 +80,7 @@ page.body(
80
80
  timeline.label(
81
81
  text: step,
82
82
  onClick: ->(action) do
83
- action.components_set targetId: 'timeline_action_status', data: { text: "Clicked: #{step}" }
83
+ action.logics_set targetId: 'timeline_action_status', data: { text: "Clicked: #{step}" }
84
84
  end
85
85
  )
86
86
  end
@@ -28,11 +28,11 @@ page.body childViews: ->(body) do
28
28
  res.spacer height: 8
29
29
  res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
30
30
  flow.button text: 'Card style', onClick: ->(action) do
31
- action.components_set targetId: 'ul_main', data: { styleClasses: ['card'], padding: { all: 10 } }
31
+ action.logics_set targetId: 'ul_main', data: { styleClasses: ['card'], padding: { all: 10 } }
32
32
  end
33
33
  flow.spacer width: 4
34
34
  flow.button text: 'Clear style', onClick: ->(action) do
35
- action.components_set targetId: 'ul_main', data: { styleClasses: nil, padding: nil }
35
+ action.logics_set targetId: 'ul_main', data: { styleClasses: nil, padding: nil }
36
36
  end
37
37
  end
38
38
 
@@ -44,9 +44,9 @@ page.body childViews: ->(body) do
44
44
  res.label id: 'ul_action_status', text: 'Hover status: idle'
45
45
  res.spacer height: 6
46
46
  res.panels_ul onMouseEnter: ->(action) do
47
- action.components_set targetId: 'ul_action_status', data: { text: 'Hover status: entered' }
47
+ action.logics_set targetId: 'ul_action_status', data: { text: 'Hover status: entered' }
48
48
  end, onMouseLeave: ->(action) do
49
- action.components_set targetId: 'ul_action_status', data: { text: 'Hover status: left' }
49
+ action.logics_set targetId: 'ul_action_status', data: { text: 'Hover status: left' }
50
50
  end, childViews: ->(li) do
51
51
  li.label text: 'Hover this list'
52
52
  li.label text: 'Second item'
@@ -28,19 +28,19 @@ page.body childViews: ->(body) do
28
28
  res.spacer height: 8
29
29
  res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
30
30
  flow.button text: 'Fill equally', onClick: ->(action) do
31
- action.components_set targetId: 'vertical_main', data: { height: 180, distribution: 'fillEqually' }
31
+ action.logics_set targetId: 'vertical_main', data: { height: 180, distribution: 'fillEqually' }
32
32
  end
33
33
  flow.spacer width: 4
34
34
  flow.button text: 'Space equally', onClick: ->(action) do
35
- action.components_set targetId: 'vertical_main', data: { height: 180, distribution: 'spaceEqually' }
35
+ action.logics_set targetId: 'vertical_main', data: { height: 180, distribution: 'spaceEqually' }
36
36
  end
37
37
  flow.spacer width: 4
38
38
  flow.button text: 'Align center', onClick: ->(action) do
39
- action.components_set targetId: 'vertical_main', data: { align: 'center' }
39
+ action.logics_set targetId: 'vertical_main', data: { align: 'center' }
40
40
  end
41
41
  flow.spacer width: 4
42
42
  flow.button text: 'Align right', onClick: ->(action) do
43
- action.components_set targetId: 'vertical_main', data: { align: 'right' }
43
+ action.logics_set targetId: 'vertical_main', data: { align: 'right' }
44
44
  end
45
45
  end
46
46
 
@@ -52,7 +52,7 @@ page.body childViews: ->(body) do
52
52
  res.label id: 'vertical_action_status', text: 'Click status: idle'
53
53
  res.spacer height: 6
54
54
  res.panels_vertical width: 160, height: 60, align: 'center', backgroundColor: '#e6e6e6', onClick: ->(action) do
55
- action.components_set targetId: 'vertical_action_status', data: { text: 'Click status: clicked' }
55
+ action.logics_set targetId: 'vertical_action_status', data: { text: 'Click status: clicked' }
56
56
  end, childViews: ->(panel) do
57
57
  panel.label text: 'Click panel'
58
58
  end
@@ -27,19 +27,19 @@ page.body childViews: ->(body) do
27
27
  res.spacer height: 8
28
28
  res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
29
29
  flow.button text: 'PDF', onClick: ->(action) do
30
- action.components_set targetId: 'web_main', data: { url: url_primary }
30
+ action.logics_set targetId: 'web_main', data: { url: url_primary }
31
31
  end
32
32
  flow.spacer width: 4
33
33
  flow.button text: 'Example.com', onClick: ->(action) do
34
- action.components_set targetId: 'web_main', data: { url: url_alt }
34
+ action.logics_set targetId: 'web_main', data: { url: url_alt }
35
35
  end
36
36
  flow.spacer width: 4
37
37
  flow.button text: 'Short height', onClick: ->(action) do
38
- action.components_set targetId: 'web_main', data: { height: 180 }
38
+ action.logics_set targetId: 'web_main', data: { height: 180 }
39
39
  end
40
40
  flow.spacer width: 4
41
41
  flow.button text: 'Tall height', onClick: ->(action) do
42
- action.components_set targetId: 'web_main', data: { height: 360 }
42
+ action.logics_set targetId: 'web_main', data: { height: 360 }
43
43
  end
44
44
  end
45
45
 
@@ -51,7 +51,7 @@ page.body childViews: ->(body) do
51
51
  res.label id: 'web_action_status', text: 'Load status: idle'
52
52
  res.spacer height: 6
53
53
  res.panels_web width: 'matchParent', height: 200, url: url_alt, onLoad: ->(action) do
54
- action.components_set targetId: 'web_action_status', data: { text: 'Load status: loaded' }
54
+ action.logics_set targetId: 'web_action_status', data: { text: 'Load status: loaded' }
55
55
  end
56
56
 
57
57
  res.spacer height: 12
@@ -6,8 +6,8 @@ view.panels_responsive width: 'matchParent', childViews: ->(res) do
6
6
  flow.label text: title
7
7
  flow.icon name: 'arrow_drop_down', size: 20, onClick: ->(action) do
8
8
  action.runMultiple childActions: ->(saction) do
9
- saction.components_set targetId: "#{id}-expand", data: { displayed: true }
10
- saction.components_set targetId: "#{id}-shrink", data: { displayed: false }
9
+ saction.logics_set targetId: "#{id}-expand", data: { displayed: true }
10
+ saction.logics_set targetId: "#{id}-shrink", data: { displayed: false }
11
11
  end
12
12
  end
13
13
  end
@@ -18,8 +18,8 @@ view.panels_responsive width: 'matchParent', childViews: ->(res) do
18
18
  flow.label text: title
19
19
  flow.icon name: 'arrow_drop_up', size: 20, onClick: ->(action) do
20
20
  action.runMultiple childActions: ->(saction) do
21
- saction.components_set targetId: "#{id}-shrink", data: { displayed: true }
22
- saction.components_set targetId: "#{id}-expand", data: { displayed: false }
21
+ saction.logics_set targetId: "#{id}-shrink", data: { displayed: true }
22
+ saction.logics_set targetId: "#{id}-expand", data: { displayed: false }
23
23
  end
24
24
  end
25
25
  end
@@ -112,8 +112,8 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
112
112
  id: 'default',
113
113
  onMouseEnter: ->(action) {
114
114
  action.runMultiple childActions: ->(saction) do
115
- saction.components_set targetId: 'default', data: { displayed: false }
116
- saction.components_set targetId: 'hovered', data: { displayed: true }
115
+ saction.logics_set targetId: 'default', data: { displayed: false }
116
+ saction.logics_set targetId: 'hovered', data: { displayed: true }
117
117
  end
118
118
  }
119
119
  scroll.button \
@@ -122,8 +122,8 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
122
122
  displayed: false,
123
123
  onMouseLeave: ->(action) {
124
124
  action.runMultiple childActions: ->(saction) do
125
- saction.components_set targetId: 'default', data: { displayed: true }
126
- saction.components_set targetId: 'hovered', data: { displayed: false }
125
+ saction.logics_set targetId: 'default', data: { displayed: true }
126
+ saction.logics_set targetId: 'hovered', data: { displayed: false }
127
127
  end
128
128
  }, onClick: ->(action) do
129
129
  action.dialogs_alert message: 'Perform action'
@@ -9,7 +9,7 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
9
9
  res.label id: 'label', text: 'Hello world!'
10
10
  res.spacer height: 8
11
11
  res.button text: 'set', onClick: ->(action) do
12
- action.components_set targetId: 'label', data: { text: 'Hello too!' }, onSet: ->(saction) do
12
+ action.logics_set targetId: 'label', data: { text: 'Hello too!' }, onSet: ->(saction) do
13
13
  saction.snackbars_alert styleClasses: ['success'], message: 'Changed!'
14
14
  end
15
15
  end
@@ -23,7 +23,7 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
23
23
  form.spacer height: 8
24
24
  form.panels_horizontal childViews: ->(hori) do
25
25
  hori.button text: 'set', onClick: ->(action) do
26
- action.components_set targetId: 'ftext', data: { name: 'user[city]', value: 'Taipei', label: 'City', placeholder: 'City' }
26
+ action.logics_set targetId: 'ftext', data: { name: 'user[city]', value: 'Taipei', label: 'City', placeholder: 'City' }
27
27
  end
28
28
  hori.spacer width: 4
29
29
  hori.fields_submit text: 'submit'
data/lib/glib/engine.rb CHANGED
@@ -22,32 +22,6 @@ module Glib
22
22
  scope :created_desc, -> { order(created_at: :desc, id: :desc) }
23
23
  end
24
24
 
25
- # Cascade-destroy blob references when a snapshot is destroyed (e.g. by max_snapshots
26
- # retention in Glib::SnapshotV2#remove_old_snapshot). Without this, the FK on
27
- # snapshot_blob_references would raise PG::ForeignKeyViolation.
28
- #
29
- # Opt-in: only consumers who run the gem's `create_snapshot_blob_references` migration
30
- # have the table. The connection+table_exists? guard (wrapped in a rescue for boot
31
- # sequences with no DB reachable — `rails db:create`, parallel test setup, and DB-less
32
- # build containers like docker's `assets:precompile`) makes this a no-op for everyone
33
- # else, so a bare `include Glib::SnapshotV2` never crashes a boot.
34
- unless respond_to?(:snapshot_blob_references)
35
- begin
36
- if connection.table_exists?(:snapshot_blob_references)
37
- has_many :snapshot_blob_references, dependent: :destroy
38
- end
39
- rescue ActiveRecord::NoDatabaseError, ActiveRecord::StatementInvalid,
40
- ActiveRecord::ConnectionNotEstablished => e
41
- # NoDatabaseError/StatementInvalid: the server exists but the database doesn't yet
42
- # (e.g. `rails db:create`). ConnectionNotEstablished: no server reachable at all —
43
- # e.g. docker build's assets:precompile, where DATABASE_HOST is unset and pg falls
44
- # back to the local socket. The association gets re-registered on the next
45
- # successful boot that finds the table. Warn (stderr, not the app log) so the
46
- # breadcrumb lands in build/boot logs regardless of the configured log level.
47
- warn "[glib-web] snapshot_blob_references association not registered (#{e.class}) — no DB reachable at boot"
48
- end
49
- end
50
-
51
25
  # Parses the stored diff into a flat hash of Change structs:
52
26
  # { 'item' => [Change, ...], 'association_name' => [Change, ...], ... }
53
27
  # Returns an empty structure if no diff exists (e.g. the first snapshot).
@@ -119,13 +93,7 @@ module Glib
119
93
 
120
94
  private
121
95
  # Item-level change: from/to are scalar column values. Cast each to the column's real type.
122
- #
123
- # `index` is normalized to a Symbol so consumers compare against symbol literals
124
- # (matching AR attribute keys, e.g. `change.index == :title`). Association-level
125
- # changes are NOT symbolized — their index is a collection position from a path like
126
- # "[0]", a positional digit, not a name.
127
96
  def cast_item_change(change, root)
128
- change.index = change.index.to_sym
129
97
  change.from = cast_column_value(root, change.index, change.from)
130
98
  change.to = cast_column_value(root, change.index, change.to)
131
99
  change
@@ -3,7 +3,6 @@ require 'damerau-levenshtein'
3
3
  module Glib
4
4
  module JsonCrawler
5
5
  class Router
6
- attr_reader :read_only_actions # deprecated
7
6
  attr_reader :logger, :last_log, :deferred_actions
8
7
  attr_reader :http_actions
9
8
  attr_accessor :host, :skip_similar_page
@@ -55,7 +54,6 @@ module Glib
55
54
  @depth = -1
56
55
  @logger = ''
57
56
  @visitor = Glib::Json::Traversal::Visitor.new(crawler_test: true)
58
- @read_only_actions = Set.new
59
57
  @http_actions = Set.new
60
58
  # default rails's development host
61
59
  @host ||= 'localhost:3000'
@@ -94,7 +92,6 @@ module Glib
94
92
  end
95
93
  end
96
94
 
97
- # @read_only_actions.replace(@read_only_actions.sort_by { |e| e[1].to_s })
98
95
  end
99
96
 
100
97
  def process_action(http, spec)
@@ -116,14 +113,12 @@ module Glib
116
113
  # of the word, not a separator), so the normalized name missed this
117
114
  # branch and the crawl logged the entry without ever executing it.
118
115
  when 'initiate/navigation'
119
- # @read_only_actions.add([action, params['url']])
120
116
  http_actions.add([action, params['url']])
121
117
  JsonCrawler::NavInitiate.new(http, params, action)
122
118
  when 'runMultiple'
123
119
  JsonCrawler::RunMultiple.new(http, params, action)
124
120
  when 'windows/open', 'dialogs/open', 'windows/reload', 'windows/openWeb'
125
121
  if allowed?(params['url'])
126
- # @read_only_actions.add([action, params['url']])
127
122
  http_actions.add([action, params['url']])
128
123
  JsonCrawler::WindowsOpen.new(http, params, action)
129
124
  else
@@ -168,7 +163,6 @@ module Glib
168
163
  ].include?(
169
164
  action
170
165
  )
171
- # @read_only_actions.add([action, params['url']])
172
166
  http_actions.add([action, params['url']])
173
167
  end
174
168
  self.log action, params['url']
@@ -181,24 +175,6 @@ module Glib
181
175
  @visitor.forms.last
182
176
  end
183
177
 
184
- # deprecated
185
- # def follow(http, target_routers)
186
- # if !target_routers.is_a?(Array)
187
- # target_routers = [target_routers]
188
- # end
189
-
190
- # target_actions = Set.new
191
- # target_routers.each do |router|
192
- # target_actions += router.read_only_actions
193
- # end
194
-
195
- # @depth += 1
196
- # target_actions.each do |crawler_action|
197
- # action, url = crawler_action
198
- # http.get(url, action, {})
199
- # end
200
- # end
201
-
202
178
  def follow_v2(http, crawler_actions)
203
179
  @depth += 1
204
180
  crawler_actions.each do |crawler_action|
@@ -19,7 +19,7 @@ module Glib
19
19
 
20
20
  # The shipped default. Stays '/' until the next major version, when it
21
21
  # becomes '_'. Apps opt in early via `Config.name_separator = '_'`.
22
- DEFAULT_NAME_SEPARATOR = '/'
22
+ DEFAULT_NAME_SEPARATOR = '_'
23
23
 
24
24
  @@name_separator = DEFAULT_NAME_SEPARATOR
25
25
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'English'
4
+ require 'shellwords'
5
+
6
+ module Glib
7
+ module Test
8
+ # Fast RuboCop guard for the subset-run workflow.
9
+ #
10
+ # Lives in glib-web's test helper so any project that includes
11
+ # `Glib::TestHelpers` into `ActiveSupport::TestCase` picks it up. Minitest
12
+ # runs all loaded test classes on every invocation, so this fires on every
13
+ # `rails test` — but it lints ONLY the files you have changed in the
14
+ # working tree (unstaged + staged + untracked). That keeps it fast and
15
+ # fails the run the moment an edited file has an offense.
16
+ #
17
+ # Skip with `SKIP_CHANGED_RUBOCOP=1` during tight debug loops. Auto-skips
18
+ # on CI because gem caches put thousands of vendored `.rb` files into the
19
+ # working tree (the "working-tree diff == your edits" premise breaks).
20
+ class ChangedFilesRubocop < ::ActiveSupport::TestCase
21
+ # Extensions RuboCop targets by default (see its AllCops/Include). We
22
+ # rely on `--force-exclusion` to honour the project's AllCops/Exclude.
23
+ RUBOCOP_EXTENSIONS = %w[.rb .rake .jbuilder .gemspec].freeze
24
+
25
+ def test_changed_files_are_rubocop_clean
26
+ skip 'opted out via SKIP_CHANGED_RUBOCOP' if ENV['SKIP_CHANGED_RUBOCOP'] == '1'
27
+ skip 'CI lints every file separately; this guard is for local working-tree edits' if ENV['CI']
28
+
29
+ files = changed_ruby_files
30
+ # IMPORTANT: never call rubocop with zero paths — it would lint the whole repo.
31
+ skip 'no changed Ruby files in the working tree' if files.empty?
32
+
33
+ output = `bundle exec rubocop --force-exclusion --format simple #{files.shelljoin} 2>&1`
34
+
35
+ assert(
36
+ $CHILD_STATUS.success?,
37
+ 'RuboCop offenses in files you changed (fix them with `rubocop -a`):' \
38
+ "\n\n#{output}"
39
+ )
40
+ end
41
+
42
+ private
43
+ def changed_ruby_files
44
+ # `git status --porcelain` covers unstaged, staged, and untracked in
45
+ # one spawn. Each line is `XY PATH` (or `XY ORIG -> PATH` for
46
+ # renames); PATH starts at index 3. Deleted files are dropped by the
47
+ # File.file? check below (no on-disk entry to lint).
48
+ `git status --porcelain`
49
+ .split("\n")
50
+ .filter_map { |line| line[3..]&.split(' -> ')&.last }
51
+ .select { |path| RUBOCOP_EXTENSIONS.include?(File.extname(path)) && File.file?(path) }
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,18 +1,15 @@
1
- # The suite-time RuboCop guard (FullSuiteRubocop) is NOT auto-loaded by this
2
- # module: it runs `rubocop -a` and rewrites files, so switching it on is a
3
- # conscious per-project opt-in (`include Glib::Test::RubocopGuards`). Requiring
4
- # rubocop_guards here only DEFINES that inert module — nothing runs until a
5
- # project explicitly includes it — and doing so at file level (this file is
6
- # required when the gem loads) means the include works anywhere, with no
7
- # dependency on Glib::TestHelpers being included first.
8
- require 'glib/test/rubocop_guards'
9
-
10
1
  module Glib
11
2
  module TestHelpers
12
3
  extend ActiveSupport::Concern
13
4
 
14
5
  included do
15
6
  extend ClassMethods
7
+
8
+ # Auto-load ChangedFilesRubocop only when this module is mixed into a
9
+ # test class. AllHelpers also includes Glib::TestHelpers into view
10
+ # helper modules in production controllers; in that context
11
+ # ActiveSupport::TestCase is not loaded, so we skip the require.
12
+ require 'glib/test/changed_files_rubocop' if defined?(::ActiveSupport::TestCase)
16
13
  end
17
14
 
18
15
  module ClassMethods
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.2
4
+ version: 7.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-09-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activestorage
@@ -24,20 +23,6 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '8.0'
27
- - !ruby/object:Gem::Dependency
28
- name: activejob
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '8.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '8.0'
41
26
  - !ruby/object:Gem::Dependency
42
27
  name: pundit
43
28
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +177,6 @@ dependencies:
192
177
  - - ">="
193
178
  - !ruby/object:Gem::Version
194
179
  version: '0'
195
- description:
196
180
  email: ''
197
181
  executables: []
198
182
  extensions: []
@@ -205,7 +189,6 @@ files:
205
189
  - app/controllers/concerns/glib/analytics/funnel.rb
206
190
  - app/controllers/concerns/glib/auth/policy.rb
207
191
  - app/controllers/concerns/glib/auth/response.rb
208
- - app/controllers/concerns/glib/auth/token_authenticatable.rb
209
192
  - app/controllers/concerns/glib/form_stepper/controller.rb
210
193
  - app/controllers/concerns/glib/form_stepper/step.rb
211
194
  - app/controllers/concerns/glib/json/dynamic_text.rb
@@ -216,7 +199,6 @@ files:
216
199
  - app/controllers/concerns/glib/json/ui.rb
217
200
  - app/controllers/concerns/glib/json/validation.rb
218
201
  - app/controllers/concerns/glib/params/allowlist.rb
219
- - app/controllers/glib/api_controller.rb
220
202
  - app/controllers/glib/blob_url_generators_controller.rb
221
203
  - app/controllers/glib/errors_controller.rb
222
204
  - app/controllers/glib/glib_direct_uploads_controller.rb
@@ -267,11 +249,9 @@ files:
267
249
  - app/helpers/glib/json_ui/view_builder/multimedia.rb
268
250
  - app/helpers/glib/json_ui/view_builder/panels.rb
269
251
  - app/helpers/glib/urls_helper.rb
270
- - app/jobs/glib/purge_unattached_job.rb
271
252
  - app/models/concerns/glib/enum_humanization.rb
272
253
  - app/models/concerns/glib/enum_symbolization.rb
273
254
  - app/models/concerns/glib/nilify_blanks.rb
274
- - app/models/concerns/glib/snapshot_v2.rb
275
255
  - app/models/concerns/glib/soft_deletable.rb
276
256
  - app/models/glib/active_storage/attachment.rb
277
257
  - app/models/glib/active_storage/blob.rb
@@ -279,11 +259,8 @@ files:
279
259
  - app/models/glib/country_list.rb
280
260
  - app/models/glib/dummy_job_application.rb
281
261
  - app/models/glib/dynamic_text_record.rb
282
- - app/models/glib/model.rb
283
- - app/models/glib/plain_model.rb
284
262
  - app/models/glib/state_list.rb
285
263
  - app/models/glib/text.rb
286
- - app/models/snapshot_blob_reference.rb
287
264
  - app/policies/glib/application_policy.rb
288
265
  - app/validators/email_typo_validator.rb
289
266
  - app/validators/email_validator.rb
@@ -528,7 +505,6 @@ files:
528
505
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder
529
506
  - app/views/json_ui/garage/views/charts.json.jbuilder
530
507
  - app/views/json_ui/garage/views/components_replace.json.jbuilder
531
- - app/views/json_ui/garage/views/components_set.json.jbuilder
532
508
  - app/views/json_ui/garage/views/controls.json.jbuilder
533
509
  - app/views/json_ui/garage/views/fields_focus.json.jbuilder
534
510
  - app/views/json_ui/garage/views/iap.json.jbuilder
@@ -537,6 +513,7 @@ files:
537
513
  - app/views/json_ui/garage/views/images.json.jbuilder
538
514
  - app/views/json_ui/garage/views/index.json.jbuilder
539
515
  - app/views/json_ui/garage/views/links.json.jbuilder
516
+ - app/views/json_ui/garage/views/logics_set.json.jbuilder
540
517
  - app/views/json_ui/garage/views/map_cluster_data.json.jbuilder
541
518
  - app/views/json_ui/garage/views/map_data.json.jbuilder
542
519
  - app/views/json_ui/garage/views/map_direction_data.json.jbuilder
@@ -555,15 +532,12 @@ files:
555
532
  - config/routes.rb
556
533
  - lib/active_storage/service/glib_s3_service.rb
557
534
  - lib/generators/glib/install_generator.rb
558
- - lib/generators/glib/snapshot_v2_generator.rb
559
535
  - lib/generators/templates/20191017062519_create_texts.rb
560
536
  - lib/generators/templates/20191024063257_add_scope_to_texts.rb
561
537
  - lib/generators/templates/20191112095018_add_lang_to_texts.rb
562
538
  - lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb
563
539
  - lib/generators/templates/database.yml
564
540
  - lib/generators/templates/dynamic_text.rb
565
- - lib/generators/templates/snapshot_v2/add_snapshot_v2_columns.rb
566
- - lib/generators/templates/snapshot_v2/create_snapshot_blob_references.rb
567
541
  - lib/glib-web.rb
568
542
  - lib/glib/all_helpers.rb
569
543
  - lib/glib/crypt/utils.rb
@@ -597,18 +571,15 @@ files:
597
571
  - lib/glib/rubocop/cops/localize.rb
598
572
  - lib/glib/rubocop/cops/test_name_parentheses.rb
599
573
  - lib/glib/snapshot.rb
600
- - lib/glib/test/full_suite_rubocop.rb
574
+ - lib/glib/test/changed_files_rubocop.rb
601
575
  - lib/glib/test/parallel_coverage.rb
602
- - lib/glib/test/rubocop_guards.rb
603
576
  - lib/glib/test_helpers.rb
604
577
  - lib/glib/time_freezable_mailer.rb
605
578
  - lib/glib/time_returning_mailer.rb
606
579
  - lib/glib/value.rb
607
580
  - lib/tasks/db.rake
608
- homepage:
609
581
  licenses: []
610
582
  metadata: {}
611
- post_install_message:
612
583
  rdoc_options: []
613
584
  require_paths:
614
585
  - lib
@@ -623,8 +594,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
623
594
  - !ruby/object:Gem::Version
624
595
  version: '0'
625
596
  requirements: []
626
- rubygems_version: 3.4.6
627
- signing_key:
597
+ rubygems_version: 4.0.16
628
598
  specification_version: 4
629
599
  summary: ''
630
600
  test_files: []
@@ -1,37 +0,0 @@
1
- module Glib::Auth
2
- # Bearer-token authentication for machine-facing APIs. The token's storage column and
3
- # the user model are app-specific, so the lookup is a template method the app's base
4
- # controller implements (return the user for a valid token, nil otherwise).
5
- module TokenAuthenticatable
6
- extend ActiveSupport::Concern
7
-
8
- # Public to mirror the browser side, where Devise's current_user is public: glib
9
- # hands policies the controller (Glib::ApplicationPolicy#controller), and host-app
10
- # policies call these with an EXPLICIT receiver (`controller.current_user`,
11
- # `delegate :user_signed_in?, to: :controller`). A private current_user would raise
12
- # NoMethodError on the API line only -- the two surfaces must behave the same.
13
- def current_user
14
- @current_user
15
- end
16
-
17
- # Provided by Devise's helpers on the browser side; defined here so glib policies
18
- # that delegate it to the controller work unchanged on API controllers.
19
- def user_signed_in?
20
- current_user.present?
21
- end
22
-
23
- private
24
- def authenticate_api_token!
25
- token = request.headers['Authorization'].to_s.sub(/\ABearer\s+/i, '')
26
- @current_user = glib_find_user_by_api_token(token) if token.present?
27
- return if @current_user
28
-
29
- render json: { error: 'unauthorized' }, status: :unauthorized
30
- end
31
-
32
- # App implements: return the user for a valid token, nil otherwise.
33
- def glib_find_user_by_api_token(_token)
34
- raise NotImplementedError, "#{self.class} must define glib_find_user_by_api_token(token)"
35
- end
36
- end
37
- end