tokra 0.0.1.pre.1 → 0.0.1.pre.2

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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSES/MIT-0.txt +16 -0
  3. data/REUSE.toml +6 -1
  4. data/Rakefile +2 -0
  5. data/Steepfile +2 -0
  6. data/clippy_exceptions.rb +75 -37
  7. data/doc/contributors/adr/004.md +63 -0
  8. data/doc/contributors/chats/002.md +177 -0
  9. data/doc/contributors/chats/003.md +2180 -0
  10. data/doc/contributors/chats/004.md +1992 -0
  11. data/doc/contributors/chats/005.md +1529 -0
  12. data/doc/contributors/plan/002.md +173 -0
  13. data/doc/contributors/plan/003.md +111 -0
  14. data/examples/verify_hello_world/index.html +15 -2
  15. data/examples/verify_ping_pong/app.rb +3 -1
  16. data/examples/verify_ping_pong/public/styles.css +36 -9
  17. data/examples/verify_ping_pong/views/layout.erb +1 -1
  18. data/examples/verify_rails_sqlite/.dockerignore +51 -0
  19. data/examples/verify_rails_sqlite/.gitattributes +9 -0
  20. data/examples/verify_rails_sqlite/.github/dependabot.yml +12 -0
  21. data/examples/verify_rails_sqlite/.github/workflows/ci.yml +124 -0
  22. data/examples/verify_rails_sqlite/.gitignore +35 -0
  23. data/examples/verify_rails_sqlite/.kamal/hooks/docker-setup.sample +3 -0
  24. data/examples/verify_rails_sqlite/.kamal/hooks/post-app-boot.sample +3 -0
  25. data/examples/verify_rails_sqlite/.kamal/hooks/post-deploy.sample +14 -0
  26. data/examples/verify_rails_sqlite/.kamal/hooks/post-proxy-reboot.sample +3 -0
  27. data/examples/verify_rails_sqlite/.kamal/hooks/pre-app-boot.sample +3 -0
  28. data/examples/verify_rails_sqlite/.kamal/hooks/pre-build.sample +51 -0
  29. data/examples/verify_rails_sqlite/.kamal/hooks/pre-connect.sample +47 -0
  30. data/examples/verify_rails_sqlite/.kamal/hooks/pre-deploy.sample +122 -0
  31. data/examples/verify_rails_sqlite/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  32. data/examples/verify_rails_sqlite/.kamal/secrets +20 -0
  33. data/examples/verify_rails_sqlite/.rubocop.yml +2 -0
  34. data/examples/verify_rails_sqlite/.ruby-version +1 -0
  35. data/examples/verify_rails_sqlite/Dockerfile +77 -0
  36. data/examples/verify_rails_sqlite/Gemfile +66 -0
  37. data/examples/verify_rails_sqlite/Gemfile.lock +563 -0
  38. data/examples/verify_rails_sqlite/README.md +41 -0
  39. data/examples/verify_rails_sqlite/Rakefile +6 -0
  40. data/examples/verify_rails_sqlite/app/assets/images/.keep +0 -0
  41. data/examples/verify_rails_sqlite/app/assets/stylesheets/application.css +469 -0
  42. data/examples/verify_rails_sqlite/app/controllers/application_controller.rb +12 -0
  43. data/examples/verify_rails_sqlite/app/controllers/concerns/.keep +0 -0
  44. data/examples/verify_rails_sqlite/app/controllers/todos_controller.rb +70 -0
  45. data/examples/verify_rails_sqlite/app/helpers/application_helper.rb +2 -0
  46. data/examples/verify_rails_sqlite/app/helpers/todos_helper.rb +2 -0
  47. data/examples/verify_rails_sqlite/app/javascript/application.js +3 -0
  48. data/examples/verify_rails_sqlite/app/javascript/controllers/application.js +9 -0
  49. data/examples/verify_rails_sqlite/app/javascript/controllers/hello_controller.js +7 -0
  50. data/examples/verify_rails_sqlite/app/javascript/controllers/index.js +4 -0
  51. data/examples/verify_rails_sqlite/app/jobs/application_job.rb +7 -0
  52. data/examples/verify_rails_sqlite/app/mailers/application_mailer.rb +4 -0
  53. data/examples/verify_rails_sqlite/app/models/application_record.rb +3 -0
  54. data/examples/verify_rails_sqlite/app/models/concerns/.keep +0 -0
  55. data/examples/verify_rails_sqlite/app/models/todo.rb +10 -0
  56. data/examples/verify_rails_sqlite/app/views/layouts/application.html.erb +24 -0
  57. data/examples/verify_rails_sqlite/app/views/layouts/mailer.html.erb +13 -0
  58. data/examples/verify_rails_sqlite/app/views/layouts/mailer.text.erb +1 -0
  59. data/examples/verify_rails_sqlite/app/views/pwa/manifest.json.erb +22 -0
  60. data/examples/verify_rails_sqlite/app/views/pwa/service-worker.js +26 -0
  61. data/examples/verify_rails_sqlite/app/views/todos/_form.html.erb +27 -0
  62. data/examples/verify_rails_sqlite/app/views/todos/_todo.html.erb +18 -0
  63. data/examples/verify_rails_sqlite/app/views/todos/_todo.json.jbuilder +2 -0
  64. data/examples/verify_rails_sqlite/app/views/todos/edit.html.erb +7 -0
  65. data/examples/verify_rails_sqlite/app/views/todos/index.html.erb +22 -0
  66. data/examples/verify_rails_sqlite/app/views/todos/index.json.jbuilder +1 -0
  67. data/examples/verify_rails_sqlite/app/views/todos/new.html.erb +7 -0
  68. data/examples/verify_rails_sqlite/app/views/todos/show.html.erb +23 -0
  69. data/examples/verify_rails_sqlite/app/views/todos/show.json.jbuilder +1 -0
  70. data/examples/verify_rails_sqlite/bin/brakeman +7 -0
  71. data/examples/verify_rails_sqlite/bin/bundler-audit +6 -0
  72. data/examples/verify_rails_sqlite/bin/ci +6 -0
  73. data/examples/verify_rails_sqlite/bin/dev +2 -0
  74. data/examples/verify_rails_sqlite/bin/docker-entrypoint +8 -0
  75. data/examples/verify_rails_sqlite/bin/importmap +4 -0
  76. data/examples/verify_rails_sqlite/bin/jobs +6 -0
  77. data/examples/verify_rails_sqlite/bin/kamal +16 -0
  78. data/examples/verify_rails_sqlite/bin/rails +4 -0
  79. data/examples/verify_rails_sqlite/bin/rake +4 -0
  80. data/examples/verify_rails_sqlite/bin/rubocop +8 -0
  81. data/examples/verify_rails_sqlite/bin/setup +35 -0
  82. data/examples/verify_rails_sqlite/bin/thrust +5 -0
  83. data/examples/verify_rails_sqlite/config/application.rb +27 -0
  84. data/examples/verify_rails_sqlite/config/boot.rb +4 -0
  85. data/examples/verify_rails_sqlite/config/bundler-audit.yml +5 -0
  86. data/examples/verify_rails_sqlite/config/cable.yml +17 -0
  87. data/examples/verify_rails_sqlite/config/cache.yml +16 -0
  88. data/examples/verify_rails_sqlite/config/ci.rb +24 -0
  89. data/examples/verify_rails_sqlite/config/credentials.yml.enc +1 -0
  90. data/examples/verify_rails_sqlite/config/database.yml +40 -0
  91. data/examples/verify_rails_sqlite/config/deploy.yml +119 -0
  92. data/examples/verify_rails_sqlite/config/environment.rb +5 -0
  93. data/examples/verify_rails_sqlite/config/environments/development.rb +84 -0
  94. data/examples/verify_rails_sqlite/config/environments/production.rb +99 -0
  95. data/examples/verify_rails_sqlite/config/environments/test.rb +53 -0
  96. data/examples/verify_rails_sqlite/config/importmap.rb +7 -0
  97. data/examples/verify_rails_sqlite/config/initializers/assets.rb +7 -0
  98. data/examples/verify_rails_sqlite/config/initializers/content_security_policy.rb +29 -0
  99. data/examples/verify_rails_sqlite/config/initializers/filter_parameter_logging.rb +8 -0
  100. data/examples/verify_rails_sqlite/config/initializers/inflections.rb +16 -0
  101. data/examples/verify_rails_sqlite/config/locales/en.yml +31 -0
  102. data/examples/verify_rails_sqlite/config/puma.rb +42 -0
  103. data/examples/verify_rails_sqlite/config/queue.yml +18 -0
  104. data/examples/verify_rails_sqlite/config/recurring.yml +15 -0
  105. data/examples/verify_rails_sqlite/config/routes.rb +15 -0
  106. data/examples/verify_rails_sqlite/config/storage.yml +27 -0
  107. data/examples/verify_rails_sqlite/config.ru +6 -0
  108. data/examples/verify_rails_sqlite/db/cable_schema.rb +11 -0
  109. data/examples/verify_rails_sqlite/db/cache_schema.rb +12 -0
  110. data/examples/verify_rails_sqlite/db/migrate/20260130080933_create_todos.rb +10 -0
  111. data/examples/verify_rails_sqlite/db/queue_schema.rb +129 -0
  112. data/examples/verify_rails_sqlite/db/schema.rb +20 -0
  113. data/examples/verify_rails_sqlite/db/seeds.rb +9 -0
  114. data/examples/verify_rails_sqlite/lib/tasks/.keep +0 -0
  115. data/examples/verify_rails_sqlite/log/.keep +0 -0
  116. data/examples/verify_rails_sqlite/public/400.html +135 -0
  117. data/examples/verify_rails_sqlite/public/404.html +135 -0
  118. data/examples/verify_rails_sqlite/public/406-unsupported-browser.html +135 -0
  119. data/examples/verify_rails_sqlite/public/422.html +135 -0
  120. data/examples/verify_rails_sqlite/public/500.html +135 -0
  121. data/examples/verify_rails_sqlite/public/icon.png +0 -0
  122. data/examples/verify_rails_sqlite/public/icon.svg +3 -0
  123. data/examples/verify_rails_sqlite/public/robots.txt +1 -0
  124. data/examples/verify_rails_sqlite/public/styles.css +469 -0
  125. data/examples/verify_rails_sqlite/script/.keep +0 -0
  126. data/examples/verify_rails_sqlite/storage/.keep +0 -0
  127. data/examples/verify_rails_sqlite/test/controllers/.keep +0 -0
  128. data/examples/verify_rails_sqlite/test/controllers/todos_controller_test.rb +48 -0
  129. data/examples/verify_rails_sqlite/test/fixtures/files/.keep +0 -0
  130. data/examples/verify_rails_sqlite/test/fixtures/todos.yml +9 -0
  131. data/examples/verify_rails_sqlite/test/helpers/.keep +0 -0
  132. data/examples/verify_rails_sqlite/test/integration/.keep +0 -0
  133. data/examples/verify_rails_sqlite/test/mailers/.keep +0 -0
  134. data/examples/verify_rails_sqlite/test/models/.keep +0 -0
  135. data/examples/verify_rails_sqlite/test/models/todo_test.rb +7 -0
  136. data/examples/verify_rails_sqlite/test/test_helper.rb +15 -0
  137. data/examples/verify_rails_sqlite/tmp/.keep +0 -0
  138. data/examples/verify_rails_sqlite/tmp/pids/.keep +0 -0
  139. data/examples/verify_rails_sqlite/tmp/storage/.keep +0 -0
  140. data/examples/verify_rails_sqlite/tokra.rb +42 -0
  141. data/examples/verify_rails_sqlite/vendor/.keep +0 -0
  142. data/examples/verify_rails_sqlite/vendor/javascript/.keep +0 -0
  143. data/ext/tokra/src/event_loop.rs +206 -0
  144. data/ext/tokra/src/events.rs +430 -0
  145. data/ext/tokra/src/lib.rs +52 -664
  146. data/ext/tokra/src/proxy.rs +142 -0
  147. data/ext/tokra/src/responders.rs +86 -0
  148. data/ext/tokra/src/user_event.rs +313 -0
  149. data/ext/tokra/src/webview.rs +194 -0
  150. data/ext/tokra/src/window.rs +92 -0
  151. data/lib/tokra/rack/handler.rb +37 -14
  152. data/lib/tokra/version.rb +1 -1
  153. data/rbs_exceptions.rb +12 -0
  154. data/sig/tokra.rbs +95 -1
  155. data/tasks/lint.rake +2 -2
  156. data/tasks/lint.rb +49 -0
  157. data/tasks/rust.rake +6 -23
  158. data/tasks/steep.rake +25 -3
  159. data/tasks/test.rake +1 -1
  160. metadata +143 -1
