phraseapp-in-context-editor-ruby 1.4.0 → 3.2.0

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 (123) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +18 -0
  3. data/.github/workflows/close_inactive_issues.yml +18 -0
  4. data/.github/workflows/release.yml +36 -0
  5. data/.github/workflows/test.yml +8 -9
  6. data/.gitignore +1 -1
  7. data/.tool-versions +1 -1
  8. data/CHANGELOG.md +28 -79
  9. data/CODEOWNERS +1 -0
  10. data/Gemfile +1 -1
  11. data/Gemfile.lock +244 -0
  12. data/Guardfile +13 -13
  13. data/README.md +96 -51
  14. data/RELEASING.md +3 -0
  15. data/docs/CHANGELOG.md +116 -0
  16. data/examples/demo/.gitattributes +7 -0
  17. data/examples/demo/.gitignore +35 -0
  18. data/examples/demo/Gemfile +74 -0
  19. data/examples/demo/Gemfile.lock +268 -0
  20. data/examples/demo/README.md +5 -0
  21. data/examples/demo/Rakefile +6 -0
  22. data/examples/demo/app/assets/config/manifest.js +4 -0
  23. data/examples/demo/app/assets/images/.keep +0 -0
  24. data/examples/demo/app/assets/stylesheets/application.css +15 -0
  25. data/examples/demo/app/channels/application_cable/channel.rb +4 -0
  26. data/examples/demo/app/channels/application_cable/connection.rb +4 -0
  27. data/examples/demo/app/controllers/application_controller.rb +2 -0
  28. data/examples/demo/app/controllers/concerns/.keep +0 -0
  29. data/examples/demo/app/controllers/main_controller.rb +4 -0
  30. data/examples/demo/app/helpers/application_helper.rb +2 -0
  31. data/examples/demo/app/helpers/main_helper.rb +2 -0
  32. data/examples/demo/app/javascript/application.js +3 -0
  33. data/examples/demo/app/javascript/controllers/application.js +9 -0
  34. data/examples/demo/app/javascript/controllers/hello_controller.js +7 -0
  35. data/examples/demo/app/javascript/controllers/index.js +11 -0
  36. data/examples/demo/app/jobs/application_job.rb +7 -0
  37. data/examples/demo/app/mailers/application_mailer.rb +4 -0
  38. data/examples/demo/app/models/application_record.rb +3 -0
  39. data/examples/demo/app/models/concerns/.keep +0 -0
  40. data/examples/demo/app/views/layouts/application.html.erb +17 -0
  41. data/examples/demo/app/views/layouts/mailer.html.erb +13 -0
  42. data/examples/demo/app/views/layouts/mailer.text.erb +1 -0
  43. data/examples/demo/app/views/main/index.html.erb +8 -0
  44. data/examples/demo/bin/bundle +109 -0
  45. data/examples/demo/bin/importmap +4 -0
  46. data/examples/demo/bin/rails +4 -0
  47. data/examples/demo/bin/rake +4 -0
  48. data/examples/demo/bin/setup +33 -0
  49. data/examples/demo/config/application.rb +22 -0
  50. data/examples/demo/config/boot.rb +4 -0
  51. data/examples/demo/config/cable.yml +10 -0
  52. data/examples/demo/config/credentials.yml.enc +1 -0
  53. data/examples/demo/config/database.yml +25 -0
  54. data/examples/demo/config/environment.rb +5 -0
  55. data/examples/demo/config/environments/development.rb +70 -0
  56. data/examples/demo/config/environments/production.rb +93 -0
  57. data/examples/demo/config/environments/test.rb +60 -0
  58. data/examples/demo/config/importmap.rb +7 -0
  59. data/examples/demo/config/initializers/assets.rb +12 -0
  60. data/examples/demo/config/initializers/content_security_policy.rb +25 -0
  61. data/examples/demo/config/initializers/filter_parameter_logging.rb +8 -0
  62. data/examples/demo/config/initializers/inflections.rb +16 -0
  63. data/examples/demo/config/initializers/permissions_policy.rb +11 -0
  64. data/examples/demo/config/initializers/phraseapp_in_context_editor.rb +20 -0
  65. data/examples/demo/config/locales/en.yml +38 -0
  66. data/examples/demo/config/puma.rb +43 -0
  67. data/examples/demo/config/routes.rb +6 -0
  68. data/examples/demo/config/storage.yml +34 -0
  69. data/examples/demo/config.ru +6 -0
  70. data/examples/demo/db/seeds.rb +7 -0
  71. data/examples/demo/lib/assets/.keep +0 -0
  72. data/examples/demo/lib/tasks/.keep +0 -0
  73. data/examples/demo/log/.keep +0 -0
  74. data/examples/demo/public/404.html +67 -0
  75. data/examples/demo/public/422.html +67 -0
  76. data/examples/demo/public/500.html +66 -0
  77. data/examples/demo/public/apple-touch-icon-precomposed.png +0 -0
  78. data/examples/demo/public/apple-touch-icon.png +0 -0
  79. data/examples/demo/public/favicon.ico +0 -0
  80. data/examples/demo/public/robots.txt +1 -0
  81. data/examples/demo/storage/.keep +0 -0
  82. data/examples/demo/test/application_system_test_case.rb +5 -0
  83. data/examples/demo/test/channels/application_cable/connection_test.rb +11 -0
  84. data/examples/demo/test/controllers/.keep +0 -0
  85. data/examples/demo/test/controllers/main_controller_test.rb +8 -0
  86. data/examples/demo/test/fixtures/files/.keep +0 -0
  87. data/examples/demo/test/helpers/.keep +0 -0
  88. data/examples/demo/test/integration/.keep +0 -0
  89. data/examples/demo/test/mailers/.keep +0 -0
  90. data/examples/demo/test/models/.keep +0 -0
  91. data/examples/demo/test/system/.keep +0 -0
  92. data/examples/demo/test/test_helper.rb +13 -0
  93. data/examples/demo/tmp/.keep +0 -0
  94. data/examples/demo/tmp/pids/.keep +0 -0
  95. data/examples/demo/tmp/storage/.keep +0 -0
  96. data/examples/demo/vendor/.keep +0 -0
  97. data/examples/demo/vendor/javascript/.keep +0 -0
  98. data/lib/generators/phraseapp_in_context_editor/install_generator.rb +3 -9
  99. data/lib/generators/phraseapp_in_context_editor/templates/phraseapp_in_context_editor.rb +10 -14
  100. data/lib/phraseapp-in-context-editor-ruby/adapters/fast_gettext.rb +20 -20
  101. data/lib/phraseapp-in-context-editor-ruby/adapters/i18n.rb +10 -10
  102. data/lib/phraseapp-in-context-editor-ruby/backend_service.rb +23 -125
  103. data/lib/phraseapp-in-context-editor-ruby/config.rb +14 -49
  104. data/lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb +13 -15
  105. data/lib/phraseapp-in-context-editor-ruby/delegate/i18n_delegate.rb +6 -52
  106. data/lib/phraseapp-in-context-editor-ruby/delegate.rb +13 -14
  107. data/lib/phraseapp-in-context-editor-ruby/engine.rb +5 -6
  108. data/lib/phraseapp-in-context-editor-ruby/version.rb +2 -4
  109. data/lib/phraseapp-in-context-editor-ruby/view_helpers.rb +26 -19
  110. data/lib/phraseapp-in-context-editor-ruby.rb +17 -48
  111. data/package-lock.json +6576 -0
  112. data/package.json +13 -0
  113. data/phraseapp-in-context-editor-ruby.gemspec +19 -32
  114. data/release.config.js +10 -0
  115. metadata +113 -97
  116. data/lib/generators/phraseapp_in_context_editor/templates/README +0 -10
  117. data/lib/phraseapp-in-context-editor-ruby/api_collection.rb +0 -41
  118. data/lib/phraseapp-in-context-editor-ruby/api_wrapper.rb +0 -59
  119. data/lib/phraseapp-in-context-editor-ruby/cache.rb +0 -37
  120. data/lib/phraseapp-in-context-editor-ruby/displayable_key_identifier.rb +0 -46
  121. data/lib/phraseapp-in-context-editor-ruby/fallback_keys_fetcher.rb +0 -44
  122. data/lib/phraseapp-in-context-editor-ruby/hash_flattener.rb +0 -53
  123. data/lib/phraseapp-in-context-editor-ruby/key_names_cache.rb +0 -53
