diff --git a/.overcommit.yml b/.overcommit.yml
index 1a8645e..678bbb6 100644
--- a/.overcommit.yml
+++ b/.overcommit.yml
@@ -6,6 +6,10 @@ gemfile: false
verify_signatures: false
PreCommit:
+ ALL:
+ exclude:
+ - "examples/**/*"
+
BundleCheck:
enabled: true
@@ -14,6 +18,8 @@ PreCommit:
keywords: ["FIXME"]
exclude:
- .overcommit.yml
+ - template/.overcommit.yml.tt
+ - "examples/**/*"
LocalPathsInGemfile:
enabled: true
diff --git a/.rubocop.yml b/.rubocop.yml
index c8754bb..651f304 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -10,6 +10,7 @@ AllCops:
NewCops: enable
TargetRubyVersion: 3.0
Exclude:
+ - "examples/**/*"
- "tmp/**/*"
- "vendor/**/*"
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 0000000..7a51290
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,138 @@
+# Examples
+
+The Rails apps in this directory were all generated by `gem exec nextgen create` with various interactive menu items chosen.
+
+## default
+
+[`examples/default`](./default) was created by choosing the default option for every question, and declining all optional Nextgen enhancements. This generally represents the default Rails "omakase" experience with a [base](../lib/nextgen/generators/base.rb) level of improvements.
+
+```
+What version of Rails will you use?
+‣ 7.1.1
+ edge (7-1-stable branch)
+
+Which database?
+‣ SQLite3 (default)
+ PostgreSQL (recommended)
+ MySQL
+ More options...
+
+What style of Rails app do you need?
+‣ Standard, full-stack Rails (default)
+ API only
+
+How will you manage frontend assets?
+‣ Sprockets (default)
+ Propshaft
+ Vite
+
+Which CSS framework will you use with the asset pipeline?
+‣ None (default)
+ Bootstrap
+ Bulma
+ PostCSS
+ Sass
+ Tailwind
+
+Which JavaScript bundler will you use with the asset pipeline?
+‣ Importmap (default)
+ ESBuild
+ Rollup
+ Webpack
+ None
+
+Which optional Rails frameworks do you need?
+‣ ⬢ Hotwire
+ ⬢ JBuilder
+ ⬢ Action Mailer
+ ⬢ Active Job
+ ⬢ Action Cable
+ ⬢ Active Storage
+ ⬢ Action Text
+ ⬢ Action Mailbox
+
+Which test framework will you use?
+‣ Minitest (default)
+ RSpec
+ None
+
+Include system testing (capybara)?
+‣ Yes (default)
+ No
+
+Which optional enhancements would you like to add?
+‣ ⬡ Annotate Models
+ ⬡ BasicAuth controller concern
+ ⬡ Brakeman
+ ⬡ Bundler Audit
+ ⬡ capybara-lockstep
+ ⬡ dotenv-rails
+ ⬡ ERB Lint
+ ⬡ ESLint
+ ⬡ Factory Bot
+ ⬡ GitHub Actions
+ ⬡ good_migrations
+ ⬡ letter_opener
+ ⬡ Open browser on startup
+ ⬡ Overcommit
+ ⬡ rack-canonical-host
+ ⬡ rack-mini-profiler
+ ⬡ RuboCop
+ ⬡ shoulda
+ ⬡ Sidekiq
+ ⬡ Stylelint
+ ⬡ Thor
+ ⬡ Tomo
+```
+
+## rspec
+
+[`examples/rspec`](./rspec) is the same as the default example, except "RSpec" was chosen when prompted to select a test framework:
+
+```
+Which test framework will you use?
+ Minitest (default)
+‣ RSpec
+ None
+```
+
+## vite
+
+[`examples/vite`](./vite) shows what is generated when "Vite" is chosen as an alternative to Sprockets.
+
+```
+How will you manage frontend assets?
+ Sprockets (default)
+ Propshaft
+‣ Vite
+```
+
+## all
+
+[`examples/all`](./all) shows what is generated when all optional Nextgen enhancements are selected, including Sidekiq, Factory Bot, GitHub Actions, RuboCop, and more than a dozen others.
+
+```
+Which optional enhancements would you like to add?
+‣ ⬢ Annotate Models
+ ⬢ BasicAuth controller concern
+ ⬢ Brakeman
+ ⬢ Bundler Audit
+ ⬢ capybara-lockstep
+ ⬢ dotenv-rails
+ ⬢ ERB Lint
+ ⬢ ESLint
+ ⬢ Factory Bot
+ ⬢ GitHub Actions
+ ⬢ good_migrations
+ ⬢ letter_opener
+ ⬢ Open browser on startup
+ ⬢ Overcommit
+ ⬢ rack-canonical-host
+ ⬢ rack-mini-profiler
+ ⬢ RuboCop
+ ⬢ shoulda
+ ⬢ Sidekiq
+ ⬢ Stylelint
+ ⬢ Thor
+ ⬢ Tomo
+```
diff --git a/examples/all/.dockerignore b/examples/all/.dockerignore
new file mode 100644
index 0000000..9612375
--- /dev/null
+++ b/examples/all/.dockerignore
@@ -0,0 +1,37 @@
+# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
+
+# Ignore git directory.
+/.git/
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all default key files.
+/config/master.key
+/config/credentials/*.key
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/.keep
+
+# Ignore assets.
+/node_modules/
+/app/assets/builds/*
+!/app/assets/builds/.keep
+/public/assets
diff --git a/examples/all/.editorconfig b/examples/all/.editorconfig
new file mode 100644
index 0000000..bf44d02
--- /dev/null
+++ b/examples/all/.editorconfig
@@ -0,0 +1,14 @@
+# https://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[Makefile]
+indent_style = tab
diff --git a/examples/all/.env.sample b/examples/all/.env.sample
new file mode 100644
index 0000000..c953fa9
--- /dev/null
+++ b/examples/all/.env.sample
@@ -0,0 +1,2 @@
+# These environment variables are needed to run the app locally.
+# Copy these into a file named .env to have them loaded automatically.
diff --git a/examples/all/.erb-lint.yml b/examples/all/.erb-lint.yml
new file mode 100644
index 0000000..f29b924
--- /dev/null
+++ b/examples/all/.erb-lint.yml
@@ -0,0 +1,23 @@
+---
+EnableDefaultLinters: true
+exclude:
+ - "node_modules/**/*"
+ - "vendor/**/*"
+linters:
+ ErbSafety:
+ enabled: true
+ Rubocop:
+ enabled: true
+ rubocop_config:
+ inherit_from:
+ - .rubocop.yml
+ Layout/InitialIndentation:
+ Enabled: false
+ Layout/TrailingEmptyLines:
+ Enabled: false
+ Lint/UselessAssignment:
+ Enabled: false
+ Naming/FileName:
+ Enabled: false
+ Rails/OutputSafety:
+ Enabled: false
diff --git a/examples/all/.eslintrc.cjs b/examples/all/.eslintrc.cjs
new file mode 100644
index 0000000..64371d6
--- /dev/null
+++ b/examples/all/.eslintrc.cjs
@@ -0,0 +1,26 @@
+/** @type {import("@types/eslint").Linter.Config */
+
+module.exports = {
+ env: {
+ browser: true,
+ es2021: true,
+ },
+ parserOptions: {
+ ecmaVersion: 2022,
+ sourceType: "module",
+ },
+ plugins: ["prettier"],
+ rules: {
+ "no-unused-vars": [
+ "error",
+ {
+ args: "after-used",
+ argsIgnorePattern: "^_",
+ varsIgnorePattern: "^_",
+ },
+ ],
+ "no-var": "error",
+ "prettier/prettier": "error",
+ },
+ extends: ["eslint:recommended", "prettier"],
+};
diff --git a/examples/all/.gitattributes b/examples/all/.gitattributes
new file mode 100644
index 0000000..8dc4323
--- /dev/null
+++ b/examples/all/.gitattributes
@@ -0,0 +1,9 @@
+# See https://git-scm.com/docs/gitattributes for more about git attribute files.
+
+# Mark the database schema as having been generated.
+db/schema.rb linguist-generated
+
+# Mark any vendored files as having been vendored.
+vendor/* linguist-vendored
+config/credentials/*.yml.enc diff=rails_credentials
+config/credentials.yml.enc diff=rails_credentials
diff --git a/examples/all/.github/workflows/ci.yml b/examples/all/.github/workflows/ci.yml
new file mode 100644
index 0000000..7bd9847
--- /dev/null
+++ b/examples/all/.github/workflows/ci.yml
@@ -0,0 +1,90 @@
+name: CI
+on:
+ pull_request:
+ push:
+ branches:
+ - main
+env:
+ RAILS_ENV: test
+jobs:
+ test:
+ name: "Test"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - uses: actions/setup-node@v3
+ with:
+ node-version: "lts/*"
+ cache: yarn
+ - run: npx --yes ci
+ - run: mkdir -p ./tmp/screenshots
+ - run: bundle exec rake db:prepare
+ - run: bundle exec rake test:all
+ - uses: actions/upload-artifact@v3
+ if: failure()
+ with:
+ name: capybara-screenshots
+ path: ./tmp/screenshots/
+ retention-days: 7
+ if-no-files-found: ignore
+ erblint:
+ name: "Lint / erblint"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - run: bin/erblint --lint-all
+ eslint:
+ name: "Lint / eslint"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v3
+ with:
+ node-version: "lts/*"
+ cache: yarn
+ - run: npx --yes ci
+ - run: yarn lint:js
+ rubocop:
+ name: "Lint / rubocop"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - run: bin/rubocop
+ stylelint:
+ name: "Lint / stylelint"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v3
+ with:
+ node-version: "lts/*"
+ cache: yarn
+ - run: npx --yes ci
+ - run: yarn lint:css
+ brakeman:
+ name: "Security / brakeman"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - run: bundle exec brakeman --exit-on-warn --no-progress --color --output /dev/stdout
+ bundle-audit:
+ name: "Security / bundle-audit"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - run: bundle exec bundle-audit check --update -v
diff --git a/examples/all/.gitignore b/examples/all/.gitignore
new file mode 100644
index 0000000..5404961
--- /dev/null
+++ b/examples/all/.gitignore
@@ -0,0 +1,37 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/
+!/tmp/storage/.keep
+
+/public/assets
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
+node_modules/
+!/.env.sample
diff --git a/examples/all/.overcommit.yml b/examples/all/.overcommit.yml
new file mode 100644
index 0000000..25902ea
--- /dev/null
+++ b/examples/all/.overcommit.yml
@@ -0,0 +1,74 @@
+gemfile: false
+verify_signatures: false
+
+PreCommit:
+ BundleCheck:
+ enabled: true
+
+ ErbLint:
+ enabled: true
+ required_executable: bundle
+ command: ["bundle", "exec", "erblint"]
+ include: "**/*.html.erb"
+
+ EsLint:
+ enabled: true
+ required_executable: npx
+ command: ["npx", "--no-install", "eslint", "-f", "compact"]
+ include:
+ - app/assets/**/*.js
+ - app/assets/**/*.jsx
+ - app/components/**/*.js
+ - app/components/**/*.jsx
+ - app/frontend/**/*.js
+ - app/frontend/**/*.jsx
+ - app/javascript/**/*.js
+ - app/javascript/**/*.jsx
+ - app/assets/**/*.ts
+ - app/assets/**/*.tsx
+ - app/components/**/*.ts
+ - app/components/**/*.tsx
+ - app/frontend/**/*.ts
+ - app/frontend/**/*.tsx
+ - app/javascript/**/*.ts
+ - app/javascript/**/*.tsx
+
+ FixMe:
+ enabled: true
+ keywords: ["FIXME"]
+ exclude:
+ - .overcommit.yml
+
+ LocalPathsInGemfile:
+ enabled: true
+
+ RailsSchemaUpToDate:
+ enabled: true
+
+ RuboCop:
+ enabled: true
+ required_executable: bundle
+ command: ["bundle", "exec", "rubocop"]
+ on_warn: fail
+
+ Stylelint:
+ enabled: true
+ required_executable: npx
+ command: ["npx", "--no-install", "stylelint"]
+ include:
+ - app/assets/**/*.css
+ - app/components/**/*.css
+ - app/frontend/**/*.css
+ - app/javascript/**/*.css
+
+ TrailingWhitespace:
+ enabled: true
+ exclude:
+ - "**/db/structure.sql"
+
+ YarnCheck:
+ enabled: true
+
+PostCheckout:
+ ALL:
+ quiet: true
diff --git a/examples/all/.prettierrc.cjs b/examples/all/.prettierrc.cjs
new file mode 100644
index 0000000..5f16540
--- /dev/null
+++ b/examples/all/.prettierrc.cjs
@@ -0,0 +1,6 @@
+/** @type {import("prettier").Config} */
+
+module.exports = {
+ tabWidth: 2,
+ useTabs: false,
+};
diff --git a/examples/all/.rubocop.yml b/examples/all/.rubocop.yml
new file mode 100644
index 0000000..711080b
--- /dev/null
+++ b/examples/all/.rubocop.yml
@@ -0,0 +1,269 @@
+require:
+ - rubocop-capybara
+ - rubocop-factory_bot
+ - rubocop-minitest
+ - rubocop-performance
+ - rubocop-rails
+
+inherit_mode:
+ merge:
+ - Include
+
+AllCops:
+ DisplayCopNames: true
+ DisplayStyleGuide: true
+ NewCops: enable
+ Include:
+ - .tomo/**/*.rb
+ Exclude:
+ # ignore bin/* except for bin/setup
+ - !ruby/regexp /<%= Regexp.quote(File.expand_path("bin", __dir__)) %>\/(?!setup).*/
+ - .git/**/*
+ - db/*schema.rb
+ - log/**/*
+ - node_modules/**/*
+ - public/**/*
+ - storage/**/*
+ - tmp/**/*
+ - vendor/**/*
+
+Layout/ArgumentAlignment:
+ EnforcedStyle: with_fixed_indentation
+
+Layout/ExtraSpacing:
+ AllowForAlignment: false
+ AllowBeforeTrailingComments: true
+ ForceEqualSignAlignment: false
+
+Layout/FirstArrayElementIndentation:
+ EnforcedStyle: consistent
+
+Layout/FirstArrayElementLineBreak:
+ Enabled: true
+
+Layout/FirstHashElementLineBreak:
+ Enabled: true
+
+Layout/FirstMethodArgumentLineBreak:
+ Enabled: true
+
+Layout/HashAlignment:
+ EnforcedHashRocketStyle: key
+ EnforcedColonStyle: key
+ EnforcedLastArgumentHashStyle: always_inspect
+
+Layout/LineLength:
+ Exclude:
+ - config/initializers/content_security_policy.rb
+
+Layout/MultilineArrayLineBreaks:
+ Enabled: true
+
+Layout/MultilineHashKeyLineBreaks:
+ Enabled: true
+
+Layout/MultilineMethodArgumentLineBreaks:
+ Enabled: true
+
+Layout/MultilineMethodCallIndentation:
+ EnforcedStyle: indented
+
+Layout/MultilineOperationIndentation:
+ EnforcedStyle: indented
+
+Layout/SpaceInsideHashLiteralBraces:
+ EnforcedStyle: no_space
+ EnforcedStyleForEmptyBraces: no_space
+
+Lint/AmbiguousBlockAssociation:
+ Enabled: false
+
+Lint/DuplicateBranch:
+ Enabled: false
+
+Metrics/AbcSize:
+ Enabled: false
+
+Metrics/BlockLength:
+ Max: 25
+ Exclude:
+ - config/**/*
+ - test/**/*
+
+Metrics/ClassLength:
+ Max: 200
+ Exclude:
+ - test/**/*
+
+Metrics/CyclomaticComplexity:
+ Enabled: false
+
+Metrics/MethodLength:
+ Max: 25
+ Exclude:
+ - bin/setup
+ - db/migrate/*
+ - test/**/*
+
+Metrics/ModuleLength:
+ Max: 200
+ Exclude:
+ - config/**/*
+
+Metrics/ParameterLists:
+ Max: 6
+
+Metrics/PerceivedComplexity:
+ Max: 8
+ Exclude:
+ - bin/setup
+
+Minitest/AssertPredicate:
+ Enabled: false
+
+Minitest/AssertTruthy:
+ Enabled: false
+
+Minitest/EmptyLineBeforeAssertionMethods:
+ Enabled: false
+
+Minitest/MultipleAssertions:
+ Enabled: false
+
+Minitest/RefuteFalse:
+ Enabled: false
+
+Minitest/RefutePredicate:
+ Enabled: false
+
+Naming/FileName:
+ Exclude:
+ - .tomo/plugins/*.rb
+
+Naming/MemoizedInstanceVariableName:
+ Enabled: false
+
+Naming/VariableNumber:
+ Enabled: false
+
+Rails/ApplicationRecord:
+ Exclude:
+ - db/migrate/**
+
+Rails/BulkChangeTable:
+ Enabled: false
+
+Rails/DefaultScope:
+ Enabled: true
+
+Rails/Delegate:
+ Enabled: false
+
+Rails/EnvironmentVariableAccess:
+ Enabled: false
+
+Rails/HasAndBelongsToMany:
+ Enabled: false
+
+Rails/HttpStatus:
+ Enabled: false
+
+Rails/I18nLocaleTexts:
+ Enabled: false
+
+Rails/Inquiry:
+ Enabled: false
+
+Rails/NotNullColumn:
+ Enabled: false
+
+Rails/RakeEnvironment:
+ Enabled: false
+
+Rails/RefuteMethods:
+ Enabled: false
+
+Rails/RequireDependency:
+ Enabled: true
+
+Rails/RootPathnameMethods:
+ Enabled: false
+
+Rails/SkipsModelValidations:
+ Enabled: false
+
+Rails/UnknownEnv:
+ Environments:
+ - development
+ - test
+ - production
+ - local
+
+Rails/Validation:
+ Enabled: false
+
+Style/Alias:
+ Enabled: false
+
+Style/AsciiComments:
+ Enabled: false
+
+Style/ClassAndModuleChildren:
+ Enabled: false
+
+Style/Documentation:
+ Enabled: false
+
+Style/DoubleNegation:
+ Enabled: false
+
+Style/EmptyMethod:
+ EnforcedStyle: expanded
+
+Style/FetchEnvVar:
+ Enabled: false
+
+Style/FormatStringToken:
+ Enabled: false
+
+Style/FrozenStringLiteralComment:
+ Enabled: false
+
+Style/GuardClause:
+ Enabled: false
+
+Style/IfUnlessModifier:
+ Enabled: false
+
+Style/ModuleFunction:
+ Enabled: false
+
+Style/NumericPredicate:
+ Enabled: false
+
+Style/PerlBackrefs:
+ Enabled: false
+
+Style/RescueStandardError:
+ EnforcedStyle: implicit
+
+Style/SingleLineMethods:
+ AllowIfMethodIsEmpty: false
+
+Style/StringConcatenation:
+ Enabled: false
+
+Style/StringLiterals:
+ EnforcedStyle: double_quotes
+
+Style/StringLiteralsInInterpolation:
+ EnforcedStyle: double_quotes
+
+Style/SymbolArray:
+ Enabled: false
+
+Style/TrivialAccessors:
+ AllowPredicates: true
+
+Style/YodaExpression:
+ Enabled: false
diff --git a/examples/all/.ruby-version b/examples/all/.ruby-version
new file mode 100644
index 0000000..be94e6f
--- /dev/null
+++ b/examples/all/.ruby-version
@@ -0,0 +1 @@
+3.2.2
diff --git a/examples/all/.stylelintrc.cjs b/examples/all/.stylelintrc.cjs
new file mode 100644
index 0000000..007230c
--- /dev/null
+++ b/examples/all/.stylelintrc.cjs
@@ -0,0 +1,52 @@
+module.exports = {
+ plugins: ["stylelint-declaration-strict-value"],
+ extends: ["stylelint-config-standard", "stylelint-prettier/recommended"],
+ rules: {
+ "color-hex-length": null,
+ "declaration-empty-line-before": null,
+ "declaration-no-important": true,
+ "import-notation": null,
+ "max-nesting-depth": 1,
+ "no-empty-source": null,
+ "no-invalid-position-at-import-rule": null,
+ "property-no-unknown": [
+ true,
+ {
+ // Allow property used for css-fonts-4 variable fonts
+ ignoreProperties: ["font-named-instance"],
+ },
+ ],
+ "scale-unlimited/declaration-strict-value": [
+ "/color/",
+ {
+ disableFix: true,
+ ignoreValues: [
+ "currentcolor",
+ "inherit",
+ "initial",
+ "transparent",
+ "unset",
+ ],
+ },
+ ],
+ "selector-class-pattern": [
+ // classes must be in BEM form, like this:
+ // my_component
+ // my_component--variant
+ // my_component__element
+ // my_component__element--variant
+ // my_component__long_element_name
+ // my_component__long_element_name--variant
+ "^[a-z]+(_[a-z]+)*(__[a-z]+(_[a-z]+)*)?(--[a-z]+(_[a-z]+)*)*$",
+ {
+ resolveNestedSelectors: true,
+ message:
+ "Classes must be in BEM form like `my_component__element--variant`",
+ },
+ ],
+ "selector-max-compound-selectors": 2,
+ "selector-max-id": 0,
+ "selector-no-qualifying-type": true,
+ "shorthand-property-no-redundant-values": null,
+ },
+};
diff --git a/examples/all/.tomo/config.rb b/examples/all/.tomo/config.rb
new file mode 100644
index 0000000..fc6342e
--- /dev/null
+++ b/examples/all/.tomo/config.rb
@@ -0,0 +1,78 @@
+plugin "git"
+plugin "env"
+plugin "bundler"
+plugin "rails"
+plugin "nodenv"
+plugin "puma"
+plugin "rbenv"
+plugin "./plugins/all_example.rb"
+
+host "user@hostname.or.ip.address"
+
+set application: "all_example"
+set deploy_to: "/var/www/%{application}"
+set nodenv_node_version: "18.18.1"
+set nodenv_install_yarn: true
+set git_url: nil # FIXME
+set git_branch: "main"
+set git_exclusions: %w[
+ .tomo/
+ spec/
+ test/
+]
+set env_vars: {
+ RACK_ENV: "production",
+ RAILS_ENV: "production",
+ RAILS_LOG_TO_STDOUT: "1",
+ RAILS_SERVE_STATIC_FILES: "1",
+ RUBY_YJIT_ENABLE: "1",
+ BOOTSNAP_CACHE_DIR: "tmp/bootsnap-cache",
+ DATABASE_URL: :prompt,
+ SECRET_KEY_BASE: :prompt
+}
+set linked_dirs: %w[
+ .yarn/cache
+ log
+ node_modules
+ public/assets
+ public/packs
+ public/vite
+ tmp/cache
+ tmp/pids
+ tmp/sockets
+]
+
+setup do
+ run "env:setup"
+ run "core:setup_directories"
+ run "git:config"
+ run "git:clone"
+ run "git:create_release"
+ run "core:symlink_shared"
+ run "nodenv:install"
+ run "rbenv:install"
+ run "bundler:upgrade_bundler"
+ run "bundler:config"
+ run "bundler:install"
+ run "rails:db_create"
+ run "rails:db_schema_load"
+ run "rails:db_seed"
+ run "puma:setup_systemd"
+end
+
+deploy do
+ run "env:update"
+ run "git:create_release"
+ run "core:symlink_shared"
+ run "core:write_release_json"
+ run "bundler:install"
+ run "rails:db_migrate"
+ run "rails:db_seed"
+ run "rails:assets_precompile"
+ run "core:symlink_current"
+ run "puma:restart"
+ run "puma:check_active"
+ run "core:clean_releases"
+ run "bundler:clean"
+ run "core:log_revision"
+end
diff --git a/examples/all/.tomo/plugins/all_example.rb b/examples/all/.tomo/plugins/all_example.rb
new file mode 100644
index 0000000..a2a04df
--- /dev/null
+++ b/examples/all/.tomo/plugins/all_example.rb
@@ -0,0 +1 @@
+# https://tomo-deploy.com/tutorials/writing-custom-tasks/
diff --git a/examples/all/DEPLOYMENT.md b/examples/all/DEPLOYMENT.md
new file mode 100644
index 0000000..c788851
--- /dev/null
+++ b/examples/all/DEPLOYMENT.md
@@ -0,0 +1,14 @@
+# Deployment
+
+## Environment variables
+
+These environment variables affect how the app functions when deployed in production.
+
+- `SIDEKIQ_CONCURRENCY` - Number of threads used per Sidekiq process (default: 5)
+- `RAILS_HOSTNAME` - Redirect all requests to the specified canonical hostname
+- `BASIC_AUTH_USERNAME` - If this and `BASIC_AUTH_PASSWORD` are present, visitors must use these credentials to access the app
+- `BASIC_AUTH_PASSWORD`
+- `RAILS_DISABLE_SSL` - Disable HSTS and secure cookies
+- `RAILS_MAX_THREADS` - Number of threads per Puma process (default: 5)
+- **REQUIRED** `SECRET_KEY_BASE` - Unique, secret key used to encrypt and sign cookies and other sensitive data
+- `WEB_CONCURRENCY` - Number of Puma processes (default: number of CPUs)
diff --git a/examples/all/Dockerfile b/examples/all/Dockerfile
new file mode 100644
index 0000000..ae6eeae
--- /dev/null
+++ b/examples/all/Dockerfile
@@ -0,0 +1,62 @@
+# syntax = docker/dockerfile:1
+
+# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
+ARG RUBY_VERSION=3.2.2
+FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
+
+# Rails app lives here
+WORKDIR /rails
+
+# Set production environment
+ENV RAILS_ENV="production" \
+ BUNDLE_DEPLOYMENT="1" \
+ BUNDLE_PATH="/usr/local/bundle" \
+ BUNDLE_WITHOUT="development"
+
+
+# Throw-away build stage to reduce size of final image
+FROM base as build
+
+# Install packages needed to build gems
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y build-essential git libvips pkg-config
+
+# Install application gems
+COPY Gemfile Gemfile.lock ./
+RUN bundle install && \
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
+ bundle exec bootsnap precompile --gemfile
+
+# Copy application code
+COPY . .
+
+# Precompile bootsnap code for faster boot times
+RUN bundle exec bootsnap precompile app/ lib/
+
+# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
+RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
+
+
+# Final stage for app image
+FROM base
+
+# Install packages needed for deployment
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Copy built artifacts: gems, application
+COPY --from=build /usr/local/bundle /usr/local/bundle
+COPY --from=build /rails /rails
+
+# Run and own only the runtime files as a non-root user for security
+RUN useradd rails --create-home --shell /bin/bash && \
+ chown -R rails:rails db log storage tmp
+USER rails:rails
+
+# Entrypoint prepares the database.
+ENTRYPOINT ["/rails/bin/docker-entrypoint"]
+
+# Start the server by default, this can be overwritten at runtime
+EXPOSE 3000
+CMD ["./bin/rails", "server"]
diff --git a/examples/all/Gemfile b/examples/all/Gemfile
new file mode 100644
index 0000000..36542e5
--- /dev/null
+++ b/examples/all/Gemfile
@@ -0,0 +1,53 @@
+source "https://rubygems.org"
+
+ruby Pathname.new(__dir__).join(".ruby-version").read.strip
+
+gem "bootsnap", require: false
+gem "good_migrations"
+gem "importmap-rails"
+gem "jbuilder"
+gem "puma", ">= 5.0"
+gem "rack-canonical-host"
+gem "rails", "~> 7.1.1"
+gem "redis", ">= 4.0.1"
+gem "sprockets-rails"
+gem "sqlite3", "~> 1.4"
+gem "stimulus-rails"
+gem "turbo-rails"
+gem "tzinfo-data", platforms: %i[windows jruby]
+
+group :development, :test do
+ gem "debug", platforms: %i[mri windows]
+ gem "dotenv-rails"
+ gem "factory_bot_rails"
+ gem "launchy"
+end
+
+group :development do
+ gem "annotate"
+ gem "brakeman", require: false
+ gem "bundler-audit", require: false
+ gem "erb_lint", require: false
+ gem "letter_opener"
+ gem "rack-mini-profiler"
+ gem "rubocop", require: false
+ gem "rubocop-capybara", require: false
+ gem "rubocop-factory_bot", require: false
+ gem "rubocop-minitest", require: false
+ gem "rubocop-performance", require: false
+ gem "rubocop-rails", require: false
+ gem "tomo", "~> 1.18", require: false
+ gem "web-console"
+end
+
+group :test do
+ gem "capybara"
+ gem "capybara-lockstep"
+ gem "selenium-webdriver"
+ gem "shoulda-context"
+ gem "shoulda-matchers"
+end
+
+group :production do
+ gem "sidekiq", "~> 7.0"
+end
diff --git a/examples/all/Gemfile.lock b/examples/all/Gemfile.lock
new file mode 100644
index 0000000..9bd3414
--- /dev/null
+++ b/examples/all/Gemfile.lock
@@ -0,0 +1,381 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (7.1.1)
+ actionpack (= 7.1.1)
+ activesupport (= 7.1.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ zeitwerk (~> 2.6)
+ actionmailbox (7.1.1)
+ actionpack (= 7.1.1)
+ activejob (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ mail (>= 2.7.1)
+ net-imap
+ net-pop
+ net-smtp
+ actionmailer (7.1.1)
+ actionpack (= 7.1.1)
+ actionview (= 7.1.1)
+ activejob (= 7.1.1)
+ activesupport (= 7.1.1)
+ mail (~> 2.5, >= 2.5.4)
+ net-imap
+ net-pop
+ net-smtp
+ rails-dom-testing (~> 2.2)
+ actionpack (7.1.1)
+ actionview (= 7.1.1)
+ activesupport (= 7.1.1)
+ nokogiri (>= 1.8.5)
+ rack (>= 2.2.4)
+ rack-session (>= 1.0.1)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ actiontext (7.1.1)
+ actionpack (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ globalid (>= 0.6.0)
+ nokogiri (>= 1.8.5)
+ actionview (7.1.1)
+ activesupport (= 7.1.1)
+ builder (~> 3.1)
+ erubi (~> 1.11)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ activejob (7.1.1)
+ activesupport (= 7.1.1)
+ globalid (>= 0.3.6)
+ activemodel (7.1.1)
+ activesupport (= 7.1.1)
+ activerecord (7.1.1)
+ activemodel (= 7.1.1)
+ activesupport (= 7.1.1)
+ timeout (>= 0.4.0)
+ activestorage (7.1.1)
+ actionpack (= 7.1.1)
+ activejob (= 7.1.1)
+ activerecord (= 7.1.1)
+ activesupport (= 7.1.1)
+ marcel (~> 1.0)
+ activesupport (7.1.1)
+ base64
+ bigdecimal
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ mutex_m
+ tzinfo (~> 2.0)
+ addressable (2.8.5)
+ public_suffix (>= 2.0.2, < 6.0)
+ annotate (3.2.0)
+ activerecord (>= 3.2, < 8.0)
+ rake (>= 10.4, < 14.0)
+ ast (2.4.2)
+ base64 (0.1.1)
+ better_html (2.0.2)
+ actionview (>= 6.0)
+ activesupport (>= 6.0)
+ ast (~> 2.0)
+ erubi (~> 1.4)
+ parser (>= 2.4)
+ smart_properties
+ bigdecimal (3.1.4)
+ bindex (0.8.1)
+ bootsnap (1.16.0)
+ msgpack (~> 1.2)
+ brakeman (6.0.1)
+ builder (3.2.4)
+ bundler-audit (0.9.1)
+ bundler (>= 1.2.0, < 3)
+ thor (~> 1.0)
+ capybara (3.39.2)
+ addressable
+ matrix
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.8)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ regexp_parser (>= 1.5, < 3.0)
+ xpath (~> 3.2)
+ capybara-lockstep (1.3.0)
+ activesupport (>= 3.2)
+ capybara (>= 2.0)
+ ruby2_keywords
+ selenium-webdriver (>= 3)
+ concurrent-ruby (1.2.2)
+ connection_pool (2.4.1)
+ crass (1.0.6)
+ date (3.3.3)
+ debug (1.8.0)
+ irb (>= 1.5.0)
+ reline (>= 0.3.1)
+ dotenv (2.8.1)
+ dotenv-rails (2.8.1)
+ dotenv (= 2.8.1)
+ railties (>= 3.2)
+ drb (2.1.1)
+ ruby2_keywords
+ erb_lint (0.5.0)
+ activesupport
+ better_html (>= 2.0.1)
+ parser (>= 2.7.1.4)
+ rainbow
+ rubocop
+ smart_properties
+ erubi (1.12.0)
+ factory_bot (6.2.1)
+ activesupport (>= 5.0.0)
+ factory_bot_rails (6.2.0)
+ factory_bot (~> 6.2.0)
+ railties (>= 5.0.0)
+ globalid (1.2.1)
+ activesupport (>= 6.1)
+ good_migrations (0.2.1)
+ activerecord (>= 3.1)
+ railties (>= 3.1)
+ i18n (1.14.1)
+ concurrent-ruby (~> 1.0)
+ importmap-rails (1.2.1)
+ actionpack (>= 6.0.0)
+ railties (>= 6.0.0)
+ io-console (0.6.0)
+ irb (1.8.2)
+ rdoc
+ reline (>= 0.3.8)
+ jbuilder (2.11.5)
+ actionview (>= 5.0.0)
+ activesupport (>= 5.0.0)
+ json (2.6.3)
+ language_server-protocol (3.17.0.3)
+ launchy (2.5.2)
+ addressable (~> 2.8)
+ letter_opener (1.8.1)
+ launchy (>= 2.2, < 3)
+ loofah (2.21.4)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.12.0)
+ mail (2.8.1)
+ mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
+ marcel (1.0.2)
+ matrix (0.4.2)
+ mini_mime (1.1.5)
+ minitest (5.20.0)
+ msgpack (1.7.2)
+ mutex_m (0.1.2)
+ net-imap (0.4.1)
+ date
+ net-protocol
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.2.1)
+ timeout
+ net-smtp (0.4.0)
+ net-protocol
+ nio4r (2.5.9)
+ nokogiri (1.15.4-x86_64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.15.4-x86_64-linux)
+ racc (~> 1.4)
+ parallel (1.23.0)
+ parser (3.2.2.4)
+ ast (~> 2.4.1)
+ racc
+ psych (5.1.1)
+ stringio
+ public_suffix (5.0.3)
+ puma (6.4.0)
+ nio4r (~> 2.0)
+ racc (1.7.1)
+ rack (3.0.8)
+ rack-canonical-host (1.2.0)
+ addressable (> 0, < 3)
+ rack (>= 1, < 4)
+ rack-mini-profiler (3.1.1)
+ rack (>= 1.2.0)
+ rack-session (2.0.0)
+ rack (>= 3.0.0)
+ rack-test (2.1.0)
+ rack (>= 1.3)
+ rackup (2.1.0)
+ rack (>= 3)
+ webrick (~> 1.8)
+ rails (7.1.1)
+ actioncable (= 7.1.1)
+ actionmailbox (= 7.1.1)
+ actionmailer (= 7.1.1)
+ actionpack (= 7.1.1)
+ actiontext (= 7.1.1)
+ actionview (= 7.1.1)
+ activejob (= 7.1.1)
+ activemodel (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ bundler (>= 1.15.0)
+ railties (= 7.1.1)
+ rails-dom-testing (2.2.0)
+ activesupport (>= 5.0.0)
+ minitest
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.6.0)
+ loofah (~> 2.21)
+ nokogiri (~> 1.14)
+ railties (7.1.1)
+ actionpack (= 7.1.1)
+ activesupport (= 7.1.1)
+ irb
+ rackup (>= 1.0.0)
+ rake (>= 12.2)
+ thor (~> 1.0, >= 1.2.2)
+ zeitwerk (~> 2.6)
+ rainbow (3.1.1)
+ rake (13.0.6)
+ rdoc (6.5.0)
+ psych (>= 4.0.0)
+ redis (5.0.7)
+ redis-client (>= 0.9.0)
+ redis-client (0.17.0)
+ connection_pool
+ regexp_parser (2.8.2)
+ reline (0.3.9)
+ io-console (~> 0.5)
+ rexml (3.2.6)
+ rubocop (1.57.0)
+ base64 (~> 0.1.1)
+ json (~> 2.3)
+ language_server-protocol (>= 3.17.0)
+ parallel (~> 1.10)
+ parser (>= 3.2.2.4)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.8, < 3.0)
+ rexml (>= 3.2.5, < 4.0)
+ rubocop-ast (>= 1.28.1, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.29.0)
+ parser (>= 3.2.1.0)
+ rubocop-capybara (2.19.0)
+ rubocop (~> 1.41)
+ rubocop-factory_bot (2.24.0)
+ rubocop (~> 1.33)
+ rubocop-minitest (0.32.2)
+ rubocop (>= 1.39, < 2.0)
+ rubocop-performance (1.19.1)
+ rubocop (>= 1.7.0, < 2.0)
+ rubocop-ast (>= 0.4.0)
+ rubocop-rails (2.21.2)
+ activesupport (>= 4.2.0)
+ rack (>= 1.1)
+ rubocop (>= 1.33.0, < 2.0)
+ ruby-progressbar (1.13.0)
+ ruby2_keywords (0.0.5)
+ rubyzip (2.3.2)
+ selenium-webdriver (4.14.0)
+ rexml (~> 3.2, >= 3.2.5)
+ rubyzip (>= 1.2.2, < 3.0)
+ websocket (~> 1.0)
+ shoulda-context (2.0.0)
+ shoulda-matchers (5.3.0)
+ activesupport (>= 5.2.0)
+ sidekiq (7.1.6)
+ concurrent-ruby (< 2)
+ connection_pool (>= 2.3.0)
+ rack (>= 2.2.4)
+ redis-client (>= 0.14.0)
+ smart_properties (1.17.0)
+ sprockets (4.2.1)
+ concurrent-ruby (~> 1.0)
+ rack (>= 2.2.4, < 4)
+ sprockets-rails (3.4.2)
+ actionpack (>= 5.2)
+ activesupport (>= 5.2)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.6.7-x86_64-darwin)
+ sqlite3 (1.6.7-x86_64-linux)
+ stimulus-rails (1.3.0)
+ railties (>= 6.0.0)
+ stringio (3.0.8)
+ thor (1.2.2)
+ timeout (0.4.0)
+ tomo (1.18.0)
+ turbo-rails (1.5.0)
+ actionpack (>= 6.0.0)
+ activejob (>= 6.0.0)
+ railties (>= 6.0.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (2.5.0)
+ web-console (4.2.1)
+ actionview (>= 6.0.0)
+ activemodel (>= 6.0.0)
+ bindex (>= 0.4.0)
+ railties (>= 6.0.0)
+ webrick (1.8.1)
+ websocket (1.2.10)
+ websocket-driver (0.7.6)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+ xpath (3.2.0)
+ nokogiri (~> 1.8)
+ zeitwerk (2.6.12)
+
+PLATFORMS
+ x86_64-darwin-22
+ x86_64-linux
+
+DEPENDENCIES
+ annotate
+ bootsnap
+ brakeman
+ bundler-audit
+ capybara
+ capybara-lockstep
+ debug
+ dotenv-rails
+ erb_lint
+ factory_bot_rails
+ good_migrations
+ importmap-rails
+ jbuilder
+ launchy
+ letter_opener
+ puma (>= 5.0)
+ rack-canonical-host
+ rack-mini-profiler
+ rails (~> 7.1.1)
+ redis (>= 4.0.1)
+ rubocop
+ rubocop-capybara
+ rubocop-factory_bot
+ rubocop-minitest
+ rubocop-performance
+ rubocop-rails
+ selenium-webdriver
+ shoulda-context
+ shoulda-matchers
+ sidekiq (~> 7.0)
+ sprockets-rails
+ sqlite3 (~> 1.4)
+ stimulus-rails
+ tomo (~> 1.18)
+ turbo-rails
+ tzinfo-data
+ web-console
+
+RUBY VERSION
+ ruby 3.2.2p53
+
+BUNDLED WITH
+ 2.4.20
diff --git a/examples/all/Procfile b/examples/all/Procfile
new file mode 100644
index 0000000..9672b1a
--- /dev/null
+++ b/examples/all/Procfile
@@ -0,0 +1,3 @@
+web: bundle exec puma -C config/puma.rb
+release: bundle exec rake db:migrate
+worker: bundle exec sidekiq -C config/sidekiq.yml
diff --git a/examples/all/README.md b/examples/all/README.md
new file mode 100644
index 0000000..533dc36
--- /dev/null
+++ b/examples/all/README.md
@@ -0,0 +1,70 @@
+# all_example
+
+This is a Rails 7.1 app.
+
+## Prerequisites
+
+This project requires:
+
+- Ruby (see [.ruby-version](./.ruby-version)), preferably managed using [rbenv](https://github.com/rbenv/rbenv)
+- Node 18 (LTS) or newer
+- Yarn 1.x (classic)
+
+On macOS, these [Homebrew](http://brew.sh) packages are recommended:
+
+```
+brew install rbenv
+brew install node
+brew install yarn
+```
+
+## Getting started
+
+### bin/setup
+
+Run this script to install necessary dependencies and prepare the Rails app to be started for the first time.
+
+```
+bin/setup
+```
+
+> [!NOTE]
+> The `bin/setup` script is idempotent and is designed to be run often. You should run it every time you pull code that introduces new dependencies or makes other significant changes to the project.
+
+### Run the app!
+
+Start the Rails server with this command:
+
+```
+bin/rails s
+```
+
+The app will be located at .
+
+## Development
+
+Use this command to run the full suite of automated tests and lint checks:
+
+```
+bin/rake
+```
+
+> [!NOTE]
+> Rake allows you to run all checks in parallel with the `-m` option. This is much faster, but since the output is interleaved, it may be harder to read.
+
+```
+bin/rake -m
+```
+
+### Fixing lint issues
+
+Some lint issues can be auto-corrected. To fix them, run:
+
+```
+bin/rake fix
+```
+
+> [!WARNING]
+> A small number of Rubocop's auto-corrections are considered "unsafe" and may
+> occasionally produce incorrect results. After running `fix`, you should
+> review the changes and make sure the code still works as intended.
diff --git a/examples/all/Rakefile b/examples/all/Rakefile
new file mode 100644
index 0000000..041ecad
--- /dev/null
+++ b/examples/all/Rakefile
@@ -0,0 +1,18 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative "config/application"
+
+Rails.application.load_tasks
+
+Rake::Task[:default].prerequisites.clear if Rake::Task.task_defined?(:default)
+
+desc "Run all checks"
+task default: %w[test:all erblint eslint stylelint rubocop] do
+ Thor::Base.shell.new.say_status :OK, "All checks passed!"
+end
+
+desc "Apply auto-corrections"
+task fix: %w[erblint:autocorrect eslint:autocorrect stylelint:autocorrect rubocop:autocorrect_all] do
+ Thor::Base.shell.new.say_status :OK, "All fixes applied!"
+end
diff --git a/examples/all/Thorfile b/examples/all/Thorfile
new file mode 100644
index 0000000..69dc768
--- /dev/null
+++ b/examples/all/Thorfile
@@ -0,0 +1,7 @@
+require_relative "config/environment" unless %w[-h --help help -T list -v version].include?(ARGV.first)
+
+class << Thor
+ def exit_on_failure?
+ true
+ end
+end
diff --git a/examples/all/app/assets/config/manifest.js b/examples/all/app/assets/config/manifest.js
new file mode 100644
index 0000000..ddd546a
--- /dev/null
+++ b/examples/all/app/assets/config/manifest.js
@@ -0,0 +1,4 @@
+//= link_tree ../images
+//= link_directory ../stylesheets .css
+//= link_tree ../../javascript .js
+//= link_tree ../../../vendor/javascript .js
diff --git a/examples/all/app/assets/images/.keep b/examples/all/app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/all/app/assets/stylesheets/application.css b/examples/all/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..288b9ab
--- /dev/null
+++ b/examples/all/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/examples/all/app/channels/application_cable/channel.rb b/examples/all/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000..d672697
--- /dev/null
+++ b/examples/all/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/examples/all/app/channels/application_cable/connection.rb b/examples/all/app/channels/application_cable/connection.rb
new file mode 100644
index 0000000..0ff5442
--- /dev/null
+++ b/examples/all/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/examples/all/app/controllers/application_controller.rb b/examples/all/app/controllers/application_controller.rb
new file mode 100644
index 0000000..80abb00
--- /dev/null
+++ b/examples/all/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ include BasicAuth
+end
diff --git a/examples/all/app/controllers/concerns/.keep b/examples/all/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/all/app/controllers/concerns/basic_auth.rb b/examples/all/app/controllers/concerns/basic_auth.rb
new file mode 100644
index 0000000..03b64f7
--- /dev/null
+++ b/examples/all/app/controllers/concerns/basic_auth.rb
@@ -0,0 +1,20 @@
+module BasicAuth
+ extend ActiveSupport::Concern
+
+ included do
+ before_action :require_basic_auth
+ end
+
+ private
+
+ def require_basic_auth
+ expected_username = ENV.fetch("BASIC_AUTH_USERNAME", nil)
+ expected_password = ENV.fetch("BASIC_AUTH_PASSWORD", nil)
+ return true if expected_username.blank? || expected_password.blank?
+
+ authenticate_or_request_with_http_basic do |username, password|
+ ActiveSupport::SecurityUtils.secure_compare(username, expected_username) & \
+ ActiveSupport::SecurityUtils.secure_compare(password, expected_password)
+ end
+ end
+end
diff --git a/examples/all/app/controllers/home_controller.rb b/examples/all/app/controllers/home_controller.rb
new file mode 100644
index 0000000..95f2992
--- /dev/null
+++ b/examples/all/app/controllers/home_controller.rb
@@ -0,0 +1,4 @@
+class HomeController < ApplicationController
+ def index
+ end
+end
diff --git a/examples/all/app/helpers/application_helper.rb b/examples/all/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/examples/all/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/examples/all/app/javascript/application.js b/examples/all/app/javascript/application.js
new file mode 100644
index 0000000..874eae8
--- /dev/null
+++ b/examples/all/app/javascript/application.js
@@ -0,0 +1,3 @@
+// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
+import "@hotwired/turbo-rails";
+import "controllers";
diff --git a/examples/all/app/javascript/controllers/application.js b/examples/all/app/javascript/controllers/application.js
new file mode 100644
index 0000000..d6fe5eb
--- /dev/null
+++ b/examples/all/app/javascript/controllers/application.js
@@ -0,0 +1,9 @@
+import { Application } from "@hotwired/stimulus";
+
+const application = Application.start();
+
+// Configure Stimulus development experience
+application.debug = false;
+window.Stimulus = application;
+
+export { application };
diff --git a/examples/all/app/javascript/controllers/hello_controller.js b/examples/all/app/javascript/controllers/hello_controller.js
new file mode 100644
index 0000000..c22b8f3
--- /dev/null
+++ b/examples/all/app/javascript/controllers/hello_controller.js
@@ -0,0 +1,7 @@
+import { Controller } from "@hotwired/stimulus";
+
+export default class extends Controller {
+ connect() {
+ this.element.textContent = "Hello World!";
+ }
+}
diff --git a/examples/all/app/javascript/controllers/index.js b/examples/all/app/javascript/controllers/index.js
new file mode 100644
index 0000000..74c6c0a
--- /dev/null
+++ b/examples/all/app/javascript/controllers/index.js
@@ -0,0 +1,11 @@
+// Import and register all your controllers from the importmap under controllers/*
+
+import { application } from "controllers/application";
+
+// Eager load all controllers defined in the import map under controllers/**/*_controller
+import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading";
+eagerLoadControllersFrom("controllers", application);
+
+// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
+// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
+// lazyLoadControllersFrom("controllers", application)
diff --git a/examples/all/app/jobs/application_job.rb b/examples/all/app/jobs/application_job.rb
new file mode 100644
index 0000000..d394c3d
--- /dev/null
+++ b/examples/all/app/jobs/application_job.rb
@@ -0,0 +1,7 @@
+class ApplicationJob < ActiveJob::Base
+ # Automatically retry jobs that encountered a deadlock
+ # retry_on ActiveRecord::Deadlocked
+
+ # Most jobs are safe to ignore if the underlying records are no longer available
+ # discard_on ActiveJob::DeserializationError
+end
diff --git a/examples/all/app/mailers/application_mailer.rb b/examples/all/app/mailers/application_mailer.rb
new file mode 100644
index 0000000..3c34c81
--- /dev/null
+++ b/examples/all/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: "from@example.com"
+ layout "mailer"
+end
diff --git a/examples/all/app/models/application_record.rb b/examples/all/app/models/application_record.rb
new file mode 100644
index 0000000..b63caeb
--- /dev/null
+++ b/examples/all/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ primary_abstract_class
+end
diff --git a/examples/all/app/models/concerns/.keep b/examples/all/app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/all/app/views/home/index.html.erb b/examples/all/app/views/home/index.html.erb
new file mode 100644
index 0000000..cd258d0
--- /dev/null
+++ b/examples/all/app/views/home/index.html.erb
@@ -0,0 +1,2 @@
+<% provide(:title, "Home") %>
+
Find me in app/views/home/index.html.erb
diff --git a/examples/all/app/views/layouts/application.html.erb b/examples/all/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..eef8778
--- /dev/null
+++ b/examples/all/app/views/layouts/application.html.erb
@@ -0,0 +1,18 @@
+
+
+
+ <%= capybara_lockstep if defined?(Capybara::Lockstep) %>
+ <%= content_for?(:title) ? strip_tags(yield(:title)) : "All Example" %>
+
+
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
+ <%= javascript_importmap_tags %>
+
+
+
+ <%= yield %>
+
+
diff --git a/examples/all/app/views/layouts/mailer.html.erb b/examples/all/app/views/layouts/mailer.html.erb
new file mode 100644
index 0000000..3aac900
--- /dev/null
+++ b/examples/all/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/examples/all/app/views/layouts/mailer.text.erb b/examples/all/app/views/layouts/mailer.text.erb
new file mode 100644
index 0000000..37f0bdd
--- /dev/null
+++ b/examples/all/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/examples/all/bin/brakeman b/examples/all/bin/brakeman
new file mode 100755
index 0000000..b4fe8de
--- /dev/null
+++ b/examples/all/bin/brakeman
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'brakeman' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("brakeman", "brakeman")
diff --git a/examples/all/bin/bundle b/examples/all/bin/bundle
new file mode 100755
index 0000000..42c7fd7
--- /dev/null
+++ b/examples/all/bin/bundle
@@ -0,0 +1,109 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../Gemfile", __dir__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_requirement
+ @bundler_requirement ||=
+ env_var_version ||
+ cli_arg_version ||
+ bundler_requirement_for(lockfile_version)
+ end
+
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
+
+ bundler_gem_version = Gem::Version.new(version)
+
+ bundler_gem_version.approximate_recommendation
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ 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}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
diff --git a/examples/all/bin/bundle-audit b/examples/all/bin/bundle-audit
new file mode 100755
index 0000000..a0e7ba0
--- /dev/null
+++ b/examples/all/bin/bundle-audit
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle-audit' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("bundler-audit", "bundle-audit")
diff --git a/examples/all/bin/bundler-audit b/examples/all/bin/bundler-audit
new file mode 100755
index 0000000..334a737
--- /dev/null
+++ b/examples/all/bin/bundler-audit
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundler-audit' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("bundler-audit", "bundler-audit")
diff --git a/examples/all/bin/docker-entrypoint b/examples/all/bin/docker-entrypoint
new file mode 100755
index 0000000..67ef493
--- /dev/null
+++ b/examples/all/bin/docker-entrypoint
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+# If running the rails server then create or migrate existing database
+if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
diff --git a/examples/all/bin/erblint b/examples/all/bin/erblint
new file mode 100755
index 0000000..63d662c
--- /dev/null
+++ b/examples/all/bin/erblint
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'erblint' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("erb_lint", "erblint")
diff --git a/examples/all/bin/importmap b/examples/all/bin/importmap
new file mode 100755
index 0000000..36502ab
--- /dev/null
+++ b/examples/all/bin/importmap
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require_relative "../config/application"
+require "importmap/commands"
diff --git a/examples/all/bin/rails b/examples/all/bin/rails
new file mode 100755
index 0000000..efc0377
--- /dev/null
+++ b/examples/all/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
diff --git a/examples/all/bin/rake b/examples/all/bin/rake
new file mode 100755
index 0000000..4fbf10b
--- /dev/null
+++ b/examples/all/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
diff --git a/examples/all/bin/rubocop b/examples/all/bin/rubocop
new file mode 100755
index 0000000..369a05b
--- /dev/null
+++ b/examples/all/bin/rubocop
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'rubocop' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("rubocop", "rubocop")
diff --git a/examples/all/bin/setup b/examples/all/bin/setup
new file mode 100755
index 0000000..963926c
--- /dev/null
+++ b/examples/all/bin/setup
@@ -0,0 +1,107 @@
+#!/usr/bin/env ruby
+
+# This script is a way to set up or update your development environment automatically.
+# This script is idempotent, so that you can run it at any time and get an expectable outcome.
+# Add necessary setup steps to this method.
+def setup!
+ run "bundle install" if bundle_needed?
+ run "overcommit --install" if overcommit_installable?
+ run "bin/rails db:prepare" if database_present?
+ run "yarn install" if yarn_needed?
+ run "bin/rails tmp:create" if tmp_missing?
+ env ".env", from: ".env.sample"
+ run "bin/rails restart"
+
+ if git_safe_needed?
+ say_status :notice,
+ "Remember to run #{colorize("mkdir -p .git/safe", :yellow)} to trust the binstubs in this project",
+ :magenta
+ end
+
+ say_status :Ready!,
+ "Use #{colorize("bin/rails s", :yellow)} to start the app, " \
+ "or #{colorize("bin/rake", :yellow)} to run tests"
+end
+
+def run(command, echo: true, silent: false, exception: true)
+ say_status(:run, command, :blue) if echo
+ with_original_bundler_env do
+ options = silent ? {out: File::NULL, err: File::NULL} : {}
+ system(command, exception:, **options)
+ end
+end
+
+def run?(command)
+ run command, silent: true, echo: false, exception: false
+end
+
+def bundle_needed?
+ !run("bundle check", silent: true, exception: false)
+end
+
+def overcommit_installable?
+ File.exist?(".overcommit.yml") && !File.exist?(".git/hooks/overcommit-hook") && run?("overcommit -v")
+end
+
+def database_present?
+ File.exist?("config/database.yml")
+end
+
+def yarn_needed?
+ File.exist?("yarn.lock") && !run("yarn check --check-files", silent: true, exception: false)
+end
+
+def tmp_missing?
+ !Dir.exist?("tmp/pids")
+end
+
+def git_safe_needed?
+ ENV["PATH"].include?(".git/safe/../../bin") && !Dir.exist?(".git/safe")
+end
+
+def with_original_bundler_env(&)
+ return yield unless defined?(Bundler)
+
+ Bundler.with_original_env(&)
+end
+
+def env(env_file, from:)
+ return unless File.exist?(from)
+
+ unless File.exist?(env_file)
+ say_status(:copy, "#{from} → #{env_file}", :magenta)
+ require "fileutils"
+ FileUtils.cp(from, env_file)
+ end
+
+ keys = ->(f) { File.readlines(f).filter_map { |l| l[/^([^#\s][^=\s]*)/, 1] } }
+
+ missing = keys[from] - keys[env_file]
+ return if missing.empty?
+
+ say_status(:WARNING, "Your #{env_file} file is missing #{missing.join(", ")}. Refer to #{from} for details.", :red)
+end
+
+def say_status(label, message, color = :green)
+ label = label.to_s.rjust(12)
+ puts [colorize(label, color), message].join(" ")
+end
+
+def colorize(str, color)
+ return str unless color_supported?
+
+ code = {red: 31, green: 32, yellow: 33, blue: 34, magenta: 35}.fetch(color)
+ "\e[0;#{code};49m#{str}\e[0m"
+end
+
+def color_supported?
+ if ENV["TERM"] == "dumb" || !ENV["NO_COLOR"].to_s.empty?
+ false
+ else
+ [$stdout, $stderr].all? { |io| io.respond_to?(:tty?) && io.tty? }
+ end
+end
+
+Dir.chdir(File.expand_path("..", __dir__)) do
+ setup!
+end
diff --git a/examples/all/bin/sidekiq b/examples/all/bin/sidekiq
new file mode 100755
index 0000000..e7af7e7
--- /dev/null
+++ b/examples/all/bin/sidekiq
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'sidekiq' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("sidekiq", "sidekiq")
diff --git a/examples/all/bin/sidekiqmon b/examples/all/bin/sidekiqmon
new file mode 100755
index 0000000..0c90798
--- /dev/null
+++ b/examples/all/bin/sidekiqmon
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'sidekiqmon' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("sidekiq", "sidekiqmon")
diff --git a/examples/all/bin/thor b/examples/all/bin/thor
new file mode 100755
index 0000000..ec40115
--- /dev/null
+++ b/examples/all/bin/thor
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'thor' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("thor", "thor")
diff --git a/examples/all/bin/tomo b/examples/all/bin/tomo
new file mode 100755
index 0000000..373d519
--- /dev/null
+++ b/examples/all/bin/tomo
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'tomo' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("tomo", "tomo")
diff --git a/examples/all/config.ru b/examples/all/config.ru
new file mode 100644
index 0000000..7c48621
--- /dev/null
+++ b/examples/all/config.ru
@@ -0,0 +1,7 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+use Rack::CanonicalHost, ENV.fetch("RAILS_HOSTNAME", nil) if ENV["RAILS_HOSTNAME"].present?
+run Rails.application
+Rails.application.load_server
diff --git a/examples/all/config/application.rb b/examples/all/config/application.rb
new file mode 100644
index 0000000..a001bf1
--- /dev/null
+++ b/examples/all/config/application.rb
@@ -0,0 +1,27 @@
+require_relative "boot"
+
+require "rails/all"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module AllExample
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 7.1
+
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w[puma/plugin assets tasks])
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+ end
+end
diff --git a/examples/all/config/boot.rb b/examples/all/config/boot.rb
new file mode 100644
index 0000000..988a5dd
--- /dev/null
+++ b/examples/all/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/examples/all/config/cable.yml b/examples/all/config/cable.yml
new file mode 100644
index 0000000..2ff1f09
--- /dev/null
+++ b/examples/all/config/cable.yml
@@ -0,0 +1,11 @@
+development:
+ adapter: redis
+ url: redis://localhost:6379/1
+
+test:
+ adapter: test
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: all_example_production
diff --git a/examples/all/config/credentials.yml.enc b/examples/all/config/credentials.yml.enc
new file mode 100644
index 0000000..8e7e7b4
--- /dev/null
+++ b/examples/all/config/credentials.yml.enc
@@ -0,0 +1 @@
+wueK2O52NOOWW9MOWZtGyakpXf2UOx3rLkn6s9lltXIeoM4j8fl2vvKI8i2bXMiWmxfqyTEIj9csPh5dOAwy6pncEfvilewz1O8VwYNwuGFvLA0/9mUPLYAmyKr4w4/ctGrPPawzS1h1SVdrww92h+mJKz9+M295dyf9SvAI5OUC+PMxMAjr3UW3CnGs+xkScoR/IHcukjThIKj3FEsEjDDb/i4AHNx+Ds0U5oGDjCajYbdrbyQQnOk2kcEPI69wkijQhpDUwV8AxrrUFlPk/K7TOBD4kxQAnMcbh20ouAk23C/xYOswpsRL0DTirnfPMqm/hWD+ADKLKI3GX1kdb8KtSX4ADlDxodJwvW0PaFFnVUlo3uxxFU6quRC3mnXfBEZTH/t4k48YCEch2XmluhkplpWp--aVUiHKB0st8PZi3C--LU32TJZ8Gm30XvYt8dje6g==
\ No newline at end of file
diff --git a/examples/all/config/database.yml b/examples/all/config/database.yml
new file mode 100644
index 0000000..df58ab3
--- /dev/null
+++ b/examples/all/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite. Versions 3.8.0 and up are supported.
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem "sqlite3"
+#
+default: &default
+ adapter: sqlite3
+ pool: <%= [5, *ENV.values_at("RAILS_MAX_THREADS", "SIDEKIQ_CONCURRENCY")].map(&:to_i).max %>
+ timeout: 5000
+
+development:
+ <<: *default
+ database: storage/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: storage/test.sqlite3
+
+production:
+ <<: *default
+ database: storage/production.sqlite3
diff --git a/examples/all/config/environment.rb b/examples/all/config/environment.rb
new file mode 100644
index 0000000..cac5315
--- /dev/null
+++ b/examples/all/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/examples/all/config/environments/development.rb b/examples/all/config/environments/development.rb
new file mode 100644
index 0000000..538f787
--- /dev/null
+++ b/examples/all/config/environments/development.rb
@@ -0,0 +1,80 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.enable_reloading = true
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing
+ config.server_timing = true
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ config.action_mailer.delivery_method = :letter_opener
+ config.action_mailer.default_url_options = {host: "localhost:3000"}
+ config.action_mailer.asset_host = "http://localhost:3000"
+
+ config.action_mailer.perform_caching = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/examples/all/config/environments/production.rb b/examples/all/config/environments/production.rb
new file mode 100644
index 0000000..d2c170a
--- /dev/null
+++ b/examples/all/config/environments/production.rb
@@ -0,0 +1,102 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.enable_reloading = false
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
+ # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
+ config.public_file_server.enabled = true
+
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Mount Action Cable outside main process or domain.
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = "wss://example.com/cable"
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+ # config.assume_ssl = true
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ config.force_ssl = ENV["RAILS_DISABLE_SSL"].blank?
+
+ # Log to STDOUT by default
+ config.logger = ActiveSupport::Logger.new($stdout)
+ .tap { |logger| logger.formatter = Logger::Formatter.new }
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
+
+ # Prepend all log lines with the following tags.
+ config.log_tags = [:request_id]
+
+ # Info include generic and useful information about system operation, but avoids logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+ # want to log everything, set the level to "debug".
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Use a real queuing backend for Active Job.
+ config.active_job.queue_adapter = :sidekiq
+ config.active_job.queue_name_prefix = nil # Not supported by sidekiq
+
+ config.action_mailer.perform_caching = false
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = {
+ host: ENV.fetch("RAILS_HOSTNAME", "app.example.com"),
+ protocol: "https"
+ }
+ config.action_mailer.asset_host = "https://#{ENV.fetch("RAILS_HOSTNAME", "app.example.com")}"
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
+end
diff --git a/examples/all/config/environments/test.rb b/examples/all/config/environments/test.rb
new file mode 100644
index 0000000..0996d45
--- /dev/null
+++ b/examples/all/config/environments/test.rb
@@ -0,0 +1,66 @@
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
+
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
+ }
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.cache_store = :null_store
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = :rescuable
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ config.action_mailer.perform_caching = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+ config.action_mailer.default_url_options = {host: "localhost:3000"}
+ config.action_mailer.asset_host = "http://localhost:3000"
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/examples/all/config/importmap.rb b/examples/all/config/importmap.rb
new file mode 100644
index 0000000..8dce42d
--- /dev/null
+++ b/examples/all/config/importmap.rb
@@ -0,0 +1,7 @@
+# Pin npm packages by running ./bin/importmap
+
+pin "application", preload: true
+pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
+pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
+pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
+pin_all_from "app/javascript/controllers", under: "controllers"
diff --git a/examples/all/config/initializers/assets.rb b/examples/all/config/initializers/assets.rb
new file mode 100644
index 0000000..2eeef96
--- /dev/null
+++ b/examples/all/config/initializers/assets.rb
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/examples/all/config/initializers/content_security_policy.rb b/examples/all/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000..b3076b3
--- /dev/null
+++ b/examples/all/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
diff --git a/examples/all/config/initializers/filter_parameter_logging.rb b/examples/all/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..c2d89e2
--- /dev/null
+++ b/examples/all/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+]
diff --git a/examples/all/config/initializers/generators.rb b/examples/all/config/initializers/generators.rb
new file mode 100644
index 0000000..10a2561
--- /dev/null
+++ b/examples/all/config/initializers/generators.rb
@@ -0,0 +1,8 @@
+Rails.application.config.generators do |g|
+ # Generate "users_factory.rb" instead of "users.rb"
+ g.factory_bot suffix: "factory"
+ g.test_framework :test_unit, fixture: false, fixture_replacement: :factory_bot
+ # Disable generators we don't need.
+ g.javascripts false
+ g.stylesheets false
+end
diff --git a/examples/all/config/initializers/inflections.rb b/examples/all/config/initializers/inflections.rb
new file mode 100644
index 0000000..3860f65
--- /dev/null
+++ b/examples/all/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
diff --git a/examples/all/config/initializers/permissions_policy.rb b/examples/all/config/initializers/permissions_policy.rb
new file mode 100644
index 0000000..7db3b95
--- /dev/null
+++ b/examples/all/config/initializers/permissions_policy.rb
@@ -0,0 +1,13 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide HTTP permissions policy. For further
+# information see: https://developers.google.com/web/updates/2018/06/feature-policy
+
+# Rails.application.config.permissions_policy do |policy|
+# policy.camera :none
+# policy.gyroscope :none
+# policy.microphone :none
+# policy.usb :none
+# policy.fullscreen :self
+# policy.payment :self, "https://secure.example.com"
+# end
diff --git a/examples/all/config/initializers/rack_mini_profiler.rb b/examples/all/config/initializers/rack_mini_profiler.rb
new file mode 100644
index 0000000..bef02dc
--- /dev/null
+++ b/examples/all/config/initializers/rack_mini_profiler.rb
@@ -0,0 +1,4 @@
+return unless defined?(Rack::MiniProfiler)
+
+# https://github.com/MiniProfiler/rack-mini-profiler#configuration-options
+Rack::MiniProfiler.config.enable_hotwire_turbo_drive_support = true
diff --git a/examples/all/config/initializers/sidekiq.rb b/examples/all/config/initializers/sidekiq.rb
new file mode 100644
index 0000000..a3d4d08
--- /dev/null
+++ b/examples/all/config/initializers/sidekiq.rb
@@ -0,0 +1,32 @@
+return unless defined?(Sidekiq)
+
+# Disable SSL certificate verification if using Heroku Redis
+# redis_opts = {
+# ssl_params: {
+# verify_mode: OpenSSL::SSL::VERIFY_NONE
+# }
+# }
+# Sidekiq.configure_server do |config|
+# config.redis = redis_opts
+# end
+# Sidekiq.configure_client do |config|
+# config.redis = redis_opts
+# end
+
+# Enable Rails CurrentAttributes to flow transparently through to Sidekiq jobs
+# require "sidekiq/middleware/current_attributes"
+# Sidekiq::CurrentAttributes.persist(Myapp::Current)
+
+require "sidekiq/web"
+
+Sidekiq::Web.app_url = "/"
+
+sidekiq_username = ENV.fetch("SIDEKIQ_WEB_USERNAME", nil)
+sidekiq_password = ENV.fetch("SIDEKIQ_WEB_PASSWORD", nil)
+
+Sidekiq::Web.use(Rack::Auth::Basic, "Sidekiq") do |username, password|
+ if sidekiq_username.present? && sidekiq_password.present?
+ ActiveSupport::SecurityUtils.secure_compare(username, sidekiq_username) &
+ ActiveSupport::SecurityUtils.secure_compare(password, sidekiq_password)
+ end
+end
diff --git a/examples/all/config/locales/en.yml b/examples/all/config/locales/en.yml
new file mode 100644
index 0000000..6c349ae
--- /dev/null
+++ b/examples/all/config/locales/en.yml
@@ -0,0 +1,31 @@
+# Files in the config/locales directory are used for internationalization and
+# are automatically loaded by Rails. If you want to use locales other than
+# English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more about the API, please read the Rails Internationalization guide
+# at https://guides.rubyonrails.org/i18n.html.
+#
+# Be aware that YAML interprets the following case-insensitive strings as
+# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
+# must be quoted to be interpreted as strings. For example:
+#
+# en:
+# "yes": yup
+# enabled: "ON"
+
+en:
+ hello: "Hello world"
diff --git a/examples/all/config/puma.rb b/examples/all/config/puma.rb
new file mode 100644
index 0000000..f7032f1
--- /dev/null
+++ b/examples/all/config/puma.rb
@@ -0,0 +1,39 @@
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
+
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers: a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum; this matches the default thread size of Active Record.
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
+threads min_threads_count, max_threads_count
+
+# Specifies that the worker count should equal the number of processors in production.
+if ENV["RAILS_ENV"] == "production"
+ require "concurrent-ruby"
+ worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
+ workers worker_count if worker_count > 1
+end
+
+# Specifies the `worker_timeout` threshold that Puma will use to wait before
+# terminating a worker in development environments.
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT", 3000)
+
+# Specifies the `environment` that Puma will run in.
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the `pidfile` that Puma will use.
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
+
+# Automatically open the browser when in development
+require_relative "../lib/puma/plugin/open"
+plugin :open
diff --git a/examples/all/config/routes.rb b/examples/all/config/routes.rb
new file mode 100644
index 0000000..3d16922
--- /dev/null
+++ b/examples/all/config/routes.rb
@@ -0,0 +1,12 @@
+Rails.application.routes.draw do
+ mount Sidekiq::Web => "/sidekiq" if defined?(Sidekiq)
+ root "home#index"
+ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
+
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
+ get "up" => "rails/health#show", as: :rails_health_check
+
+ # Defines the root path route ("/")
+ # root "posts#index"
+end
diff --git a/examples/all/config/sidekiq.yml b/examples/all/config/sidekiq.yml
new file mode 100644
index 0000000..c7a5d4c
--- /dev/null
+++ b/examples/all/config/sidekiq.yml
@@ -0,0 +1,5 @@
+---
+:queues:
+ - default
+
+:concurrency: <%= ENV["SIDEKIQ_CONCURRENCY"] || ENV["RAILS_MAX_THREADS"] || 5 %>
diff --git a/examples/all/config/storage.yml b/examples/all/config/storage.yml
new file mode 100644
index 0000000..4942ab6
--- /dev/null
+++ b/examples/all/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/examples/all/db/schema.rb b/examples/all/db/schema.rb
new file mode 100644
index 0000000..d4a2a0c
--- /dev/null
+++ b/examples/all/db/schema.rb
@@ -0,0 +1,14 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[7.1].define(version: 0) do
+end
diff --git a/examples/all/db/seeds.rb b/examples/all/db/seeds.rb
new file mode 100644
index 0000000..4fbd6ed
--- /dev/null
+++ b/examples/all/db/seeds.rb
@@ -0,0 +1,9 @@
+# This file should ensure the existence of records required to run the application in every environment (production,
+# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Example:
+#
+# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
+# MovieGenre.find_or_create_by!(name: genre_name)
+# end
diff --git a/examples/all/lib/assets/.keep b/examples/all/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/all/lib/puma/plugin/open.rb b/examples/all/lib/puma/plugin/open.rb
new file mode 100644
index 0000000..d29d7ce
--- /dev/null
+++ b/examples/all/lib/puma/plugin/open.rb
@@ -0,0 +1,14 @@
+require "puma/plugin"
+
+Puma::Plugin.create do
+ def start(launcher)
+ return unless defined?(Rails) && defined?(Launchy)
+ return unless Rails.env.development?
+
+ binding = launcher.options[:binds].grep(/^tcp|ssl/).first
+ return if binding.nil?
+
+ url = binding.sub(/^tcp/, "http").sub(/^ssl/, "https").sub("0.0.0.0", "localhost")
+ Launchy.open(url)
+ end
+end
diff --git a/examples/all/lib/tasks/.keep b/examples/all/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/all/lib/tasks/auto_annotate_models.rake b/examples/all/lib/tasks/auto_annotate_models.rake
new file mode 100644
index 0000000..4d0ec96
--- /dev/null
+++ b/examples/all/lib/tasks/auto_annotate_models.rake
@@ -0,0 +1,52 @@
+return unless Rails.env.development?
+
+require "annotate"
+task :set_annotation_options do # rubocop:disable Metrics/BlockLength
+ # You can override any of these by setting an environment variable of the same name.
+ Annotate.set_defaults(
+ "routes" => "false",
+ "models" => "true",
+ "position_in_routes" => "before",
+ "position_in_class" => "before",
+ "position_in_test" => "before",
+ "position_in_fixture" => "before",
+ "position_in_factory" => "before",
+ "position_in_serializer" => "before",
+ "show_foreign_keys" => "true",
+ "show_complete_foreign_keys" => "false",
+ "show_indexes" => "true",
+ "simple_indexes" => "false",
+ "model_dir" => "app/models",
+ "root_dir" => "",
+ "include_version" => "false",
+ "require" => "",
+ "exclude_tests" => "true",
+ "exclude_fixtures" => "false",
+ "exclude_factories" => "false",
+ "exclude_serializers" => "false",
+ "exclude_scaffolds" => "true",
+ "exclude_controllers" => "true",
+ "exclude_helpers" => "true",
+ "exclude_sti_subclasses" => "false",
+ "ignore_model_sub_dir" => "false",
+ "ignore_columns" => nil,
+ "ignore_routes" => nil,
+ "ignore_unknown_models" => "false",
+ "hide_limit_column_types" => "integer,bigint,boolean",
+ "hide_default_column_types" => "json,jsonb,hstore",
+ "skip_on_db_migrate" => "false",
+ "format_bare" => "true",
+ "format_rdoc" => "false",
+ "format_markdown" => "false",
+ "sort" => "false",
+ "force" => "false",
+ "frozen" => "false",
+ "classified_sort" => "true",
+ "trace" => "false",
+ "wrapper_open" => nil,
+ "wrapper_close" => nil,
+ "with_comment" => "true"
+ )
+end
+
+Annotate.load_tasks
diff --git a/examples/all/lib/tasks/erblint.rake b/examples/all/lib/tasks/erblint.rake
new file mode 100644
index 0000000..f36bd59
--- /dev/null
+++ b/examples/all/lib/tasks/erblint.rake
@@ -0,0 +1,11 @@
+desc "Run erblint"
+task :erblint do
+ sh "bin/erblint --lint-all"
+end
+
+namespace :erblint do
+ desc "Autocorrect erblint offenses"
+ task :autocorrect do
+ sh "bin/erblint --lint-all -a"
+ end
+end
diff --git a/examples/all/lib/tasks/eslint.rake b/examples/all/lib/tasks/eslint.rake
new file mode 100644
index 0000000..10d8db7
--- /dev/null
+++ b/examples/all/lib/tasks/eslint.rake
@@ -0,0 +1,11 @@
+desc "Run ESLint"
+task :eslint do
+ sh "yarn lint:js"
+end
+
+namespace :eslint do
+ desc "Autocorrect ESLint offenses"
+ task :autocorrect do
+ sh "yarn fix:js"
+ end
+end
diff --git a/examples/all/lib/tasks/rubocop.rake b/examples/all/lib/tasks/rubocop.rake
new file mode 100644
index 0000000..7322c55
--- /dev/null
+++ b/examples/all/lib/tasks/rubocop.rake
@@ -0,0 +1,4 @@
+return unless Gem.loaded_specs.key?("rubocop")
+
+require "rubocop/rake_task"
+RuboCop::RakeTask.new
diff --git a/examples/all/lib/tasks/stylelint.rake b/examples/all/lib/tasks/stylelint.rake
new file mode 100644
index 0000000..fd38be1
--- /dev/null
+++ b/examples/all/lib/tasks/stylelint.rake
@@ -0,0 +1,11 @@
+desc "Run Stylelint"
+task :stylelint do
+ sh "yarn lint:css"
+end
+
+namespace :stylelint do
+ desc "Autocorrect Stylelint offenses"
+ task :autocorrect do
+ sh "yarn fix:css"
+ end
+end
diff --git a/examples/all/log/.keep b/examples/all/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/all/package.json b/examples/all/package.json
new file mode 100644
index 0000000..db9f28f
--- /dev/null
+++ b/examples/all/package.json
@@ -0,0 +1,26 @@
+{
+ "private": true,
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "devDependencies": {
+ "@types/eslint": "^8.44.4",
+ "eslint": "^8.51.0",
+ "eslint-config-prettier": "^9.0.0",
+ "eslint-plugin-prettier": "^5.0.1",
+ "npm-run-all": "^4.1.5",
+ "prettier": "^3.0.3",
+ "stylelint": "^15.10.3",
+ "stylelint-config-standard": "^34.0.0",
+ "stylelint-declaration-strict-value": "^1.9.2",
+ "stylelint-prettier": "^4.0.2"
+ },
+ "scripts": {
+ "lint:js": "eslint 'app/{components,frontend,javascript}/**/*.{js,jsx,ts,tsx}'",
+ "fix:js": "npm run -- lint:js --fix",
+ "lint": "npm-run-all lint:**",
+ "fix": "npm-run-all fix:**",
+ "lint:css": "stylelint 'app/{components,frontend,assets/stylesheets}/**/*.css'",
+ "fix:css": "npm run -- lint:css --fix"
+ }
+}
diff --git a/examples/all/public/404.html b/examples/all/public/404.html
new file mode 100644
index 0000000..2be3af2
--- /dev/null
+++ b/examples/all/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/all/public/422.html b/examples/all/public/422.html
new file mode 100644
index 0000000..c08eac0
--- /dev/null
+++ b/examples/all/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/all/public/500.html b/examples/all/public/500.html
new file mode 100644
index 0000000..78a030a
--- /dev/null
+++ b/examples/all/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
diff --git a/examples/default/app/views/layouts/application.html.erb b/examples/default/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..438996f
--- /dev/null
+++ b/examples/default/app/views/layouts/application.html.erb
@@ -0,0 +1,17 @@
+
+
+
+ <%= content_for?(:title) ? strip_tags(yield(:title)) : "Default Example" %>
+
+
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
+ <%= javascript_importmap_tags %>
+
+
+
+ <%= yield %>
+
+
diff --git a/examples/default/app/views/layouts/mailer.html.erb b/examples/default/app/views/layouts/mailer.html.erb
new file mode 100644
index 0000000..3aac900
--- /dev/null
+++ b/examples/default/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/examples/default/app/views/layouts/mailer.text.erb b/examples/default/app/views/layouts/mailer.text.erb
new file mode 100644
index 0000000..37f0bdd
--- /dev/null
+++ b/examples/default/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/examples/default/bin/bundle b/examples/default/bin/bundle
new file mode 100755
index 0000000..42c7fd7
--- /dev/null
+++ b/examples/default/bin/bundle
@@ -0,0 +1,109 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../Gemfile", __dir__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_requirement
+ @bundler_requirement ||=
+ env_var_version ||
+ cli_arg_version ||
+ bundler_requirement_for(lockfile_version)
+ end
+
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
+
+ bundler_gem_version = Gem::Version.new(version)
+
+ bundler_gem_version.approximate_recommendation
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ 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}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
diff --git a/examples/default/bin/docker-entrypoint b/examples/default/bin/docker-entrypoint
new file mode 100755
index 0000000..67ef493
--- /dev/null
+++ b/examples/default/bin/docker-entrypoint
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+# If running the rails server then create or migrate existing database
+if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
diff --git a/examples/default/bin/importmap b/examples/default/bin/importmap
new file mode 100755
index 0000000..36502ab
--- /dev/null
+++ b/examples/default/bin/importmap
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require_relative "../config/application"
+require "importmap/commands"
diff --git a/examples/default/bin/rails b/examples/default/bin/rails
new file mode 100755
index 0000000..efc0377
--- /dev/null
+++ b/examples/default/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
diff --git a/examples/default/bin/rake b/examples/default/bin/rake
new file mode 100755
index 0000000..4fbf10b
--- /dev/null
+++ b/examples/default/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
diff --git a/examples/default/bin/setup b/examples/default/bin/setup
new file mode 100755
index 0000000..bac8843
--- /dev/null
+++ b/examples/default/bin/setup
@@ -0,0 +1,107 @@
+#!/usr/bin/env ruby
+
+# This script is a way to set up or update your development environment automatically.
+# This script is idempotent, so that you can run it at any time and get an expectable outcome.
+# Add necessary setup steps to this method.
+def setup!
+ run "bundle install" if bundle_needed?
+ run "overcommit --install" if overcommit_installable?
+ run "bin/rails db:prepare" if database_present?
+ run "yarn install" if yarn_needed?
+ run "bin/rails tmp:create" if tmp_missing?
+ env ".env", from: ".env.sample"
+ run "bin/rails restart"
+
+ if git_safe_needed?
+ say_status :notice,
+ "Remember to run #{colorize("mkdir -p .git/safe", :yellow)} to trust the binstubs in this project",
+ :magenta
+ end
+
+ say_status :Ready!,
+ "Use #{colorize("bin/rails s", :yellow)} to start the app, " \
+ "or #{colorize("bin/rake", :yellow)} to run tests"
+end
+
+def run(command, echo: true, silent: false, exception: true)
+ say_status(:run, command, :blue) if echo
+ with_original_bundler_env do
+ options = silent ? {out: File::NULL, err: File::NULL} : {}
+ system(command, exception: exception, **options)
+ end
+end
+
+def run?(command)
+ run command, silent: true, echo: false, exception: false
+end
+
+def bundle_needed?
+ !run("bundle check", silent: true, exception: false)
+end
+
+def overcommit_installable?
+ File.exist?(".overcommit.yml") && !File.exist?(".git/hooks/overcommit-hook") && run?("overcommit -v")
+end
+
+def database_present?
+ File.exist?("config/database.yml")
+end
+
+def yarn_needed?
+ File.exist?("yarn.lock") && !run("yarn check --check-files", silent: true, exception: false)
+end
+
+def tmp_missing?
+ !Dir.exist?("tmp/pids")
+end
+
+def git_safe_needed?
+ ENV["PATH"].include?(".git/safe/../../bin") && !Dir.exist?(".git/safe")
+end
+
+def with_original_bundler_env(&block)
+ return yield unless defined?(Bundler)
+
+ Bundler.with_original_env(&block)
+end
+
+def env(env_file, from:)
+ return unless File.exist?(from)
+
+ unless File.exist?(env_file)
+ say_status(:copy, "#{from} → #{env_file}", :magenta)
+ require "fileutils"
+ FileUtils.cp(from, env_file)
+ end
+
+ keys = ->(f) { File.readlines(f).filter_map { |l| l[/^([^#\s][^=\s]*)/, 1] } }
+
+ missing = keys[from] - keys[env_file]
+ return if missing.empty?
+
+ say_status(:WARNING, "Your #{env_file} file is missing #{missing.join(", ")}. Refer to #{from} for details.", :red)
+end
+
+def say_status(label, message, color = :green)
+ label = label.to_s.rjust(12)
+ puts [colorize(label, color), message].join(" ")
+end
+
+def colorize(str, color)
+ return str unless color_supported?
+
+ code = {red: 31, green: 32, yellow: 33, blue: 34, magenta: 35}.fetch(color)
+ "\e[0;#{code};49m#{str}\e[0m"
+end
+
+def color_supported?
+ if ENV["TERM"] == "dumb" || !ENV["NO_COLOR"].to_s.empty?
+ false
+ else
+ [$stdout, $stderr].all? { |io| io.respond_to?(:tty?) && io.tty? }
+ end
+end
+
+Dir.chdir(File.expand_path("..", __dir__)) do
+ setup!
+end
diff --git a/examples/default/config.ru b/examples/default/config.ru
new file mode 100644
index 0000000..4a3c09a
--- /dev/null
+++ b/examples/default/config.ru
@@ -0,0 +1,6 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
+Rails.application.load_server
diff --git a/examples/default/config/application.rb b/examples/default/config/application.rb
new file mode 100644
index 0000000..e50ec0e
--- /dev/null
+++ b/examples/default/config/application.rb
@@ -0,0 +1,27 @@
+require_relative "boot"
+
+require "rails/all"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module DefaultExample
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 7.1
+
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w(assets tasks))
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+ end
+end
diff --git a/examples/default/config/boot.rb b/examples/default/config/boot.rb
new file mode 100644
index 0000000..988a5dd
--- /dev/null
+++ b/examples/default/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/examples/default/config/cable.yml b/examples/default/config/cable.yml
new file mode 100644
index 0000000..48f5b6c
--- /dev/null
+++ b/examples/default/config/cable.yml
@@ -0,0 +1,11 @@
+development:
+ adapter: redis
+ url: redis://localhost:6379/1
+
+test:
+ adapter: test
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: default_example_production
diff --git a/examples/default/config/credentials.yml.enc b/examples/default/config/credentials.yml.enc
new file mode 100644
index 0000000..267ab5a
--- /dev/null
+++ b/examples/default/config/credentials.yml.enc
@@ -0,0 +1 @@
+hnxgWG3EgJ28AB8nS1X5enCp10oxaFNLFp/kNV8BKkSz8w6fxpKPSaont/Ecx312b49Mn+9ywiuZMU/fytlFb7shVHMSvGXG/0VRt4g4aWmZzP/z93xBF7EFtdmpNUGpBcLz1N59aQuGxaViax7guj+MMhYoceya1SFNtMqVCXOKEUj/c8qxrboxNX4heVkRYhCD9n/LbM8N1iR0J89cZEevfq/SdR2XgcRB+j4iEOFfQbu0qQdJbPcD/YGY4de5iLrPS5rMR6K3zGVn18HoEIjcrJ5WItVomj9hER7mqqTA8MCQ3COS0ygAaIvLww1ZoCE96jrOpe9usuNTWKaXbHCLWwESO9vcgcpso8ebc6bekFCCTcL5AiXBayIyb6F/AwcIrjxkc39yuVXXCoIyiFNHU8JR--jGM/b/GJ62NsMU9v--QXsYYYCy+MVs4KwZ5zYnLg==
\ No newline at end of file
diff --git a/examples/default/config/database.yml b/examples/default/config/database.yml
new file mode 100644
index 0000000..796466b
--- /dev/null
+++ b/examples/default/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite. Versions 3.8.0 and up are supported.
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem "sqlite3"
+#
+default: &default
+ adapter: sqlite3
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+ timeout: 5000
+
+development:
+ <<: *default
+ database: storage/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: storage/test.sqlite3
+
+production:
+ <<: *default
+ database: storage/production.sqlite3
diff --git a/examples/default/config/environment.rb b/examples/default/config/environment.rb
new file mode 100644
index 0000000..cac5315
--- /dev/null
+++ b/examples/default/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/examples/default/config/environments/development.rb b/examples/default/config/environments/development.rb
new file mode 100644
index 0000000..de05228
--- /dev/null
+++ b/examples/default/config/environments/development.rb
@@ -0,0 +1,78 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.enable_reloading = true
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing
+ config.server_timing = true
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = {host: "localhost:3000"}
+ config.action_mailer.asset_host = "http://localhost:3000"
+
+ config.action_mailer.perform_caching = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/examples/default/config/environments/production.rb b/examples/default/config/environments/production.rb
new file mode 100644
index 0000000..5685958
--- /dev/null
+++ b/examples/default/config/environments/production.rb
@@ -0,0 +1,102 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.enable_reloading = false
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
+ # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
+ config.public_file_server.enabled = true
+
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Mount Action Cable outside main process or domain.
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = "wss://example.com/cable"
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+ # config.assume_ssl = true
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ config.force_ssl = ENV["RAILS_DISABLE_SSL"].blank?
+
+ # Log to STDOUT by default
+ config.logger = ActiveSupport::Logger.new(STDOUT)
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
+
+ # Prepend all log lines with the following tags.
+ config.log_tags = [ :request_id ]
+
+ # Info include generic and useful information about system operation, but avoids logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+ # want to log everything, set the level to "debug".
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Use a real queuing backend for Active Job (and separate queues per environment).
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "default_example_production"
+
+ config.action_mailer.perform_caching = false
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = {
+ host: ENV.fetch("RAILS_HOSTNAME", "app.example.com"),
+ protocol: "https"
+ }
+ config.action_mailer.asset_host = "https://#{ENV.fetch("RAILS_HOSTNAME", "app.example.com")}"
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
+end
diff --git a/examples/default/config/environments/test.rb b/examples/default/config/environments/test.rb
new file mode 100644
index 0000000..1190cdd
--- /dev/null
+++ b/examples/default/config/environments/test.rb
@@ -0,0 +1,66 @@
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
+
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
+ }
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.cache_store = :null_store
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = :rescuable
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ config.action_mailer.perform_caching = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+ config.action_mailer.default_url_options = {host: "localhost:3000"}
+ config.action_mailer.asset_host = "http://localhost:3000"
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/examples/default/config/importmap.rb b/examples/default/config/importmap.rb
new file mode 100644
index 0000000..8dce42d
--- /dev/null
+++ b/examples/default/config/importmap.rb
@@ -0,0 +1,7 @@
+# Pin npm packages by running ./bin/importmap
+
+pin "application", preload: true
+pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
+pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
+pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
+pin_all_from "app/javascript/controllers", under: "controllers"
diff --git a/examples/default/config/initializers/assets.rb b/examples/default/config/initializers/assets.rb
new file mode 100644
index 0000000..2eeef96
--- /dev/null
+++ b/examples/default/config/initializers/assets.rb
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/examples/default/config/initializers/content_security_policy.rb b/examples/default/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000..b3076b3
--- /dev/null
+++ b/examples/default/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
diff --git a/examples/default/config/initializers/filter_parameter_logging.rb b/examples/default/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..c2d89e2
--- /dev/null
+++ b/examples/default/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+]
diff --git a/examples/default/config/initializers/generators.rb b/examples/default/config/initializers/generators.rb
new file mode 100644
index 0000000..e5123dc
--- /dev/null
+++ b/examples/default/config/initializers/generators.rb
@@ -0,0 +1,5 @@
+Rails.application.config.generators do |g|
+ # Disable generators we don't need.
+ g.javascripts false
+ g.stylesheets false
+end
diff --git a/examples/default/config/initializers/inflections.rb b/examples/default/config/initializers/inflections.rb
new file mode 100644
index 0000000..3860f65
--- /dev/null
+++ b/examples/default/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
diff --git a/examples/default/config/initializers/permissions_policy.rb b/examples/default/config/initializers/permissions_policy.rb
new file mode 100644
index 0000000..7db3b95
--- /dev/null
+++ b/examples/default/config/initializers/permissions_policy.rb
@@ -0,0 +1,13 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide HTTP permissions policy. For further
+# information see: https://developers.google.com/web/updates/2018/06/feature-policy
+
+# Rails.application.config.permissions_policy do |policy|
+# policy.camera :none
+# policy.gyroscope :none
+# policy.microphone :none
+# policy.usb :none
+# policy.fullscreen :self
+# policy.payment :self, "https://secure.example.com"
+# end
diff --git a/examples/default/config/locales/en.yml b/examples/default/config/locales/en.yml
new file mode 100644
index 0000000..6c349ae
--- /dev/null
+++ b/examples/default/config/locales/en.yml
@@ -0,0 +1,31 @@
+# Files in the config/locales directory are used for internationalization and
+# are automatically loaded by Rails. If you want to use locales other than
+# English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more about the API, please read the Rails Internationalization guide
+# at https://guides.rubyonrails.org/i18n.html.
+#
+# Be aware that YAML interprets the following case-insensitive strings as
+# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
+# must be quoted to be interpreted as strings. For example:
+#
+# en:
+# "yes": yup
+# enabled: "ON"
+
+en:
+ hello: "Hello world"
diff --git a/examples/default/config/puma.rb b/examples/default/config/puma.rb
new file mode 100644
index 0000000..afa809b
--- /dev/null
+++ b/examples/default/config/puma.rb
@@ -0,0 +1,35 @@
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
+
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers: a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum; this matches the default thread size of Active Record.
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
+threads min_threads_count, max_threads_count
+
+# Specifies that the worker count should equal the number of processors in production.
+if ENV["RAILS_ENV"] == "production"
+ require "concurrent-ruby"
+ worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
+ workers worker_count if worker_count > 1
+end
+
+# Specifies the `worker_timeout` threshold that Puma will use to wait before
+# terminating a worker in development environments.
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the `pidfile` that Puma will use.
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
diff --git a/examples/default/config/routes.rb b/examples/default/config/routes.rb
new file mode 100644
index 0000000..d7d6bb7
--- /dev/null
+++ b/examples/default/config/routes.rb
@@ -0,0 +1,11 @@
+Rails.application.routes.draw do
+ root "home#index"
+ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
+
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
+ get "up" => "rails/health#show", as: :rails_health_check
+
+ # Defines the root path route ("/")
+ # root "posts#index"
+end
diff --git a/examples/default/config/storage.yml b/examples/default/config/storage.yml
new file mode 100644
index 0000000..4942ab6
--- /dev/null
+++ b/examples/default/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/examples/default/db/schema.rb b/examples/default/db/schema.rb
new file mode 100644
index 0000000..d4a2a0c
--- /dev/null
+++ b/examples/default/db/schema.rb
@@ -0,0 +1,14 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[7.1].define(version: 0) do
+end
diff --git a/examples/default/db/seeds.rb b/examples/default/db/seeds.rb
new file mode 100644
index 0000000..4fbd6ed
--- /dev/null
+++ b/examples/default/db/seeds.rb
@@ -0,0 +1,9 @@
+# This file should ensure the existence of records required to run the application in every environment (production,
+# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Example:
+#
+# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
+# MovieGenre.find_or_create_by!(name: genre_name)
+# end
diff --git a/examples/default/lib/assets/.keep b/examples/default/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/lib/tasks/.keep b/examples/default/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/log/.keep b/examples/default/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/public/404.html b/examples/default/public/404.html
new file mode 100644
index 0000000..2be3af2
--- /dev/null
+++ b/examples/default/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/default/public/422.html b/examples/default/public/422.html
new file mode 100644
index 0000000..c08eac0
--- /dev/null
+++ b/examples/default/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/default/public/500.html b/examples/default/public/500.html
new file mode 100644
index 0000000..78a030a
--- /dev/null
+++ b/examples/default/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/default/public/apple-touch-icon-precomposed.png b/examples/default/public/apple-touch-icon-precomposed.png
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/public/apple-touch-icon.png b/examples/default/public/apple-touch-icon.png
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/public/favicon.ico b/examples/default/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/public/robots.txt b/examples/default/public/robots.txt
new file mode 100644
index 0000000..c19f78a
--- /dev/null
+++ b/examples/default/public/robots.txt
@@ -0,0 +1 @@
+# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
diff --git a/examples/default/storage/.keep b/examples/default/storage/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/application_system_test_case.rb b/examples/default/test/application_system_test_case.rb
new file mode 100644
index 0000000..88d679f
--- /dev/null
+++ b/examples/default/test/application_system_test_case.rb
@@ -0,0 +1,18 @@
+require "test_helper"
+require "capybara/rails"
+
+class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
+ driven_by :selenium,
+ using: (ENV["SHOW_BROWSER"] ? :chrome : :headless_chrome),
+ screen_size: [1400, 1400] do |options|
+ # Allows running in Docker
+ options.add_argument("--disable-dev-shm-usage")
+ options.add_argument("--no-sandbox")
+ end
+
+ setup do
+ Capybara.default_max_wait_time = 2
+ Capybara.disable_animation = true
+ Capybara.server = :puma, {Silent: true}
+ end
+end
diff --git a/examples/default/test/channels/application_cable/connection_test.rb b/examples/default/test/channels/application_cable/connection_test.rb
new file mode 100644
index 0000000..6340bf9
--- /dev/null
+++ b/examples/default/test/channels/application_cable/connection_test.rb
@@ -0,0 +1,13 @@
+require "test_helper"
+
+module ApplicationCable
+ class ConnectionTest < ActionCable::Connection::TestCase
+ # test "connects with cookies" do
+ # cookies.signed[:user_id] = 42
+ #
+ # connect
+ #
+ # assert_equal connection.user_id, "42"
+ # end
+ end
+end
diff --git a/examples/default/test/controllers/.keep b/examples/default/test/controllers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/fixtures/files/.keep b/examples/default/test/fixtures/files/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/helpers/.keep b/examples/default/test/helpers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/integration/.keep b/examples/default/test/integration/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/mailers/.keep b/examples/default/test/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/models/.keep b/examples/default/test/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/support/mailer.rb b/examples/default/test/support/mailer.rb
new file mode 100644
index 0000000..e4d1846
--- /dev/null
+++ b/examples/default/test/support/mailer.rb
@@ -0,0 +1,3 @@
+ActiveSupport.on_load(:active_support_test_case) do
+ setup { ActionMailer::Base.deliveries.clear }
+end
diff --git a/examples/default/test/system/.keep b/examples/default/test/system/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/test/test_helper.rb b/examples/default/test/test_helper.rb
new file mode 100644
index 0000000..7600ca2
--- /dev/null
+++ b/examples/default/test/test_helper.rb
@@ -0,0 +1,17 @@
+ENV["RAILS_ENV"] ||= "test"
+require_relative "../config/environment"
+require "rails/test_help"
+
+module ActiveSupport
+ class TestCase
+ # Run tests in parallel with specified workers
+ parallelize(workers: :number_of_processors)
+
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+ end
+end
+
+Dir[File.expand_path("support/**/*.rb", __dir__)].sort.each { |rb| require(rb) }
diff --git a/examples/default/tmp/.keep b/examples/default/tmp/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/tmp/pids/.keep b/examples/default/tmp/pids/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/tmp/storage/.keep b/examples/default/tmp/storage/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/vendor/.keep b/examples/default/vendor/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/default/vendor/javascript/.keep b/examples/default/vendor/javascript/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/.dockerignore b/examples/rspec/.dockerignore
new file mode 100644
index 0000000..9612375
--- /dev/null
+++ b/examples/rspec/.dockerignore
@@ -0,0 +1,37 @@
+# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
+
+# Ignore git directory.
+/.git/
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all default key files.
+/config/master.key
+/config/credentials/*.key
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/.keep
+
+# Ignore assets.
+/node_modules/
+/app/assets/builds/*
+!/app/assets/builds/.keep
+/public/assets
diff --git a/examples/rspec/.editorconfig b/examples/rspec/.editorconfig
new file mode 100644
index 0000000..bf44d02
--- /dev/null
+++ b/examples/rspec/.editorconfig
@@ -0,0 +1,14 @@
+# https://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[Makefile]
+indent_style = tab
diff --git a/examples/rspec/.gitattributes b/examples/rspec/.gitattributes
new file mode 100644
index 0000000..8dc4323
--- /dev/null
+++ b/examples/rspec/.gitattributes
@@ -0,0 +1,9 @@
+# See https://git-scm.com/docs/gitattributes for more about git attribute files.
+
+# Mark the database schema as having been generated.
+db/schema.rb linguist-generated
+
+# Mark any vendored files as having been vendored.
+vendor/* linguist-vendored
+config/credentials/*.yml.enc diff=rails_credentials
+config/credentials.yml.enc diff=rails_credentials
diff --git a/examples/rspec/.gitignore b/examples/rspec/.gitignore
new file mode 100644
index 0000000..af8498c
--- /dev/null
+++ b/examples/rspec/.gitignore
@@ -0,0 +1,36 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/
+!/tmp/storage/.keep
+
+/public/assets
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
+/spec/examples.txt
diff --git a/examples/rspec/.prettierrc.cjs b/examples/rspec/.prettierrc.cjs
new file mode 100644
index 0000000..5f16540
--- /dev/null
+++ b/examples/rspec/.prettierrc.cjs
@@ -0,0 +1,6 @@
+/** @type {import("prettier").Config} */
+
+module.exports = {
+ tabWidth: 2,
+ useTabs: false,
+};
diff --git a/examples/rspec/.rspec b/examples/rspec/.rspec
new file mode 100644
index 0000000..c99d2e7
--- /dev/null
+++ b/examples/rspec/.rspec
@@ -0,0 +1 @@
+--require spec_helper
diff --git a/examples/rspec/.ruby-version b/examples/rspec/.ruby-version
new file mode 100644
index 0000000..be94e6f
--- /dev/null
+++ b/examples/rspec/.ruby-version
@@ -0,0 +1 @@
+3.2.2
diff --git a/examples/rspec/DEPLOYMENT.md b/examples/rspec/DEPLOYMENT.md
new file mode 100644
index 0000000..bffadca
--- /dev/null
+++ b/examples/rspec/DEPLOYMENT.md
@@ -0,0 +1,10 @@
+# Deployment
+
+## Environment variables
+
+These environment variables affect how the app functions when deployed in production.
+
+- `RAILS_DISABLE_SSL` - Disable HSTS and secure cookies
+- `RAILS_MAX_THREADS` - Number of threads per Puma process (default: 5)
+- **REQUIRED** `SECRET_KEY_BASE` - Unique, secret key used to encrypt and sign cookies and other sensitive data
+- `WEB_CONCURRENCY` - Number of Puma processes (default: number of CPUs)
diff --git a/examples/rspec/Dockerfile b/examples/rspec/Dockerfile
new file mode 100644
index 0000000..ae6eeae
--- /dev/null
+++ b/examples/rspec/Dockerfile
@@ -0,0 +1,62 @@
+# syntax = docker/dockerfile:1
+
+# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
+ARG RUBY_VERSION=3.2.2
+FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
+
+# Rails app lives here
+WORKDIR /rails
+
+# Set production environment
+ENV RAILS_ENV="production" \
+ BUNDLE_DEPLOYMENT="1" \
+ BUNDLE_PATH="/usr/local/bundle" \
+ BUNDLE_WITHOUT="development"
+
+
+# Throw-away build stage to reduce size of final image
+FROM base as build
+
+# Install packages needed to build gems
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y build-essential git libvips pkg-config
+
+# Install application gems
+COPY Gemfile Gemfile.lock ./
+RUN bundle install && \
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
+ bundle exec bootsnap precompile --gemfile
+
+# Copy application code
+COPY . .
+
+# Precompile bootsnap code for faster boot times
+RUN bundle exec bootsnap precompile app/ lib/
+
+# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
+RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
+
+
+# Final stage for app image
+FROM base
+
+# Install packages needed for deployment
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Copy built artifacts: gems, application
+COPY --from=build /usr/local/bundle /usr/local/bundle
+COPY --from=build /rails /rails
+
+# Run and own only the runtime files as a non-root user for security
+RUN useradd rails --create-home --shell /bin/bash && \
+ chown -R rails:rails db log storage tmp
+USER rails:rails
+
+# Entrypoint prepares the database.
+ENTRYPOINT ["/rails/bin/docker-entrypoint"]
+
+# Start the server by default, this can be overwritten at runtime
+EXPOSE 3000
+CMD ["./bin/rails", "server"]
diff --git a/examples/rspec/Gemfile b/examples/rspec/Gemfile
new file mode 100644
index 0000000..e9efeb3
--- /dev/null
+++ b/examples/rspec/Gemfile
@@ -0,0 +1,29 @@
+source "https://rubygems.org"
+
+ruby Pathname.new(__dir__).join(".ruby-version").read.strip
+
+gem "rails", "~> 7.1.1"
+gem "sprockets-rails"
+gem "sqlite3", "~> 1.4"
+gem "puma", ">= 5.0"
+gem "importmap-rails"
+gem "turbo-rails"
+gem "stimulus-rails"
+gem "jbuilder"
+gem "redis", ">= 4.0.1"
+gem "tzinfo-data", platforms: %i[ windows jruby ]
+gem "bootsnap", require: false
+
+group :development, :test do
+ gem "rspec-rails"
+ gem "debug", platforms: %i[ mri windows ]
+end
+
+group :development do
+ gem "web-console"
+end
+
+group :test do
+ gem "selenium-webdriver"
+ gem "capybara"
+end
diff --git a/examples/rspec/Gemfile.lock b/examples/rspec/Gemfile.lock
new file mode 100644
index 0000000..6044578
--- /dev/null
+++ b/examples/rspec/Gemfile.lock
@@ -0,0 +1,284 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (7.1.1)
+ actionpack (= 7.1.1)
+ activesupport (= 7.1.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ zeitwerk (~> 2.6)
+ actionmailbox (7.1.1)
+ actionpack (= 7.1.1)
+ activejob (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ mail (>= 2.7.1)
+ net-imap
+ net-pop
+ net-smtp
+ actionmailer (7.1.1)
+ actionpack (= 7.1.1)
+ actionview (= 7.1.1)
+ activejob (= 7.1.1)
+ activesupport (= 7.1.1)
+ mail (~> 2.5, >= 2.5.4)
+ net-imap
+ net-pop
+ net-smtp
+ rails-dom-testing (~> 2.2)
+ actionpack (7.1.1)
+ actionview (= 7.1.1)
+ activesupport (= 7.1.1)
+ nokogiri (>= 1.8.5)
+ rack (>= 2.2.4)
+ rack-session (>= 1.0.1)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ actiontext (7.1.1)
+ actionpack (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ globalid (>= 0.6.0)
+ nokogiri (>= 1.8.5)
+ actionview (7.1.1)
+ activesupport (= 7.1.1)
+ builder (~> 3.1)
+ erubi (~> 1.11)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ activejob (7.1.1)
+ activesupport (= 7.1.1)
+ globalid (>= 0.3.6)
+ activemodel (7.1.1)
+ activesupport (= 7.1.1)
+ activerecord (7.1.1)
+ activemodel (= 7.1.1)
+ activesupport (= 7.1.1)
+ timeout (>= 0.4.0)
+ activestorage (7.1.1)
+ actionpack (= 7.1.1)
+ activejob (= 7.1.1)
+ activerecord (= 7.1.1)
+ activesupport (= 7.1.1)
+ marcel (~> 1.0)
+ activesupport (7.1.1)
+ base64
+ bigdecimal
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ mutex_m
+ tzinfo (~> 2.0)
+ addressable (2.8.5)
+ public_suffix (>= 2.0.2, < 6.0)
+ base64 (0.1.1)
+ bigdecimal (3.1.4)
+ bindex (0.8.1)
+ bootsnap (1.16.0)
+ msgpack (~> 1.2)
+ builder (3.2.4)
+ capybara (3.39.2)
+ addressable
+ matrix
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.8)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ regexp_parser (>= 1.5, < 3.0)
+ xpath (~> 3.2)
+ concurrent-ruby (1.2.2)
+ connection_pool (2.4.1)
+ crass (1.0.6)
+ date (3.3.3)
+ debug (1.8.0)
+ irb (>= 1.5.0)
+ reline (>= 0.3.1)
+ diff-lcs (1.5.0)
+ drb (2.1.1)
+ ruby2_keywords
+ erubi (1.12.0)
+ globalid (1.2.1)
+ activesupport (>= 6.1)
+ i18n (1.14.1)
+ concurrent-ruby (~> 1.0)
+ importmap-rails (1.2.1)
+ actionpack (>= 6.0.0)
+ railties (>= 6.0.0)
+ io-console (0.6.0)
+ irb (1.8.2)
+ rdoc
+ reline (>= 0.3.8)
+ jbuilder (2.11.5)
+ actionview (>= 5.0.0)
+ activesupport (>= 5.0.0)
+ loofah (2.21.4)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.12.0)
+ mail (2.8.1)
+ mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
+ marcel (1.0.2)
+ matrix (0.4.2)
+ mini_mime (1.1.5)
+ minitest (5.20.0)
+ msgpack (1.7.2)
+ mutex_m (0.1.2)
+ net-imap (0.4.1)
+ date
+ net-protocol
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.2.1)
+ timeout
+ net-smtp (0.4.0)
+ net-protocol
+ nio4r (2.5.9)
+ nokogiri (1.15.4-x86_64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.15.4-x86_64-linux)
+ racc (~> 1.4)
+ psych (5.1.1)
+ stringio
+ public_suffix (5.0.3)
+ puma (6.4.0)
+ nio4r (~> 2.0)
+ racc (1.7.1)
+ rack (3.0.8)
+ rack-session (2.0.0)
+ rack (>= 3.0.0)
+ rack-test (2.1.0)
+ rack (>= 1.3)
+ rackup (2.1.0)
+ rack (>= 3)
+ webrick (~> 1.8)
+ rails (7.1.1)
+ actioncable (= 7.1.1)
+ actionmailbox (= 7.1.1)
+ actionmailer (= 7.1.1)
+ actionpack (= 7.1.1)
+ actiontext (= 7.1.1)
+ actionview (= 7.1.1)
+ activejob (= 7.1.1)
+ activemodel (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ bundler (>= 1.15.0)
+ railties (= 7.1.1)
+ rails-dom-testing (2.2.0)
+ activesupport (>= 5.0.0)
+ minitest
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.6.0)
+ loofah (~> 2.21)
+ nokogiri (~> 1.14)
+ railties (7.1.1)
+ actionpack (= 7.1.1)
+ activesupport (= 7.1.1)
+ irb
+ rackup (>= 1.0.0)
+ rake (>= 12.2)
+ thor (~> 1.0, >= 1.2.2)
+ zeitwerk (~> 2.6)
+ rake (13.0.6)
+ rdoc (6.5.0)
+ psych (>= 4.0.0)
+ redis (5.0.7)
+ redis-client (>= 0.9.0)
+ redis-client (0.17.0)
+ connection_pool
+ regexp_parser (2.8.2)
+ reline (0.3.9)
+ io-console (~> 0.5)
+ rexml (3.2.6)
+ rspec-core (3.12.2)
+ rspec-support (~> 3.12.0)
+ rspec-expectations (3.12.3)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-mocks (3.12.6)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-rails (6.0.3)
+ actionpack (>= 6.1)
+ activesupport (>= 6.1)
+ railties (>= 6.1)
+ rspec-core (~> 3.12)
+ rspec-expectations (~> 3.12)
+ rspec-mocks (~> 3.12)
+ rspec-support (~> 3.12)
+ rspec-support (3.12.1)
+ ruby2_keywords (0.0.5)
+ rubyzip (2.3.2)
+ selenium-webdriver (4.14.0)
+ rexml (~> 3.2, >= 3.2.5)
+ rubyzip (>= 1.2.2, < 3.0)
+ websocket (~> 1.0)
+ sprockets (4.2.1)
+ concurrent-ruby (~> 1.0)
+ rack (>= 2.2.4, < 4)
+ sprockets-rails (3.4.2)
+ actionpack (>= 5.2)
+ activesupport (>= 5.2)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.6.7-x86_64-darwin)
+ sqlite3 (1.6.7-x86_64-linux)
+ stimulus-rails (1.3.0)
+ railties (>= 6.0.0)
+ stringio (3.0.8)
+ thor (1.2.2)
+ timeout (0.4.0)
+ turbo-rails (1.5.0)
+ actionpack (>= 6.0.0)
+ activejob (>= 6.0.0)
+ railties (>= 6.0.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ web-console (4.2.1)
+ actionview (>= 6.0.0)
+ activemodel (>= 6.0.0)
+ bindex (>= 0.4.0)
+ railties (>= 6.0.0)
+ webrick (1.8.1)
+ websocket (1.2.10)
+ websocket-driver (0.7.6)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+ xpath (3.2.0)
+ nokogiri (~> 1.8)
+ zeitwerk (2.6.12)
+
+PLATFORMS
+ x86_64-darwin-22
+ x86_64-linux
+
+DEPENDENCIES
+ bootsnap
+ capybara
+ debug
+ importmap-rails
+ jbuilder
+ puma (>= 5.0)
+ rails (~> 7.1.1)
+ redis (>= 4.0.1)
+ rspec-rails
+ selenium-webdriver
+ sprockets-rails
+ sqlite3 (~> 1.4)
+ stimulus-rails
+ turbo-rails
+ tzinfo-data
+ web-console
+
+RUBY VERSION
+ ruby 3.2.2p53
+
+BUNDLED WITH
+ 2.4.20
diff --git a/examples/rspec/Procfile b/examples/rspec/Procfile
new file mode 100644
index 0000000..90ae0ac
--- /dev/null
+++ b/examples/rspec/Procfile
@@ -0,0 +1,2 @@
+web: bundle exec puma -C config/puma.rb
+release: bundle exec rake db:migrate
diff --git a/examples/rspec/README.md b/examples/rspec/README.md
new file mode 100644
index 0000000..c49fa30
--- /dev/null
+++ b/examples/rspec/README.md
@@ -0,0 +1,46 @@
+# rspec_example
+
+This is a Rails 7.1 app.
+
+## Prerequisites
+
+This project requires:
+
+- Ruby (see [.ruby-version](./.ruby-version)), preferably managed using [rbenv](https://github.com/rbenv/rbenv)
+
+On macOS, these [Homebrew](http://brew.sh) packages are recommended:
+
+```
+brew install rbenv
+```
+
+## Getting started
+
+### bin/setup
+
+Run this script to install necessary dependencies and prepare the Rails app to be started for the first time.
+
+```
+bin/setup
+```
+
+> [!NOTE]
+> The `bin/setup` script is idempotent and is designed to be run often. You should run it every time you pull code that introduces new dependencies or makes other significant changes to the project.
+
+### Run the app!
+
+Start the Rails server with this command:
+
+```
+bin/rails s
+```
+
+The app will be located at .
+
+## Development
+
+Use this command to run the full suite of automated tests:
+
+```
+bin/rake
+```
diff --git a/examples/rspec/Rakefile b/examples/rspec/Rakefile
new file mode 100644
index 0000000..c0a098c
--- /dev/null
+++ b/examples/rspec/Rakefile
@@ -0,0 +1,13 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative "config/application"
+
+Rails.application.load_tasks
+
+Rake::Task[:default].prerequisites.clear if Rake::Task.task_defined?(:default)
+
+desc "Run all checks"
+task default: %w[spec] do
+ Thor::Base.shell.new.say_status :OK, "All checks passed!"
+end
diff --git a/examples/rspec/app/assets/config/manifest.js b/examples/rspec/app/assets/config/manifest.js
new file mode 100644
index 0000000..ddd546a
--- /dev/null
+++ b/examples/rspec/app/assets/config/manifest.js
@@ -0,0 +1,4 @@
+//= link_tree ../images
+//= link_directory ../stylesheets .css
+//= link_tree ../../javascript .js
+//= link_tree ../../../vendor/javascript .js
diff --git a/examples/rspec/app/assets/images/.keep b/examples/rspec/app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/app/assets/stylesheets/application.css b/examples/rspec/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..288b9ab
--- /dev/null
+++ b/examples/rspec/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/examples/rspec/app/channels/application_cable/channel.rb b/examples/rspec/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000..d672697
--- /dev/null
+++ b/examples/rspec/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/examples/rspec/app/channels/application_cable/connection.rb b/examples/rspec/app/channels/application_cable/connection.rb
new file mode 100644
index 0000000..0ff5442
--- /dev/null
+++ b/examples/rspec/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/examples/rspec/app/controllers/application_controller.rb b/examples/rspec/app/controllers/application_controller.rb
new file mode 100644
index 0000000..09705d1
--- /dev/null
+++ b/examples/rspec/app/controllers/application_controller.rb
@@ -0,0 +1,2 @@
+class ApplicationController < ActionController::Base
+end
diff --git a/examples/rspec/app/controllers/concerns/.keep b/examples/rspec/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/app/controllers/home_controller.rb b/examples/rspec/app/controllers/home_controller.rb
new file mode 100644
index 0000000..95f2992
--- /dev/null
+++ b/examples/rspec/app/controllers/home_controller.rb
@@ -0,0 +1,4 @@
+class HomeController < ApplicationController
+ def index
+ end
+end
diff --git a/examples/rspec/app/helpers/application_helper.rb b/examples/rspec/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/examples/rspec/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/examples/rspec/app/javascript/application.js b/examples/rspec/app/javascript/application.js
new file mode 100644
index 0000000..0d7b494
--- /dev/null
+++ b/examples/rspec/app/javascript/application.js
@@ -0,0 +1,3 @@
+// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
+import "@hotwired/turbo-rails"
+import "controllers"
diff --git a/examples/rspec/app/javascript/controllers/application.js b/examples/rspec/app/javascript/controllers/application.js
new file mode 100644
index 0000000..1213e85
--- /dev/null
+++ b/examples/rspec/app/javascript/controllers/application.js
@@ -0,0 +1,9 @@
+import { Application } from "@hotwired/stimulus"
+
+const application = Application.start()
+
+// Configure Stimulus development experience
+application.debug = false
+window.Stimulus = application
+
+export { application }
diff --git a/examples/rspec/app/javascript/controllers/hello_controller.js b/examples/rspec/app/javascript/controllers/hello_controller.js
new file mode 100644
index 0000000..5975c07
--- /dev/null
+++ b/examples/rspec/app/javascript/controllers/hello_controller.js
@@ -0,0 +1,7 @@
+import { Controller } from "@hotwired/stimulus"
+
+export default class extends Controller {
+ connect() {
+ this.element.textContent = "Hello World!"
+ }
+}
diff --git a/examples/rspec/app/javascript/controllers/index.js b/examples/rspec/app/javascript/controllers/index.js
new file mode 100644
index 0000000..54ad4ca
--- /dev/null
+++ b/examples/rspec/app/javascript/controllers/index.js
@@ -0,0 +1,11 @@
+// Import and register all your controllers from the importmap under controllers/*
+
+import { application } from "controllers/application"
+
+// Eager load all controllers defined in the import map under controllers/**/*_controller
+import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
+eagerLoadControllersFrom("controllers", application)
+
+// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
+// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
+// lazyLoadControllersFrom("controllers", application)
diff --git a/examples/rspec/app/jobs/application_job.rb b/examples/rspec/app/jobs/application_job.rb
new file mode 100644
index 0000000..d394c3d
--- /dev/null
+++ b/examples/rspec/app/jobs/application_job.rb
@@ -0,0 +1,7 @@
+class ApplicationJob < ActiveJob::Base
+ # Automatically retry jobs that encountered a deadlock
+ # retry_on ActiveRecord::Deadlocked
+
+ # Most jobs are safe to ignore if the underlying records are no longer available
+ # discard_on ActiveJob::DeserializationError
+end
diff --git a/examples/rspec/app/mailers/application_mailer.rb b/examples/rspec/app/mailers/application_mailer.rb
new file mode 100644
index 0000000..3c34c81
--- /dev/null
+++ b/examples/rspec/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: "from@example.com"
+ layout "mailer"
+end
diff --git a/examples/rspec/app/models/application_record.rb b/examples/rspec/app/models/application_record.rb
new file mode 100644
index 0000000..b63caeb
--- /dev/null
+++ b/examples/rspec/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ primary_abstract_class
+end
diff --git a/examples/rspec/app/models/concerns/.keep b/examples/rspec/app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/app/views/home/index.html.erb b/examples/rspec/app/views/home/index.html.erb
new file mode 100644
index 0000000..cd258d0
--- /dev/null
+++ b/examples/rspec/app/views/home/index.html.erb
@@ -0,0 +1,2 @@
+<% provide(:title, "Home") %>
+
Find me in app/views/home/index.html.erb
diff --git a/examples/rspec/app/views/layouts/application.html.erb b/examples/rspec/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..376df7f
--- /dev/null
+++ b/examples/rspec/app/views/layouts/application.html.erb
@@ -0,0 +1,17 @@
+
+
+
+ <%= content_for?(:title) ? strip_tags(yield(:title)) : "Rspec Example" %>
+
+
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
+ <%= javascript_importmap_tags %>
+
+
+
+ <%= yield %>
+
+
diff --git a/examples/rspec/app/views/layouts/mailer.html.erb b/examples/rspec/app/views/layouts/mailer.html.erb
new file mode 100644
index 0000000..3aac900
--- /dev/null
+++ b/examples/rspec/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/examples/rspec/app/views/layouts/mailer.text.erb b/examples/rspec/app/views/layouts/mailer.text.erb
new file mode 100644
index 0000000..37f0bdd
--- /dev/null
+++ b/examples/rspec/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/examples/rspec/bin/bundle b/examples/rspec/bin/bundle
new file mode 100755
index 0000000..42c7fd7
--- /dev/null
+++ b/examples/rspec/bin/bundle
@@ -0,0 +1,109 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../Gemfile", __dir__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_requirement
+ @bundler_requirement ||=
+ env_var_version ||
+ cli_arg_version ||
+ bundler_requirement_for(lockfile_version)
+ end
+
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
+
+ bundler_gem_version = Gem::Version.new(version)
+
+ bundler_gem_version.approximate_recommendation
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ 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}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
diff --git a/examples/rspec/bin/docker-entrypoint b/examples/rspec/bin/docker-entrypoint
new file mode 100755
index 0000000..67ef493
--- /dev/null
+++ b/examples/rspec/bin/docker-entrypoint
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+# If running the rails server then create or migrate existing database
+if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
diff --git a/examples/rspec/bin/importmap b/examples/rspec/bin/importmap
new file mode 100755
index 0000000..36502ab
--- /dev/null
+++ b/examples/rspec/bin/importmap
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require_relative "../config/application"
+require "importmap/commands"
diff --git a/examples/rspec/bin/rails b/examples/rspec/bin/rails
new file mode 100755
index 0000000..efc0377
--- /dev/null
+++ b/examples/rspec/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
diff --git a/examples/rspec/bin/rake b/examples/rspec/bin/rake
new file mode 100755
index 0000000..4fbf10b
--- /dev/null
+++ b/examples/rspec/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
diff --git a/examples/rspec/bin/rspec b/examples/rspec/bin/rspec
new file mode 100755
index 0000000..cb53ebe
--- /dev/null
+++ b/examples/rspec/bin/rspec
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'rspec' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("rspec-core", "rspec")
diff --git a/examples/rspec/bin/setup b/examples/rspec/bin/setup
new file mode 100755
index 0000000..bac8843
--- /dev/null
+++ b/examples/rspec/bin/setup
@@ -0,0 +1,107 @@
+#!/usr/bin/env ruby
+
+# This script is a way to set up or update your development environment automatically.
+# This script is idempotent, so that you can run it at any time and get an expectable outcome.
+# Add necessary setup steps to this method.
+def setup!
+ run "bundle install" if bundle_needed?
+ run "overcommit --install" if overcommit_installable?
+ run "bin/rails db:prepare" if database_present?
+ run "yarn install" if yarn_needed?
+ run "bin/rails tmp:create" if tmp_missing?
+ env ".env", from: ".env.sample"
+ run "bin/rails restart"
+
+ if git_safe_needed?
+ say_status :notice,
+ "Remember to run #{colorize("mkdir -p .git/safe", :yellow)} to trust the binstubs in this project",
+ :magenta
+ end
+
+ say_status :Ready!,
+ "Use #{colorize("bin/rails s", :yellow)} to start the app, " \
+ "or #{colorize("bin/rake", :yellow)} to run tests"
+end
+
+def run(command, echo: true, silent: false, exception: true)
+ say_status(:run, command, :blue) if echo
+ with_original_bundler_env do
+ options = silent ? {out: File::NULL, err: File::NULL} : {}
+ system(command, exception: exception, **options)
+ end
+end
+
+def run?(command)
+ run command, silent: true, echo: false, exception: false
+end
+
+def bundle_needed?
+ !run("bundle check", silent: true, exception: false)
+end
+
+def overcommit_installable?
+ File.exist?(".overcommit.yml") && !File.exist?(".git/hooks/overcommit-hook") && run?("overcommit -v")
+end
+
+def database_present?
+ File.exist?("config/database.yml")
+end
+
+def yarn_needed?
+ File.exist?("yarn.lock") && !run("yarn check --check-files", silent: true, exception: false)
+end
+
+def tmp_missing?
+ !Dir.exist?("tmp/pids")
+end
+
+def git_safe_needed?
+ ENV["PATH"].include?(".git/safe/../../bin") && !Dir.exist?(".git/safe")
+end
+
+def with_original_bundler_env(&block)
+ return yield unless defined?(Bundler)
+
+ Bundler.with_original_env(&block)
+end
+
+def env(env_file, from:)
+ return unless File.exist?(from)
+
+ unless File.exist?(env_file)
+ say_status(:copy, "#{from} → #{env_file}", :magenta)
+ require "fileutils"
+ FileUtils.cp(from, env_file)
+ end
+
+ keys = ->(f) { File.readlines(f).filter_map { |l| l[/^([^#\s][^=\s]*)/, 1] } }
+
+ missing = keys[from] - keys[env_file]
+ return if missing.empty?
+
+ say_status(:WARNING, "Your #{env_file} file is missing #{missing.join(", ")}. Refer to #{from} for details.", :red)
+end
+
+def say_status(label, message, color = :green)
+ label = label.to_s.rjust(12)
+ puts [colorize(label, color), message].join(" ")
+end
+
+def colorize(str, color)
+ return str unless color_supported?
+
+ code = {red: 31, green: 32, yellow: 33, blue: 34, magenta: 35}.fetch(color)
+ "\e[0;#{code};49m#{str}\e[0m"
+end
+
+def color_supported?
+ if ENV["TERM"] == "dumb" || !ENV["NO_COLOR"].to_s.empty?
+ false
+ else
+ [$stdout, $stderr].all? { |io| io.respond_to?(:tty?) && io.tty? }
+ end
+end
+
+Dir.chdir(File.expand_path("..", __dir__)) do
+ setup!
+end
diff --git a/examples/rspec/config.ru b/examples/rspec/config.ru
new file mode 100644
index 0000000..4a3c09a
--- /dev/null
+++ b/examples/rspec/config.ru
@@ -0,0 +1,6 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
+Rails.application.load_server
diff --git a/examples/rspec/config/application.rb b/examples/rspec/config/application.rb
new file mode 100644
index 0000000..77bbe65
--- /dev/null
+++ b/examples/rspec/config/application.rb
@@ -0,0 +1,42 @@
+require_relative "boot"
+
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "active_storage/engine"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_mailbox/engine"
+require "action_text/engine"
+require "action_view/railtie"
+require "action_cable/engine"
+# require "rails/test_unit/railtie"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module RspecExample
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 7.1
+
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w(templates assets tasks))
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+
+ # Don't generate system test files.
+ config.generators.system_tests = nil
+ end
+end
diff --git a/examples/rspec/config/boot.rb b/examples/rspec/config/boot.rb
new file mode 100644
index 0000000..988a5dd
--- /dev/null
+++ b/examples/rspec/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/examples/rspec/config/cable.yml b/examples/rspec/config/cable.yml
new file mode 100644
index 0000000..f360e8c
--- /dev/null
+++ b/examples/rspec/config/cable.yml
@@ -0,0 +1,11 @@
+development:
+ adapter: redis
+ url: redis://localhost:6379/1
+
+test:
+ adapter: test
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: rspec_example_production
diff --git a/examples/rspec/config/credentials.yml.enc b/examples/rspec/config/credentials.yml.enc
new file mode 100644
index 0000000..709b15b
--- /dev/null
+++ b/examples/rspec/config/credentials.yml.enc
@@ -0,0 +1 @@
+7zeTZKxbFNKiyPpY3eVHihDcISOmKNv2fqJmC2lHsVggM2nZZpmm8Eno7j6Z1CJoly9ADQoaY2D8zuNQ7/ncTrFf66nw6Sf2B6H8hgcZTNOd5091t6rA7t5NkLz8VHflav3PGGDFJrG2k2RSLzoOk9gtDV+MYvuPD7d1bMZ2vOKfkK2mqgxHMsQ7qKSQLjo4UM0f0Q1J1JKmx8lTfIIR3uCKnm3PUof+jbm3cLPXZ6BqiCoYk69vfC9E9oKp9HRkQoUyZncrnxfVkLUsIDtoF3mTeYuevXbKDqC1A89UNFUn39XEdvdQrlKaiuSGfE1JuSYQNOQUIW249qP57ayuQ43qoRZHCFTUAzKFozrJaGevXlNQ0p8YIpK5gM9Sl9pjVymYzSKGdlwtAZiw5KTO9gaNTMO4--EOHlfBFXK+xPebAT--OcR5qNfkaOiFtRMO1XyM+w==
\ No newline at end of file
diff --git a/examples/rspec/config/database.yml b/examples/rspec/config/database.yml
new file mode 100644
index 0000000..796466b
--- /dev/null
+++ b/examples/rspec/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite. Versions 3.8.0 and up are supported.
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem "sqlite3"
+#
+default: &default
+ adapter: sqlite3
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+ timeout: 5000
+
+development:
+ <<: *default
+ database: storage/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: storage/test.sqlite3
+
+production:
+ <<: *default
+ database: storage/production.sqlite3
diff --git a/examples/rspec/config/environment.rb b/examples/rspec/config/environment.rb
new file mode 100644
index 0000000..cac5315
--- /dev/null
+++ b/examples/rspec/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/examples/rspec/config/environments/development.rb b/examples/rspec/config/environments/development.rb
new file mode 100644
index 0000000..de05228
--- /dev/null
+++ b/examples/rspec/config/environments/development.rb
@@ -0,0 +1,78 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.enable_reloading = true
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing
+ config.server_timing = true
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = {host: "localhost:3000"}
+ config.action_mailer.asset_host = "http://localhost:3000"
+
+ config.action_mailer.perform_caching = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/examples/rspec/config/environments/production.rb b/examples/rspec/config/environments/production.rb
new file mode 100644
index 0000000..add5dc7
--- /dev/null
+++ b/examples/rspec/config/environments/production.rb
@@ -0,0 +1,102 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.enable_reloading = false
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
+ # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
+ config.public_file_server.enabled = true
+
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Mount Action Cable outside main process or domain.
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = "wss://example.com/cable"
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+ # config.assume_ssl = true
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ config.force_ssl = ENV["RAILS_DISABLE_SSL"].blank?
+
+ # Log to STDOUT by default
+ config.logger = ActiveSupport::Logger.new(STDOUT)
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
+
+ # Prepend all log lines with the following tags.
+ config.log_tags = [ :request_id ]
+
+ # Info include generic and useful information about system operation, but avoids logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+ # want to log everything, set the level to "debug".
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Use a real queuing backend for Active Job (and separate queues per environment).
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "rspec_example_production"
+
+ config.action_mailer.perform_caching = false
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = {
+ host: ENV.fetch("RAILS_HOSTNAME", "app.example.com"),
+ protocol: "https"
+ }
+ config.action_mailer.asset_host = "https://#{ENV.fetch("RAILS_HOSTNAME", "app.example.com")}"
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
+end
diff --git a/examples/rspec/config/environments/test.rb b/examples/rspec/config/environments/test.rb
new file mode 100644
index 0000000..1190cdd
--- /dev/null
+++ b/examples/rspec/config/environments/test.rb
@@ -0,0 +1,66 @@
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
+
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
+ }
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.cache_store = :null_store
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = :rescuable
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ config.action_mailer.perform_caching = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+ config.action_mailer.default_url_options = {host: "localhost:3000"}
+ config.action_mailer.asset_host = "http://localhost:3000"
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/examples/rspec/config/importmap.rb b/examples/rspec/config/importmap.rb
new file mode 100644
index 0000000..8dce42d
--- /dev/null
+++ b/examples/rspec/config/importmap.rb
@@ -0,0 +1,7 @@
+# Pin npm packages by running ./bin/importmap
+
+pin "application", preload: true
+pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
+pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
+pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
+pin_all_from "app/javascript/controllers", under: "controllers"
diff --git a/examples/rspec/config/initializers/assets.rb b/examples/rspec/config/initializers/assets.rb
new file mode 100644
index 0000000..2eeef96
--- /dev/null
+++ b/examples/rspec/config/initializers/assets.rb
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/examples/rspec/config/initializers/content_security_policy.rb b/examples/rspec/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000..b3076b3
--- /dev/null
+++ b/examples/rspec/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
diff --git a/examples/rspec/config/initializers/filter_parameter_logging.rb b/examples/rspec/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..c2d89e2
--- /dev/null
+++ b/examples/rspec/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+]
diff --git a/examples/rspec/config/initializers/generators.rb b/examples/rspec/config/initializers/generators.rb
new file mode 100644
index 0000000..67cb5a3
--- /dev/null
+++ b/examples/rspec/config/initializers/generators.rb
@@ -0,0 +1,7 @@
+Rails.application.config.generators do |g|
+ # Disable generators we don't need.
+ g.javascripts false
+ g.stylesheets false
+g.routing_specs false
+g.view_specs false
+end
diff --git a/examples/rspec/config/initializers/inflections.rb b/examples/rspec/config/initializers/inflections.rb
new file mode 100644
index 0000000..3860f65
--- /dev/null
+++ b/examples/rspec/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
diff --git a/examples/rspec/config/initializers/permissions_policy.rb b/examples/rspec/config/initializers/permissions_policy.rb
new file mode 100644
index 0000000..7db3b95
--- /dev/null
+++ b/examples/rspec/config/initializers/permissions_policy.rb
@@ -0,0 +1,13 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide HTTP permissions policy. For further
+# information see: https://developers.google.com/web/updates/2018/06/feature-policy
+
+# Rails.application.config.permissions_policy do |policy|
+# policy.camera :none
+# policy.gyroscope :none
+# policy.microphone :none
+# policy.usb :none
+# policy.fullscreen :self
+# policy.payment :self, "https://secure.example.com"
+# end
diff --git a/examples/rspec/config/locales/en.yml b/examples/rspec/config/locales/en.yml
new file mode 100644
index 0000000..6c349ae
--- /dev/null
+++ b/examples/rspec/config/locales/en.yml
@@ -0,0 +1,31 @@
+# Files in the config/locales directory are used for internationalization and
+# are automatically loaded by Rails. If you want to use locales other than
+# English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more about the API, please read the Rails Internationalization guide
+# at https://guides.rubyonrails.org/i18n.html.
+#
+# Be aware that YAML interprets the following case-insensitive strings as
+# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
+# must be quoted to be interpreted as strings. For example:
+#
+# en:
+# "yes": yup
+# enabled: "ON"
+
+en:
+ hello: "Hello world"
diff --git a/examples/rspec/config/puma.rb b/examples/rspec/config/puma.rb
new file mode 100644
index 0000000..afa809b
--- /dev/null
+++ b/examples/rspec/config/puma.rb
@@ -0,0 +1,35 @@
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
+
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers: a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum; this matches the default thread size of Active Record.
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
+threads min_threads_count, max_threads_count
+
+# Specifies that the worker count should equal the number of processors in production.
+if ENV["RAILS_ENV"] == "production"
+ require "concurrent-ruby"
+ worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
+ workers worker_count if worker_count > 1
+end
+
+# Specifies the `worker_timeout` threshold that Puma will use to wait before
+# terminating a worker in development environments.
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the `pidfile` that Puma will use.
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
diff --git a/examples/rspec/config/routes.rb b/examples/rspec/config/routes.rb
new file mode 100644
index 0000000..d7d6bb7
--- /dev/null
+++ b/examples/rspec/config/routes.rb
@@ -0,0 +1,11 @@
+Rails.application.routes.draw do
+ root "home#index"
+ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
+
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
+ get "up" => "rails/health#show", as: :rails_health_check
+
+ # Defines the root path route ("/")
+ # root "posts#index"
+end
diff --git a/examples/rspec/config/storage.yml b/examples/rspec/config/storage.yml
new file mode 100644
index 0000000..4942ab6
--- /dev/null
+++ b/examples/rspec/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/examples/rspec/db/schema.rb b/examples/rspec/db/schema.rb
new file mode 100644
index 0000000..d4a2a0c
--- /dev/null
+++ b/examples/rspec/db/schema.rb
@@ -0,0 +1,14 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[7.1].define(version: 0) do
+end
diff --git a/examples/rspec/db/seeds.rb b/examples/rspec/db/seeds.rb
new file mode 100644
index 0000000..4fbd6ed
--- /dev/null
+++ b/examples/rspec/db/seeds.rb
@@ -0,0 +1,9 @@
+# This file should ensure the existence of records required to run the application in every environment (production,
+# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Example:
+#
+# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
+# MovieGenre.find_or_create_by!(name: genre_name)
+# end
diff --git a/examples/rspec/lib/assets/.keep b/examples/rspec/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/lib/tasks/.keep b/examples/rspec/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/lib/templates/rspec/system/system_spec.rb b/examples/rspec/lib/templates/rspec/system/system_spec.rb
new file mode 100644
index 0000000..0d436bf
--- /dev/null
+++ b/examples/rspec/lib/templates/rspec/system/system_spec.rb
@@ -0,0 +1,10 @@
+require "rails_helper"
+
+RSpec.describe "<%= class_name %>" do
+ pending "add some scenarios (or delete) #{__FILE__}"
+
+ # it "renders a message on the home page" do
+ # visit "/"
+ # expect(page).to have_content("Hello, world!")
+ # end
+end
diff --git a/examples/rspec/log/.keep b/examples/rspec/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/public/404.html b/examples/rspec/public/404.html
new file mode 100644
index 0000000..2be3af2
--- /dev/null
+++ b/examples/rspec/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/rspec/public/422.html b/examples/rspec/public/422.html
new file mode 100644
index 0000000..c08eac0
--- /dev/null
+++ b/examples/rspec/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/rspec/public/500.html b/examples/rspec/public/500.html
new file mode 100644
index 0000000..78a030a
--- /dev/null
+++ b/examples/rspec/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/examples/rspec/public/apple-touch-icon-precomposed.png b/examples/rspec/public/apple-touch-icon-precomposed.png
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/public/apple-touch-icon.png b/examples/rspec/public/apple-touch-icon.png
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/public/favicon.ico b/examples/rspec/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/public/robots.txt b/examples/rspec/public/robots.txt
new file mode 100644
index 0000000..c19f78a
--- /dev/null
+++ b/examples/rspec/public/robots.txt
@@ -0,0 +1 @@
+# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
diff --git a/examples/rspec/spec/mailers/.keep b/examples/rspec/spec/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/spec/rails_helper.rb b/examples/rspec/spec/rails_helper.rb
new file mode 100644
index 0000000..b1ebbd8
--- /dev/null
+++ b/examples/rspec/spec/rails_helper.rb
@@ -0,0 +1,63 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+require 'spec_helper'
+ENV['RAILS_ENV'] ||= 'test'
+require_relative '../config/environment'
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
+
+# Checks for pending migrations and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove these lines.
+begin
+ ActiveRecord::Migration.maintain_test_schema!
+rescue ActiveRecord::PendingMigrationError => e
+ abort e.to_s.strip
+end
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # You can uncomment this line to turn off ActiveRecord support entirely.
+ # config.use_active_record = false
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, type: :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://rspec.info/features/6-0/rspec-rails
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/examples/rspec/spec/spec_helper.rb b/examples/rspec/spec/spec_helper.rb
new file mode 100644
index 0000000..327b58e
--- /dev/null
+++ b/examples/rspec/spec/spec_helper.rb
@@ -0,0 +1,94 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/examples/rspec/spec/support/mailer.rb b/examples/rspec/spec/support/mailer.rb
new file mode 100644
index 0000000..b9563a3
--- /dev/null
+++ b/examples/rspec/spec/support/mailer.rb
@@ -0,0 +1,5 @@
+RSpec.configure do |config|
+ config.before(:each) do
+ ActionMailer::Base.deliveries.clear
+ end
+end
diff --git a/examples/rspec/spec/support/system.rb b/examples/rspec/spec/support/system.rb
new file mode 100644
index 0000000..f28a6ea
--- /dev/null
+++ b/examples/rspec/spec/support/system.rb
@@ -0,0 +1,17 @@
+require "capybara/rails"
+require "capybara/rspec"
+
+Capybara.default_max_wait_time = 2
+Capybara.disable_animation = true
+
+RSpec.configure do |config|
+ config.before(:each, type: :system) do
+ driven_by :selenium,
+ using: (ENV["SHOW_BROWSER"] ? :chrome : :headless_chrome),
+ screen_size: [1400, 1400] do |options|
+ # Allows running in Docker
+ options.add_argument("--disable-dev-shm-usage")
+ options.add_argument("--no-sandbox")
+ end
+ end
+end
diff --git a/examples/rspec/storage/.keep b/examples/rspec/storage/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/tmp/.keep b/examples/rspec/tmp/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/tmp/pids/.keep b/examples/rspec/tmp/pids/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/tmp/storage/.keep b/examples/rspec/tmp/storage/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/vendor/.keep b/examples/rspec/vendor/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/rspec/vendor/javascript/.keep b/examples/rspec/vendor/javascript/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/vite/.dockerignore b/examples/vite/.dockerignore
new file mode 100644
index 0000000..9612375
--- /dev/null
+++ b/examples/vite/.dockerignore
@@ -0,0 +1,37 @@
+# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
+
+# Ignore git directory.
+/.git/
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all default key files.
+/config/master.key
+/config/credentials/*.key
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/.keep
+
+# Ignore assets.
+/node_modules/
+/app/assets/builds/*
+!/app/assets/builds/.keep
+/public/assets
diff --git a/examples/vite/.editorconfig b/examples/vite/.editorconfig
new file mode 100644
index 0000000..bf44d02
--- /dev/null
+++ b/examples/vite/.editorconfig
@@ -0,0 +1,14 @@
+# https://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[Makefile]
+indent_style = tab
diff --git a/examples/vite/.gitattributes b/examples/vite/.gitattributes
new file mode 100644
index 0000000..8dc4323
--- /dev/null
+++ b/examples/vite/.gitattributes
@@ -0,0 +1,9 @@
+# See https://git-scm.com/docs/gitattributes for more about git attribute files.
+
+# Mark the database schema as having been generated.
+db/schema.rb linguist-generated
+
+# Mark any vendored files as having been vendored.
+vendor/* linguist-vendored
+config/credentials/*.yml.enc diff=rails_credentials
+config/credentials.yml.enc diff=rails_credentials
diff --git a/examples/vite/.gitignore b/examples/vite/.gitignore
new file mode 100644
index 0000000..548107c
--- /dev/null
+++ b/examples/vite/.gitignore
@@ -0,0 +1,44 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/
+!/tmp/storage/.keep
+
+/public/assets
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
+node_modules/
+
+# Vite Ruby
+/public/vite*
+node_modules
+# Vite uses dotenv and suggests to ignore local-only env files. See
+# https://vitejs.dev/guide/env-and-mode.html#env-files
+*.local
+
diff --git a/examples/vite/.node-version b/examples/vite/.node-version
new file mode 100644
index 0000000..f6610ca
--- /dev/null
+++ b/examples/vite/.node-version
@@ -0,0 +1 @@
+18.18.1
diff --git a/examples/vite/.prettierrc.cjs b/examples/vite/.prettierrc.cjs
new file mode 100644
index 0000000..5f16540
--- /dev/null
+++ b/examples/vite/.prettierrc.cjs
@@ -0,0 +1,6 @@
+/** @type {import("prettier").Config} */
+
+module.exports = {
+ tabWidth: 2,
+ useTabs: false,
+};
diff --git a/examples/vite/.ruby-version b/examples/vite/.ruby-version
new file mode 100644
index 0000000..be94e6f
--- /dev/null
+++ b/examples/vite/.ruby-version
@@ -0,0 +1 @@
+3.2.2
diff --git a/examples/vite/DEPLOYMENT.md b/examples/vite/DEPLOYMENT.md
new file mode 100644
index 0000000..bffadca
--- /dev/null
+++ b/examples/vite/DEPLOYMENT.md
@@ -0,0 +1,10 @@
+# Deployment
+
+## Environment variables
+
+These environment variables affect how the app functions when deployed in production.
+
+- `RAILS_DISABLE_SSL` - Disable HSTS and secure cookies
+- `RAILS_MAX_THREADS` - Number of threads per Puma process (default: 5)
+- **REQUIRED** `SECRET_KEY_BASE` - Unique, secret key used to encrypt and sign cookies and other sensitive data
+- `WEB_CONCURRENCY` - Number of Puma processes (default: number of CPUs)
diff --git a/examples/vite/Dockerfile b/examples/vite/Dockerfile
new file mode 100644
index 0000000..7ac1730
--- /dev/null
+++ b/examples/vite/Dockerfile
@@ -0,0 +1,72 @@
+# syntax = docker/dockerfile:1
+
+# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
+ARG RUBY_VERSION=3.2.2
+FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
+
+# Rails app lives here
+WORKDIR /rails
+
+# Set production environment
+ENV RAILS_ENV="production" \
+ BUNDLE_DEPLOYMENT="1" \
+ BUNDLE_PATH="/usr/local/bundle" \
+ BUNDLE_WITHOUT="development"
+
+
+# Throw-away build stage to reduce size of final image
+FROM base as build
+
+# Install packages needed to build gems and node modules
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y build-essential curl git libvips node-gyp pkg-config python-is-python3
+
+# Install JavaScript dependencies
+ARG NODE_VERSION=18.18.1
+ARG YARN_VERSION=1.22.19
+ENV PATH=/usr/local/node/bin:$PATH
+RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
+ /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
+ npm install -g yarn@$YARN_VERSION && \
+ rm -rf /tmp/node-build-master
+
+# Install application gems
+COPY Gemfile Gemfile.lock ./
+RUN bundle install && \
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
+ bundle exec bootsnap precompile --gemfile
+
+# Install node modules
+COPY package.json yarn.lock ./
+RUN yarn install --frozen-lockfile
+
+# Copy application code
+COPY . .
+
+# Precompile bootsnap code for faster boot times
+RUN bundle exec bootsnap precompile app/ lib/
+
+
+# Final stage for app image
+FROM base
+
+# Install packages needed for deployment
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Copy built artifacts: gems, application
+COPY --from=build /usr/local/bundle /usr/local/bundle
+COPY --from=build /rails /rails
+
+# Run and own only the runtime files as a non-root user for security
+RUN useradd rails --create-home --shell /bin/bash && \
+ chown -R rails:rails db log storage tmp
+USER rails:rails
+
+# Entrypoint prepares the database.
+ENTRYPOINT ["/rails/bin/docker-entrypoint"]
+
+# Start the server by default, this can be overwritten at runtime
+EXPOSE 3000
+CMD ["./bin/rails", "server"]
diff --git a/examples/vite/Gemfile b/examples/vite/Gemfile
new file mode 100644
index 0000000..a1b4de4
--- /dev/null
+++ b/examples/vite/Gemfile
@@ -0,0 +1,27 @@
+source "https://rubygems.org"
+
+ruby Pathname.new(__dir__).join(".ruby-version").read.strip
+
+gem "vite_rails", "~> 3.0"
+gem "rails", "~> 7.1.1"
+gem "sqlite3", "~> 1.4"
+gem "puma", ">= 5.0"
+gem "turbo-rails"
+gem "stimulus-rails"
+gem "jbuilder"
+gem "redis", ">= 4.0.1"
+gem "tzinfo-data", platforms: %i[ windows jruby ]
+gem "bootsnap", require: false
+
+group :development, :test do
+ gem "debug", platforms: %i[ mri windows ]
+end
+
+group :development do
+ gem "web-console"
+end
+
+group :test do
+ gem "capybara"
+ gem "selenium-webdriver"
+end
diff --git a/examples/vite/Gemfile.lock b/examples/vite/Gemfile.lock
new file mode 100644
index 0000000..463e834
--- /dev/null
+++ b/examples/vite/Gemfile.lock
@@ -0,0 +1,264 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (7.1.1)
+ actionpack (= 7.1.1)
+ activesupport (= 7.1.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ zeitwerk (~> 2.6)
+ actionmailbox (7.1.1)
+ actionpack (= 7.1.1)
+ activejob (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ mail (>= 2.7.1)
+ net-imap
+ net-pop
+ net-smtp
+ actionmailer (7.1.1)
+ actionpack (= 7.1.1)
+ actionview (= 7.1.1)
+ activejob (= 7.1.1)
+ activesupport (= 7.1.1)
+ mail (~> 2.5, >= 2.5.4)
+ net-imap
+ net-pop
+ net-smtp
+ rails-dom-testing (~> 2.2)
+ actionpack (7.1.1)
+ actionview (= 7.1.1)
+ activesupport (= 7.1.1)
+ nokogiri (>= 1.8.5)
+ rack (>= 2.2.4)
+ rack-session (>= 1.0.1)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ actiontext (7.1.1)
+ actionpack (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ globalid (>= 0.6.0)
+ nokogiri (>= 1.8.5)
+ actionview (7.1.1)
+ activesupport (= 7.1.1)
+ builder (~> 3.1)
+ erubi (~> 1.11)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ activejob (7.1.1)
+ activesupport (= 7.1.1)
+ globalid (>= 0.3.6)
+ activemodel (7.1.1)
+ activesupport (= 7.1.1)
+ activerecord (7.1.1)
+ activemodel (= 7.1.1)
+ activesupport (= 7.1.1)
+ timeout (>= 0.4.0)
+ activestorage (7.1.1)
+ actionpack (= 7.1.1)
+ activejob (= 7.1.1)
+ activerecord (= 7.1.1)
+ activesupport (= 7.1.1)
+ marcel (~> 1.0)
+ activesupport (7.1.1)
+ base64
+ bigdecimal
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ mutex_m
+ tzinfo (~> 2.0)
+ addressable (2.8.5)
+ public_suffix (>= 2.0.2, < 6.0)
+ base64 (0.1.1)
+ bigdecimal (3.1.4)
+ bindex (0.8.1)
+ bootsnap (1.16.0)
+ msgpack (~> 1.2)
+ builder (3.2.4)
+ capybara (3.39.2)
+ addressable
+ matrix
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.8)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ regexp_parser (>= 1.5, < 3.0)
+ xpath (~> 3.2)
+ concurrent-ruby (1.2.2)
+ connection_pool (2.4.1)
+ crass (1.0.6)
+ date (3.3.3)
+ debug (1.8.0)
+ irb (>= 1.5.0)
+ reline (>= 0.3.1)
+ drb (2.1.1)
+ ruby2_keywords
+ dry-cli (1.0.0)
+ erubi (1.12.0)
+ globalid (1.2.1)
+ activesupport (>= 6.1)
+ i18n (1.14.1)
+ concurrent-ruby (~> 1.0)
+ io-console (0.6.0)
+ irb (1.8.2)
+ rdoc
+ reline (>= 0.3.8)
+ jbuilder (2.11.5)
+ actionview (>= 5.0.0)
+ activesupport (>= 5.0.0)
+ loofah (2.21.4)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.12.0)
+ mail (2.8.1)
+ mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
+ marcel (1.0.2)
+ matrix (0.4.2)
+ mini_mime (1.1.5)
+ minitest (5.20.0)
+ msgpack (1.7.2)
+ mutex_m (0.1.2)
+ net-imap (0.4.1)
+ date
+ net-protocol
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.2.1)
+ timeout
+ net-smtp (0.4.0)
+ net-protocol
+ nio4r (2.5.9)
+ nokogiri (1.15.4-x86_64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.15.4-x86_64-linux)
+ racc (~> 1.4)
+ psych (5.1.1)
+ stringio
+ public_suffix (5.0.3)
+ puma (6.4.0)
+ nio4r (~> 2.0)
+ racc (1.7.1)
+ rack (3.0.8)
+ rack-proxy (0.7.7)
+ rack
+ rack-session (2.0.0)
+ rack (>= 3.0.0)
+ rack-test (2.1.0)
+ rack (>= 1.3)
+ rackup (2.1.0)
+ rack (>= 3)
+ webrick (~> 1.8)
+ rails (7.1.1)
+ actioncable (= 7.1.1)
+ actionmailbox (= 7.1.1)
+ actionmailer (= 7.1.1)
+ actionpack (= 7.1.1)
+ actiontext (= 7.1.1)
+ actionview (= 7.1.1)
+ activejob (= 7.1.1)
+ activemodel (= 7.1.1)
+ activerecord (= 7.1.1)
+ activestorage (= 7.1.1)
+ activesupport (= 7.1.1)
+ bundler (>= 1.15.0)
+ railties (= 7.1.1)
+ rails-dom-testing (2.2.0)
+ activesupport (>= 5.0.0)
+ minitest
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.6.0)
+ loofah (~> 2.21)
+ nokogiri (~> 1.14)
+ railties (7.1.1)
+ actionpack (= 7.1.1)
+ activesupport (= 7.1.1)
+ irb
+ rackup (>= 1.0.0)
+ rake (>= 12.2)
+ thor (~> 1.0, >= 1.2.2)
+ zeitwerk (~> 2.6)
+ rake (13.0.6)
+ rdoc (6.5.0)
+ psych (>= 4.0.0)
+ redis (5.0.7)
+ redis-client (>= 0.9.0)
+ redis-client (0.17.0)
+ connection_pool
+ regexp_parser (2.8.2)
+ reline (0.3.9)
+ io-console (~> 0.5)
+ rexml (3.2.6)
+ ruby2_keywords (0.0.5)
+ rubyzip (2.3.2)
+ selenium-webdriver (4.14.0)
+ rexml (~> 3.2, >= 3.2.5)
+ rubyzip (>= 1.2.2, < 3.0)
+ websocket (~> 1.0)
+ sqlite3 (1.6.7-x86_64-darwin)
+ sqlite3 (1.6.7-x86_64-linux)
+ stimulus-rails (1.3.0)
+ railties (>= 6.0.0)
+ stringio (3.0.8)
+ thor (1.2.2)
+ timeout (0.4.0)
+ turbo-rails (1.5.0)
+ actionpack (>= 6.0.0)
+ activejob (>= 6.0.0)
+ railties (>= 6.0.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ vite_rails (3.0.17)
+ railties (>= 5.1, < 8)
+ vite_ruby (~> 3.0, >= 3.2.2)
+ vite_ruby (3.3.4)
+ dry-cli (>= 0.7, < 2)
+ rack-proxy (~> 0.6, >= 0.6.1)
+ zeitwerk (~> 2.2)
+ web-console (4.2.1)
+ actionview (>= 6.0.0)
+ activemodel (>= 6.0.0)
+ bindex (>= 0.4.0)
+ railties (>= 6.0.0)
+ webrick (1.8.1)
+ websocket (1.2.10)
+ websocket-driver (0.7.6)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+ xpath (3.2.0)
+ nokogiri (~> 1.8)
+ zeitwerk (2.6.12)
+
+PLATFORMS
+ x86_64-darwin-22
+ x86_64-linux
+
+DEPENDENCIES
+ bootsnap
+ capybara
+ debug
+ jbuilder
+ puma (>= 5.0)
+ rails (~> 7.1.1)
+ redis (>= 4.0.1)
+ selenium-webdriver
+ sqlite3 (~> 1.4)
+ stimulus-rails
+ turbo-rails
+ tzinfo-data
+ vite_rails (~> 3.0)
+ web-console
+
+RUBY VERSION
+ ruby 3.2.2p53
+
+BUNDLED WITH
+ 2.4.20
diff --git a/examples/vite/Procfile b/examples/vite/Procfile
new file mode 100644
index 0000000..90ae0ac
--- /dev/null
+++ b/examples/vite/Procfile
@@ -0,0 +1,2 @@
+web: bundle exec puma -C config/puma.rb
+release: bundle exec rake db:migrate
diff --git a/examples/vite/README.md b/examples/vite/README.md
new file mode 100644
index 0000000..b17fcd8
--- /dev/null
+++ b/examples/vite/README.md
@@ -0,0 +1,50 @@
+# vite_example
+
+This is a Rails 7.1 app.
+
+## Prerequisites
+
+This project requires:
+
+- Ruby (see [.ruby-version](./.ruby-version)), preferably managed using [rbenv](https://github.com/rbenv/rbenv)
+- Node 18 (LTS) or newer
+- Yarn 1.x (classic)
+
+On macOS, these [Homebrew](http://brew.sh) packages are recommended:
+
+```
+brew install rbenv
+brew install node
+brew install yarn
+```
+
+## Getting started
+
+### bin/setup
+
+Run this script to install necessary dependencies and prepare the Rails app to be started for the first time.
+
+```
+bin/setup
+```
+
+> [!NOTE]
+> The `bin/setup` script is idempotent and is designed to be run often. You should run it every time you pull code that introduces new dependencies or makes other significant changes to the project.
+
+### Run the app!
+
+Start the Rails server with this command:
+
+```
+yarn start
+```
+
+The app will be located at .
+
+## Development
+
+Use this command to run the full suite of automated tests:
+
+```
+bin/rake
+```
diff --git a/examples/vite/Rakefile b/examples/vite/Rakefile
new file mode 100644
index 0000000..c332601
--- /dev/null
+++ b/examples/vite/Rakefile
@@ -0,0 +1,13 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative "config/application"
+
+Rails.application.load_tasks
+
+Rake::Task[:default].prerequisites.clear if Rake::Task.task_defined?(:default)
+
+desc "Run all checks"
+task default: %w[test:all] do
+ Thor::Base.shell.new.say_status :OK, "All checks passed!"
+end
diff --git a/examples/vite/app/channels/application_cable/channel.rb b/examples/vite/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000..d672697
--- /dev/null
+++ b/examples/vite/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/examples/vite/app/channels/application_cable/connection.rb b/examples/vite/app/channels/application_cable/connection.rb
new file mode 100644
index 0000000..0ff5442
--- /dev/null
+++ b/examples/vite/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/examples/vite/app/controllers/application_controller.rb b/examples/vite/app/controllers/application_controller.rb
new file mode 100644
index 0000000..09705d1
--- /dev/null
+++ b/examples/vite/app/controllers/application_controller.rb
@@ -0,0 +1,2 @@
+class ApplicationController < ActionController::Base
+end
diff --git a/examples/vite/app/controllers/concerns/.keep b/examples/vite/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/vite/app/controllers/home_controller.rb b/examples/vite/app/controllers/home_controller.rb
new file mode 100644
index 0000000..95f2992
--- /dev/null
+++ b/examples/vite/app/controllers/home_controller.rb
@@ -0,0 +1,4 @@
+class HomeController < ApplicationController
+ def index
+ end
+end
diff --git a/examples/vite/app/frontend/controllers/application.js b/examples/vite/app/frontend/controllers/application.js
new file mode 100644
index 0000000..1213e85
--- /dev/null
+++ b/examples/vite/app/frontend/controllers/application.js
@@ -0,0 +1,9 @@
+import { Application } from "@hotwired/stimulus"
+
+const application = Application.start()
+
+// Configure Stimulus development experience
+application.debug = false
+window.Stimulus = application
+
+export { application }
diff --git a/examples/vite/app/frontend/controllers/hello_controller.js b/examples/vite/app/frontend/controllers/hello_controller.js
new file mode 100644
index 0000000..5975c07
--- /dev/null
+++ b/examples/vite/app/frontend/controllers/hello_controller.js
@@ -0,0 +1,7 @@
+import { Controller } from "@hotwired/stimulus"
+
+export default class extends Controller {
+ connect() {
+ this.element.textContent = "Hello World!"
+ }
+}
diff --git a/examples/vite/app/frontend/controllers/index.js b/examples/vite/app/frontend/controllers/index.js
new file mode 100644
index 0000000..e4388b3
--- /dev/null
+++ b/examples/vite/app/frontend/controllers/index.js
@@ -0,0 +1,5 @@
+import { application } from "./application";
+import { registerControllers } from "stimulus-vite-helpers";
+
+const controllers = import.meta.glob("./**/*_controller.js", { eager: true });
+registerControllers(application, controllers);
diff --git a/examples/vite/app/frontend/entrypoints/application.js b/examples/vite/app/frontend/entrypoints/application.js
new file mode 100644
index 0000000..be186b1
--- /dev/null
+++ b/examples/vite/app/frontend/entrypoints/application.js
@@ -0,0 +1,31 @@
+import "~/stylesheets/index.css";
+import "~/controllers";
+import "@hotwired/turbo-rails";
+// To see this message, add the following to the `` section in your
+// views/layouts/application.html.erb
+//
+// <%= vite_client_tag %>
+// <%= vite_javascript_tag 'application' %>
+console.log('Vite ⚡️ Rails')
+
+// If using a TypeScript entrypoint file:
+// <%= vite_typescript_tag 'application' %>
+//
+// If you want to use .jsx or .tsx, add the extension:
+// <%= vite_javascript_tag 'application.jsx' %>
+
+console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails')
+
+// Example: Load Rails libraries in Vite.
+//
+// import * as Turbo from '@hotwired/turbo'
+// Turbo.start()
+//
+// import ActiveStorage from '@rails/activestorage'
+// ActiveStorage.start()
+//
+// // Import all channels.
+// const channels = import.meta.globEager('./**/*_channel.js')
+
+// Example: Import a stylesheet in app/frontend/index.css
+// import '~/index.css'
diff --git a/examples/vite/app/frontend/images/.keep b/examples/vite/app/frontend/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/examples/vite/app/frontend/images/example.svg b/examples/vite/app/frontend/images/example.svg
new file mode 100644
index 0000000..862e202
--- /dev/null
+++ b/examples/vite/app/frontend/images/example.svg
@@ -0,0 +1,3 @@
+
diff --git a/examples/vite/app/frontend/stylesheets/base.css b/examples/vite/app/frontend/stylesheets/base.css
new file mode 100644
index 0000000..aedca96
--- /dev/null
+++ b/examples/vite/app/frontend/stylesheets/base.css
@@ -0,0 +1,8 @@
+/*
+ This file is for base element styles, like:
+
+ - Any @font-face declarations needed custom web fonts.
+ - Default font-family on the body element.
+ - Default foreground, background, and link colors.
+ - Global CSS variables (declared on :root), such as color palette.
+*/
diff --git a/examples/vite/app/frontend/stylesheets/index.css b/examples/vite/app/frontend/stylesheets/index.css
new file mode 100644
index 0000000..1742028
--- /dev/null
+++ b/examples/vite/app/frontend/stylesheets/index.css
@@ -0,0 +1,3 @@
+@import "modern-normalize";
+@import "reset";
+@import "base";
diff --git a/examples/vite/app/frontend/stylesheets/reset.css b/examples/vite/app/frontend/stylesheets/reset.css
new file mode 100644
index 0000000..0e7b575
--- /dev/null
+++ b/examples/vite/app/frontend/stylesheets/reset.css
@@ -0,0 +1,36 @@
+:root {
+ line-height: 1.5;
+ -webkit-font-smoothing: antialiased;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+figure,
+p,
+ol,
+ul {
+ margin: 0;
+}
+
+ol,
+ul {
+ list-style: none;
+ padding-inline: 0;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5 {
+ font-size: inherit;
+ font-weight: inherit;
+}
+
+img {
+ display: block;
+ max-inline-size: 100%;
+}
diff --git a/examples/vite/app/helpers/application_helper.rb b/examples/vite/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/examples/vite/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/examples/vite/app/helpers/inline_svg_helper.rb b/examples/vite/app/helpers/inline_svg_helper.rb
new file mode 100644
index 0000000..0e30278
--- /dev/null
+++ b/examples/vite/app/helpers/inline_svg_helper.rb
@@ -0,0 +1,9 @@
+module InlineSvgHelper
+ def inline_svg_tag(filename, title: nil)
+ svg = ViteInlineSvgFileLoader.named(filename)
+ svg = svg.sub(/\A