@@ -0,0 +1,26 @@
1
+ // Add a service worker for processing Web Push notifications:
2
+ //
3
+ // self.addEventListener("push", async (event) => {
4
+ // const { title, options } = await event.data.json()
5
+ // event.waitUntil(self.registration.showNotification(title, options))
6
+ // })
7
+ //
8
+ // self.addEventListener("notificationclick", function(event) {
9
+ // event.notification.close()
10
+ // event.waitUntil(
11
+ // clients.matchAll({ type: "window" }).then((clientList) => {
12
+ // for (let i = 0; i < clientList.length; i++) {
13
+ // let client = clientList[i]
14
+ // let clientPath = (new URL(client.url)).pathname
15
+ //
16
+ // if (clientPath == event.notification.data.path && "focus" in client) {
17
+ // return client.focus()
18
+ // }
19
+ // }
20
+ //
21
+ // if (clients.openWindow) {
22
+ // return clients.openWindow(event.notification.data.path)
23
+ // }
24
+ // })
25
+ // )
26
+ // })
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: todo, class: "form") do |form| %>
2
+ <% if todo.errors.any? %>
3
+ <div class="error-list">
4
+ <h2><%= pluralize(todo.errors.count, "issue") %> to fix:</h2>
5
+ <ul>
6
+ <% todo.errors.each do |error| %>
7
+ <li><%= error.full_message %></li>
8
+ <% end %>
9
+ </ul>
10
+ </div>
11
+ <% end %>
12
+
13
+ <div class="field">
14
+ <%= form.label :title, "What needs to be done?" %>
15
+ <%= form.text_field :title, placeholder: "Enter your task…", autofocus: true %>
16
+ </div>
17
+
18
+ <div class="field field-checkbox">
19
+ <%= form.check_box :completed %>
20
+ <%= form.label :completed, "Already completed" %>
21
+ </div>
22
+
23
+ <div class="form-actions">
24
+ <%= form.submit class: "btn" %>
25
+ <%= link_to "Cancel", todos_path, class: "link link--muted" %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <li class="todo-item" id="<%= dom_id todo %>" data-completed="<%= todo.completed? %>">
2
+ <%= form_with model: todo, class: "todo-toggle" do |f| %>
3
+ <%= f.check_box :completed,
4
+ class: "todo-checkbox",
5
+ onchange: "this.form.requestSubmit()",
6
+ "aria-label": todo.completed? ? "Mark incomplete" : "Mark complete" %>
7
+ <% end %>
8
+
9
+ <div class="todo-content">
10
+ <h3 class="todo-title">
11
+ <%= link_to todo.title, todo %>
12
+ </h3>
13
+ </div>
14
+
15
+ <div class="todo-actions">
16
+ <%= link_to "Edit", edit_todo_path(todo), class: "btn btn--ghost" %>
17
+ </div>
18
+ </li>
@@ -0,0 +1,2 @@
1
+ json.extract! todo, :id, :title, :completed, :created_at, :updated_at
2
+ json.url todo_url(todo, format: :json)
@@ -0,0 +1,7 @@
1
+ <% content_for :title, "Edit: #{@todo.title}" %>
2
+
3
+ <header class="page-header">
4
+ <h1 class="page-title">Edit task</h1>
5
+ </header>
6
+
7
+ <%= render "form", todo: @todo %>
@@ -0,0 +1,22 @@
1
+ <% content_for :title, "Tasks" %>
2
+
3
+ <header class="page-header">
4
+ <h1 class="page-title">Tasks</h1>
5
+ <p class="page-subtitle">Your personal to-do list</p>
6
+ </header>
7
+
8
+ <% if @todos.any? %>
9
+ <ul class="todo-list">
10
+ <% @todos.each do |todo| %>
11
+ <%= render todo %>
12
+ <% end %>
13
+ </ul>
14
+ <% else %>
15
+ <div class="empty-state">
16
+ <p>Nothing here yet. Add your first task to get started.</p>
17
+ </div>
18
+ <% end %>
19
+
20
+ <div class="mt-8">
21
+ <%= link_to "Add task", new_todo_path, class: "btn" %>
22
+ </div>
@@ -0,0 +1 @@
1
+ json.array! @todos, partial: "todos/todo", as: :todo
@@ -0,0 +1,7 @@
1
+ <% content_for :title, "New Task" %>
2
+
3
+ <header class="page-header">
4
+ <h1 class="page-title">New task</h1>
5
+ </header>
6
+
7
+ <%= render "form", todo: @todo %>
@@ -0,0 +1,23 @@
1
+ <% content_for :title, @todo.title %>
2
+
3
+ <article class="detail">
4
+ <h1 class="detail-title"><%= @todo.title %></h1>
5
+
6
+ <% if @todo.completed? %>
7
+ <span class="detail-status detail-status--complete">
8
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor">
9
+ <path d="M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z"/>
10
+ </svg>
11
+ Completed
12
+ </span>
13
+ <% else %>
14
+ <span class="detail-status detail-status--pending">Pending</span>
15
+ <% end %>
16
+
17
+ <nav class="detail-actions">
18
+ <%= link_to "Edit", edit_todo_path(@todo), class: "btn btn--ghost" %>
19
+ <%= button_to "Delete", @todo, method: :delete, class: "btn btn--ghost btn--danger",
20
+ data: { turbo_confirm: "Delete this task?" } %>
21
+ <%= link_to "Back to list", todos_path, class: "link link--muted" %>
22
+ </nav>
23
+ </article>
@@ -0,0 +1 @@
1
+ json.partial! "todos/todo", todo: @todo
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "bundler/setup"
4
+
5
+ ARGV.unshift("--ensure-latest")
6
+
7
+ load Gem.bin_path("brakeman", "brakeman")
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "bundler/audit/cli"
4
+
5
+ ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
6
+ Bundler::Audit::CLI.start
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "active_support/continuous_integration"
4
+
5
+ CI = ActiveSupport::ContinuousIntegration
6
+ require_relative "../config/ci.rb"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ exec "./bin/rails", "server", *ARGV
@@ -0,0 +1,8 @@
1
+ #!/bin/bash -e
2
+
3
+ # If running the rails server then create or migrate existing database
4
+ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
5
+ ./bin/rails db:prepare
6
+ fi
7
+
8
+ exec "${@}"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../config/application"
4
+ require "importmap/commands"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../config/environment"
4
+ require "solid_queue/cli"
5
+
6
+ SolidQueue::Cli.start(ARGV)
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'kamal' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ require "rubygems"
14
+ require "bundler/setup"
15
+
16
+ load Gem.bin_path("kamal", "kamal")
@@ -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,8 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "bundler/setup"
4
+
5
+ # Explicit RuboCop config increases performance slightly while avoiding config confusion.
6
+ ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7
+
8
+ load Gem.bin_path("rubocop", "rubocop")
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ APP_ROOT = File.expand_path("..", __dir__)
5
+
6
+ def system!(*args)
7
+ system(*args, exception: true)
8
+ end
9
+
10
+ FileUtils.chdir APP_ROOT do
11
+ # This script is a way to set up or update your development environment automatically.
12
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
13
+ # Add necessary setup steps to this file.
14
+
15
+ puts "== Installing dependencies =="
16
+ system("bundle check") || system!("bundle install")
17
+
18
+ # puts "\n== Copying sample files =="
19
+ # unless File.exist?("config/database.yml")
20
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
21
+ # end
22
+
23
+ puts "\n== Preparing database =="
24
+ system! "bin/rails db:prepare"
25
+ system! "bin/rails db:reset" if ARGV.include?("--reset")
26
+
27
+ puts "\n== Removing old logs and tempfiles =="
28
+ system! "bin/rails log:clear tmp:clear"
29
+
30
+ unless ARGV.include?("--skip-server")
31
+ puts "\n== Starting development server =="
32
+ STDOUT.flush # flush the output before exec(2) so that it displays
33
+ exec "bin/dev"
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "bundler/setup"
4
+
5
+ load Gem.bin_path("thruster", "thrust")
@@ -0,0 +1,27 @@
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 VerifyRailsSqlite
10
+ class Application < Rails::Application
11
+ # Initialize configuration defaults for originally generated Rails version.
12
+ config.load_defaults 8.1
13
+
14
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
15
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
16
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
17
+ config.autoload_lib(ignore: %w[assets tasks])
18
+
19
+ # Configuration for the application, engines, and railties goes here.
20
+ #
21
+ # These settings can be overridden in specific environments using the files
22
+ # in config/environments, which are processed later.
23
+ #
24
+ # config.time_zone = "Central Time (US & Canada)"
25
+ # config.eager_load_paths << Rails.root.join("extras")
26
+ end
27
+ 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,5 @@
1
+ # Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit.
2
+ # CVEs that are not relevant to the application can be enumerated on the ignore list below.
3
+
4
+ ignore:
5
+ - CVE-THAT-DOES-NOT-APPLY
@@ -0,0 +1,17 @@
1
+ # Async adapter only works within the same process, so for manually triggering cable updates from a console,
2
+ # and seeing results in the browser, you must do so from the web console (running inside the dev process),
3
+ # not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
4
+ # to make the web console appear.
5
+ development:
6
+ adapter: async
7
+
8
+ test:
9
+ adapter: test
10
+
11
+ production:
12
+ adapter: solid_cable
13
+ connects_to:
14
+ database:
15
+ writing: cable
16
+ polling_interval: 0.1.seconds
17
+ message_retention: 1.day
@@ -0,0 +1,16 @@
1
+ default: &default
2
+ store_options:
3
+ # Cap age of oldest cache entry to fulfill retention policies
4
+ # max_age: <%= 60.days.to_i %>
5
+ max_size: <%= 256.megabytes %>
6
+ namespace: <%= Rails.env %>
7
+
8
+ development:
9
+ <<: *default
10
+
11
+ test:
12
+ <<: *default
13
+
14
+ production:
15
+ database: cache
16
+ <<: *default
@@ -0,0 +1,24 @@
1
+ # Run using bin/ci
2
+
3
+ CI.run do
4
+ step "Setup", "bin/setup --skip-server"
5
+
6
+ step "Style: Ruby", "bin/rubocop"
7
+
8
+ step "Security: Gem audit", "bin/bundler-audit"
9
+ step "Security: Importmap vulnerability audit", "bin/importmap audit"
10
+ step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
11
+ step "Tests: Rails", "bin/rails test"
12
+ step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
13
+
14
+ # Optional: Run system tests
15
+ # step "Tests: System", "bin/rails test:system"
16
+
17
+ # Optional: set a green GitHub commit status to unblock PR merge.
18
+ # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
19
+ # if success?
20
+ # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
21
+ # else
22
+ # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
23
+ # end
24
+ end
@@ -0,0 +1 @@
1
+ xLJWXtkXkqnAAzbFjUhX2k2R6FqGxdKtA4KXgEfQGv5aMZSBXtm/Gd0/J5ZcgNb2c6pGzvZGvj5mU9Kpc40LUgs5TA+mmdimcV3O4U0ganFThfnvUEfk1GuBlhnsgOu/olRCiBYf4E1gW1A9SIYHgKEFr/XVA2rFY/gDKdCvCISz2IdKyS0L553XuLwyOG2xahjkUH4iiI/GvH+zOK3p/LFIUlnl7Of0tNb5WBcU4DixJ3wEbw4CElEW+duDEBOsmShcTCxEAy5IucV0xw9B7T4fuomhcU3MBywJmEEMxvjBvuClNvSFlkHcxsuyVMi4gA5CLjbG7dFi75j0RlBuuykTDrJXSLSHyleS5mAk1iDNP/RUwb8DxRz5rMqSkidmRxNm2Vl5n/eAJ9sx0pxHEcVzhH4B/4oQlQlgFb5D8vHU8MJ8diBPKLQ5Wqbx8mKi377VXvwIN/YGtq4c27HTbc8TkWUixccn2An55bA/1gMXgHQrbm3yef0Y--uNfmxxe9zrP6QQ4C--NAwa8UM+Bu+ST21qER7cDw==
@@ -0,0 +1,40 @@
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
+ max_connections: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: storage/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: storage/test.sqlite3
22
+
23
+ # Store production database in the storage/ directory, which by default
24
+ # is mounted as a persistent Docker volume in config/deploy.yml.
25
+ production:
26
+ primary:
27
+ <<: *default
28
+ database: storage/production.sqlite3
29
+ cache:
30
+ <<: *default
31
+ database: storage/production_cache.sqlite3
32
+ migrations_paths: db/cache_migrate
33
+ queue:
34
+ <<: *default
35
+ database: storage/production_queue.sqlite3
36
+ migrations_paths: db/queue_migrate
37
+ cable:
38
+ <<: *default
39
+ database: storage/production_cable.sqlite3
40
+ migrations_paths: db/cable_migrate
@@ -0,0 +1,119 @@
1
+ # Name of your application. Used to uniquely configure containers.
2
+ service: verify_rails_sqlite
3
+
4
+ # Name of the container image (use your-user/app-name on external registries).
5
+ image: verify_rails_sqlite
6
+
7
+ # Deploy to these servers.
8
+ servers:
9
+ web:
10
+ - 192.168.0.1
11
+ # job:
12
+ # hosts:
13
+ # - 192.168.0.1
14
+ # cmd: bin/jobs
15
+
16
+ # Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
17
+ # If used with Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
18
+ #
19
+ # Using an SSL proxy like this requires turning on config.assume_ssl and config.force_ssl in production.rb!
20
+ #
21
+ # Don't use this when deploying to multiple web servers (then you have to terminate SSL at your load balancer).
22
+ #
23
+ # proxy:
24
+ # ssl: true
25
+ # host: app.example.com
26
+
27
+ # Where you keep your container images.
28
+ registry:
29
+ # Alternatives: hub.docker.com / registry.digitalocean.com / ghcr.io / ...
30
+ server: localhost:5555
31
+
32
+ # Needed for authenticated registries.
33
+ # username: your-user
34
+
35
+ # Always use an access token rather than real password when possible.
36
+ # password:
37
+ # - KAMAL_REGISTRY_PASSWORD
38
+
39
+ # Inject ENV variables into containers (secrets come from .kamal/secrets).
40
+ env:
41
+ secret:
42
+ - RAILS_MASTER_KEY
43
+ clear:
44
+ # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
45
+ # When you start using multiple servers, you should split out job processing to a dedicated machine.
46
+ SOLID_QUEUE_IN_PUMA: true
47
+
48
+ # Set number of processes dedicated to Solid Queue (default: 1)
49
+ # JOB_CONCURRENCY: 3
50
+
51
+ # Set number of cores available to the application on each server (default: 1).
52
+ # WEB_CONCURRENCY: 2
53
+
54
+ # Match this to any external database server to configure Active Record correctly
55
+ # Use verify_rails_sqlite-db for a db accessory server on same machine via local kamal docker network.
56
+ # DB_HOST: 192.168.0.2
57
+
58
+ # Log everything from Rails
59
+ # RAILS_LOG_LEVEL: debug
60
+
61
+ # Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
62
+ # "bin/kamal logs -r job" will tail logs from the first server in the job section.
63
+ aliases:
64
+ console: app exec --interactive --reuse "bin/rails console"
65
+ shell: app exec --interactive --reuse "bash"
66
+ logs: app logs -f
67
+ dbc: app exec --interactive --reuse "bin/rails dbconsole --include-password"
68
+
69
+ # Use a persistent storage volume for sqlite database files and local Active Storage files.
70
+ # Recommended to change this to a mounted volume path that is backed up off server.
71
+ volumes:
72
+ - "verify_rails_sqlite_storage:/rails/storage"
73
+
74
+ # Bridge fingerprinted assets, like JS and CSS, between versions to avoid
75
+ # hitting 404 on in-flight requests. Combines all files from new and old
76
+ # version inside the asset_path.
77
+ asset_path: /rails/public/assets
78
+
79
+ # Configure the image builder.
80
+ builder:
81
+ arch: amd64
82
+
83
+ # # Build image via remote server (useful for faster amd64 builds on arm64 computers)
84
+ # remote: ssh://docker@docker-builder-server
85
+ #
86
+ # # Pass arguments and secrets to the Docker build process
87
+ # args:
88
+ # RUBY_VERSION: ruby-4.0.1
89
+ # secrets:
90
+ # - GITHUB_TOKEN
91
+ # - RAILS_MASTER_KEY
92
+
93
+ # Use a different ssh user than root
94
+ # ssh:
95
+ # user: app
96
+
97
+ # Use accessory services (secrets come from .kamal/secrets).
98
+ # accessories:
99
+ # db:
100
+ # image: mysql:8.0
101
+ # host: 192.168.0.2
102
+ # # Change to 3306 to expose port to the world instead of just local network.
103
+ # port: "127.0.0.1:3306:3306"
104
+ # env:
105
+ # clear:
106
+ # MYSQL_ROOT_HOST: '%'
107
+ # secret:
108
+ # - MYSQL_ROOT_PASSWORD
109
+ # files:
110
+ # - config/mysql/production.cnf:/etc/mysql/my.cnf
111
+ # - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
112
+ # directories:
113
+ # - data:/var/lib/mysql
114
+ # redis:
115
+ # image: valkey/valkey:8
116
+ # host: 192.168.0.2
117
+ # port: 6379
118
+ # directories:
119
+ # - data:/data
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative "application"
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,84 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Disable host authorization for Tokra desktop app
7
+ # The tokra:// protocol uses localhost as the host, but Rails' default
8
+ # host authorization doesn't recognize it. Since this is a desktop app
9
+ # (not a web server), there's no DNS rebinding risk.
10
+ config.hosts.clear
11
+
12
+ # Make code changes take effect immediately without server restart.
13
+ config.enable_reloading = true
14
+
15
+ # Do not eager load code on boot.
16
+ config.eager_load = false
17
+
18
+ # Show full error reports.
19
+ config.consider_all_requests_local = true
20
+
21
+ # Enable server timing.
22
+ config.server_timing = true
23
+
24
+ # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
25
+ # Run rails dev:cache to toggle Action Controller caching.
26
+ if Rails.root.join("tmp/caching-dev.txt").exist?
27
+ config.action_controller.perform_caching = true
28
+ config.action_controller.enable_fragment_cache_logging = true
29
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
30
+ else
31
+ config.action_controller.perform_caching = false
32
+ end
33
+
34
+ # Change to :null_store to avoid any caching.
35
+ config.cache_store = :memory_store
36
+
37
+ # Store uploaded files on the local file system (see config/storage.yml for options).
38
+ config.active_storage.service = :local
39
+
40
+ # Don't care if the mailer can't send.
41
+ config.action_mailer.raise_delivery_errors = false
42
+
43
+ # Make template changes take effect immediately.
44
+ config.action_mailer.perform_caching = false
45
+
46
+ # Set localhost to be used by links generated in mailer templates.
47
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
48
+
49
+ # Print deprecation notices to the Rails logger.
50
+ config.active_support.deprecation = :log
51
+
52
+ # Raise an error on page load if there are pending migrations.
53
+ config.active_record.migration_error = :page_load
54
+
55
+ # Highlight code that triggered database queries in logs.
56
+ config.active_record.verbose_query_logs = true
57
+
58
+ # Append comments with runtime information tags to SQL queries in logs.
59
+ config.active_record.query_log_tags_enabled = true
60
+
61
+ # Highlight code that enqueued background job in logs.
62
+ config.active_job.verbose_enqueue_logs = true
63
+
64
+ # Highlight code that triggered redirect in logs.
65
+ config.action_dispatch.verbose_redirect_logs = true
66
+
67
+ # Suppress logger output for asset requests.
68
+ config.assets.quiet = true
69
+
70
+ # Raises error for missing translations.
71
+ # config.i18n.raise_on_missing_translations = true
72
+
73
+ # Annotate rendered view with file names.
74
+ config.action_view.annotate_rendered_view_with_filenames = true
75
+
76
+ # Uncomment if you wish to allow Action Cable access from any origin.
77
+ # config.action_cable.disable_request_forgery_protection = true
78
+
79
+ # Raise error when a before_action's only/except options reference missing actions.
80
+ config.action_controller.raise_on_missing_callback_actions = true
81
+
82
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
83
+ # config.generators.apply_rubocop_autocorrect_after_generate!
84
+ end