@@ -0,0 +1,268 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ phraseapp-in-context-editor-ruby (2.0.0)
5
+ i18n (>= 1.0)
6
+ json (>= 2.0)
7
+ request_store (>= 1.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (7.0.7.2)
13
+ actionpack (= 7.0.7.2)
14
+ activesupport (= 7.0.7.2)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ actionmailbox (7.0.7.2)
18
+ actionpack (= 7.0.7.2)
19
+ activejob (= 7.0.7.2)
20
+ activerecord (= 7.0.7.2)
21
+ activestorage (= 7.0.7.2)
22
+ activesupport (= 7.0.7.2)
23
+ mail (>= 2.7.1)
24
+ net-imap
25
+ net-pop
26
+ net-smtp
27
+ actionmailer (7.0.7.2)
28
+ actionpack (= 7.0.7.2)
29
+ actionview (= 7.0.7.2)
30
+ activejob (= 7.0.7.2)
31
+ activesupport (= 7.0.7.2)
32
+ mail (~> 2.5, >= 2.5.4)
33
+ net-imap
34
+ net-pop
35
+ net-smtp
36
+ rails-dom-testing (~> 2.0)
37
+ actionpack (7.0.7.2)
38
+ actionview (= 7.0.7.2)
39
+ activesupport (= 7.0.7.2)
40
+ rack (~> 2.0, >= 2.2.4)
41
+ rack-test (>= 0.6.3)
42
+ rails-dom-testing (~> 2.0)
43
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
44
+ actiontext (7.0.7.2)
45
+ actionpack (= 7.0.7.2)
46
+ activerecord (= 7.0.7.2)
47
+ activestorage (= 7.0.7.2)
48
+ activesupport (= 7.0.7.2)
49
+ globalid (>= 0.6.0)
50
+ nokogiri (>= 1.8.5)
51
+ actionview (7.0.7.2)
52
+ activesupport (= 7.0.7.2)
53
+ builder (~> 3.1)
54
+ erubi (~> 1.4)
55
+ rails-dom-testing (~> 2.0)
56
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
+ activejob (7.0.7.2)
58
+ activesupport (= 7.0.7.2)
59
+ globalid (>= 0.3.6)
60
+ activemodel (7.0.7.2)
61
+ activesupport (= 7.0.7.2)
62
+ activerecord (7.0.7.2)
63
+ activemodel (= 7.0.7.2)
64
+ activesupport (= 7.0.7.2)
65
+ activestorage (7.0.7.2)
66
+ actionpack (= 7.0.7.2)
67
+ activejob (= 7.0.7.2)
68
+ activerecord (= 7.0.7.2)
69
+ activesupport (= 7.0.7.2)
70
+ marcel (~> 1.0)
71
+ mini_mime (>= 1.1.0)
72
+ activesupport (7.0.7.2)
73
+ concurrent-ruby (~> 1.0, >= 1.0.2)
74
+ i18n (>= 1.6, < 2)
75
+ minitest (>= 5.1)
76
+ tzinfo (~> 2.0)
77
+ addressable (2.8.5)
78
+ public_suffix (>= 2.0.2, < 6.0)
79
+ autoprefixer-rails (10.4.13.0)
80
+ execjs (~> 2)
81
+ bindex (0.8.1)
82
+ bootsnap (1.16.0)
83
+ msgpack (~> 1.2)
84
+ bootstrap-sass (3.2.0.4)
85
+ sass (~> 3.2)
86
+ builder (3.2.4)
87
+ capybara (3.39.2)
88
+ addressable
89
+ matrix
90
+ mini_mime (>= 0.1.3)
91
+ nokogiri (~> 1.8)
92
+ rack (>= 1.6.0)
93
+ rack-test (>= 0.6.3)
94
+ regexp_parser (>= 1.5, < 3.0)
95
+ xpath (~> 3.2)
96
+ concurrent-ruby (1.2.2)
97
+ crass (1.0.6)
98
+ date (3.3.3)
99
+ debug (1.8.0)
100
+ irb (>= 1.5.0)
101
+ reline (>= 0.3.1)
102
+ erubi (1.12.0)
103
+ execjs (2.8.1)
104
+ ffi (1.15.5)
105
+ globalid (1.2.0)
106
+ activesupport (>= 6.1)
107
+ i18n (1.14.1)
108
+ concurrent-ruby (~> 1.0)
109
+ importmap-rails (1.2.1)
110
+ actionpack (>= 6.0.0)
111
+ railties (>= 6.0.0)
112
+ io-console (0.6.0)
113
+ irb (1.8.0)
114
+ rdoc (~> 6.5)
115
+ reline (>= 0.3.6)
116
+ jbuilder (2.11.5)
117
+ actionview (>= 5.0.0)
118
+ activesupport (>= 5.0.0)
119
+ json (2.6.3)
120
+ loofah (2.21.3)
121
+ crass (~> 1.0.2)
122
+ nokogiri (>= 1.12.0)
123
+ mail (2.8.1)
124
+ mini_mime (>= 0.1.1)
125
+ net-imap
126
+ net-pop
127
+ net-smtp
128
+ marcel (1.0.2)
129
+ matrix (0.4.2)
130
+ method_source (1.0.0)
131
+ mini_mime (1.1.5)
132
+ minitest (5.19.0)
133
+ msgpack (1.7.2)
134
+ net-imap (0.3.7)
135
+ date
136
+ net-protocol
137
+ net-pop (0.1.2)
138
+ net-protocol
139
+ net-protocol (0.2.1)
140
+ timeout
141
+ net-smtp (0.3.3)
142
+ net-protocol
143
+ nio4r (2.5.9)
144
+ nokogiri (1.15.4-arm64-darwin)
145
+ racc (~> 1.4)
146
+ psych (5.1.0)
147
+ stringio
148
+ public_suffix (5.0.3)
149
+ puma (5.6.7)
150
+ nio4r (~> 2.0)
151
+ racc (1.7.1)
152
+ rack (2.2.8)
153
+ rack-test (2.1.0)
154
+ rack (>= 1.3)
155
+ rails (7.0.7.2)
156
+ actioncable (= 7.0.7.2)
157
+ actionmailbox (= 7.0.7.2)
158
+ actionmailer (= 7.0.7.2)
159
+ actionpack (= 7.0.7.2)
160
+ actiontext (= 7.0.7.2)
161
+ actionview (= 7.0.7.2)
162
+ activejob (= 7.0.7.2)
163
+ activemodel (= 7.0.7.2)
164
+ activerecord (= 7.0.7.2)
165
+ activestorage (= 7.0.7.2)
166
+ activesupport (= 7.0.7.2)
167
+ bundler (>= 1.15.0)
168
+ railties (= 7.0.7.2)
169
+ rails-dom-testing (2.2.0)
170
+ activesupport (>= 5.0.0)
171
+ minitest
172
+ nokogiri (>= 1.6)
173
+ rails-html-sanitizer (1.6.0)
174
+ loofah (~> 2.21)
175
+ nokogiri (~> 1.14)
176
+ railties (7.0.7.2)
177
+ actionpack (= 7.0.7.2)
178
+ activesupport (= 7.0.7.2)
179
+ method_source
180
+ rake (>= 12.2)
181
+ thor (~> 1.0)
182
+ zeitwerk (~> 2.5)
183
+ rake (13.0.6)
184
+ rb-fsevent (0.11.2)
185
+ rb-inotify (0.10.1)
186
+ ffi (~> 1.0)
187
+ rdoc (6.5.0)
188
+ psych (>= 4.0.0)
189
+ regexp_parser (2.8.1)
190
+ reline (0.3.8)
191
+ io-console (~> 0.5)
192
+ request_store (1.5.1)
193
+ rack (>= 1.4)
194
+ rexml (3.2.6)
195
+ rubyzip (2.3.2)
196
+ sass (3.7.4)
197
+ sass-listen (~> 4.0.0)
198
+ sass-listen (4.0.0)
199
+ rb-fsevent (~> 0.9, >= 0.9.4)
200
+ rb-inotify (~> 0.9, >= 0.9.7)
201
+ selenium-webdriver (4.10.0)
202
+ rexml (~> 3.2, >= 3.2.5)
203
+ rubyzip (>= 1.2.2, < 3.0)
204
+ websocket (~> 1.0)
205
+ sprockets (4.2.0)
206
+ concurrent-ruby (~> 1.0)
207
+ rack (>= 2.2.4, < 4)
208
+ sprockets-rails (3.4.2)
209
+ actionpack (>= 5.2)
210
+ activesupport (>= 5.2)
211
+ sprockets (>= 3.0.0)
212
+ sqlite3 (1.6.4-arm64-darwin)
213
+ stimulus-rails (1.2.2)
214
+ railties (>= 6.0.0)
215
+ stringio (3.0.8)
216
+ thor (1.2.2)
217
+ timeout (0.4.0)
218
+ turbo-rails (1.4.0)
219
+ actionpack (>= 6.0.0)
220
+ activejob (>= 6.0.0)
221
+ railties (>= 6.0.0)
222
+ tzinfo (2.0.6)
223
+ concurrent-ruby (~> 1.0)
224
+ web-console (4.2.0)
225
+ actionview (>= 6.0.0)
226
+ activemodel (>= 6.0.0)
227
+ bindex (>= 0.4.0)
228
+ railties (>= 6.0.0)
229
+ webdrivers (5.3.1)
230
+ nokogiri (~> 1.6)
231
+ rubyzip (>= 1.3.0)
232
+ selenium-webdriver (~> 4.0, < 4.11)
233
+ websocket (1.2.9)
234
+ websocket-driver (0.7.6)
235
+ websocket-extensions (>= 0.1.0)
236
+ websocket-extensions (0.1.5)
237
+ xpath (3.2.0)
238
+ nokogiri (~> 1.8)
239
+ zeitwerk (2.6.11)
240
+
241
+ PLATFORMS
242
+ arm64-darwin-22
243
+
244
+ DEPENDENCIES
245
+ autoprefixer-rails
246
+ bootsnap
247
+ bootstrap-sass (~> 3.2.0)
248
+ capybara
249
+ debug
250
+ importmap-rails
251
+ jbuilder
252
+ phraseapp-in-context-editor-ruby!
253
+ puma (~> 5.0)
254
+ rails (~> 7.0.7, >= 7.0.7.2)
255
+ selenium-webdriver
256
+ sprockets-rails
257
+ sqlite3 (~> 1.4)
258
+ stimulus-rails
259
+ turbo-rails
260
+ tzinfo-data
261
+ web-console
262
+ webdrivers
263
+
264
+ RUBY VERSION
265
+ ruby 3.2.1p31
266
+
267
+ BUNDLED WITH
268
+ 2.4.19
@@ -0,0 +1,5 @@
1
+ # README
2
+
3
+ To demo ICE, run
4
+ `rails s` and navigate to `http://127.0.0.1:3000`
5
+ Login via the demo credentials `demo@phrase.com` / `phrase`
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link_tree ../../javascript .js
4
+ //= link_tree ../../../vendor/javascript .js
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ class MainController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module MainHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2
+ import "@hotwired/turbo-rails"
3
+ import "controllers"
@@ -0,0 +1,9 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ export { application }
@@ -0,0 +1,7 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.textContent = "Hello World!"
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ // Import and register all your controllers from the importmap under controllers/*
2
+
3
+ import { application } from "controllers/application"
4
+
5
+ // Eager load all controllers defined in the import map under controllers/**/*_controller
6
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7
+ eagerLoadControllersFrom("controllers", application)
8
+
9
+ // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10
+ // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11
+ // lazyLoadControllersFrom("controllers", application)
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: "from@example.com"
3
+ layout "mailer"
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
File without changes
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Demo</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload", nonce: true %>
10
+ <%= javascript_importmap_tags %>
11
+ <%= load_in_context_editor %>
12
+ </head>
13
+
14
+ <body>
15
+ <%= yield %>
16
+ </body>
17
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,8 @@
1
+ <h2 class="text-center">This is a simple demo of the Ruby integration gem for the In-Context Editor</h2>
2
+ <b>Find me in app/views/main/index.html.erb</b>
3
+ <p><%= t('hero_title') %></p>
4
+ <p><%= t('advantages_text') %></p>
5
+ <p><%= t('integrate_title') %></p>
6
+ <p><%= t('create_this_key') %></p>
7
+ <p><%= t('integrate_text') %></p>
8
+ <p><%= t('variable_text', variable: "<b>BigText</b>") %></p>
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version ||
66
+ cli_arg_version ||
67
+ bundler_requirement_for(lockfile_version)
68
+ end
69
+
70
+ def bundler_requirement_for(version)
71
+ return "#{Gem::Requirement.default}.a" unless version
72
+
73
+ bundler_gem_version = Gem::Version.new(version)
74
+
75
+ bundler_gem_version.approximate_recommendation
76
+ end
77
+
78
+ def load_bundler!
79
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
80
+
81
+ activate_bundler
82
+ end
83
+
84
+ def activate_bundler
85
+ gem_error = activation_error_handling do
86
+ gem "bundler", bundler_requirement
87
+ end
88
+ return if gem_error.nil?
89
+ require_error = activation_error_handling do
90
+ require "bundler/version"
91
+ end
92
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
93
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
94
+ exit 42
95
+ end
96
+
97
+ def activation_error_handling
98
+ yield
99
+ nil
100
+ rescue StandardError, LoadError => e
101
+ e
102
+ end
103
+ end
104
+
105
+ m.load_bundler!
106
+
107
+ if m.invoked_as_script?
108
+ load Gem.bin_path("bundler", "bundle")
109
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../config/application"
4
+ require "importmap/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path("..", __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts "== Installing dependencies =="
17
+ system! "gem install bundler --conservative"
18
+ system("bundle check") || system!("bundle install")
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! "bin/rails db:prepare"
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! "bin/rails log:clear tmp:clear"
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! "bin/rails restart"
33
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "boot"
2
+
3
+ require "rails/all"
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module Demo
10
+ class Application < Rails::Application
11
+ # Initialize configuration defaults for originally generated Rails version.
12
+ config.load_defaults 7.0
13
+
14
+ # Configuration for the application, engines, and railties goes here.
15
+ #
16
+ # These settings can be overridden in specific environments using the files
17
+ # in config/environments, which are processed later.
18
+ #
19
+ # config.time_zone = "Central Time (US & Canada)"
20
+ # config.eager_load_paths << Rails.root.join("extras")
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: demo_production
@@ -0,0 +1 @@
1
+ BG8ARuFz0P7gp6B/7zFIqOjVrBXdwnoiOKDUKYzEVHDNcNFzECTV0b9oPeJxC1Gk8Tc08kvgE+QHZ+IwbdFVPpE0GIMsXp4PaHIDVBGJoWWropywtP29oIDzm1SYBT4a34msqQnMuCW2yzAQX5GR7hR1HnKGfS29r1zAgJZTYj50Y7tenZvowoe50zJITRaJfrov6AHJaeBSXGEHqBJzrtOczPP6ZXTD/FzihuG+00e+BJXZldvOdxZm+u1b442jGKiVfcq8steOdS49YdfLxcIIZHUxZNq5MT0evczS6KozyVX4UPrsgeeCcKFIL6+2HUktPUlzdTS2PkTA1NIfC884PYNkr3MAiYwd/iMg37IO7c1z8YmDAMfzDx+T4Gu6CRgNwEL9s53ZASjYkvtL6IEhouEwkJeeZL4E--Ao9jkJOh/YRG/ftT--4e5iDt7cERVZueKW+etQzA==
@@ -0,0 +1,25 @@
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem "sqlite3"
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3