From 72b94fc682090125984a402e586a9113bbe27038 Mon Sep 17 00:00:00 2001 From: tofu Date: Mon, 2 Mar 2026 23:49:35 +0500 Subject: [PATCH] Initial commit --- .env | 2 + .gitignore | 7 + Gemfile | 33 ++++ Gemfile.lock | 304 +++++++++++++++++++++++++++++ Procfile.dev | 2 + README.md | 15 ++ Rakefile | 6 + app/action.rb | 12 ++ app/actions/.keep | 0 app/assets/css/app.css | 5 + app/assets/images/favicon.ico | Bin 0 -> 154 bytes app/assets/js/app.js | 1 + app/db/relation.rb | 10 + app/db/repo.rb | 10 + app/db/struct.rb | 10 + app/operation.rb | 9 + app/relations/cards.rb | 0 app/repos/card_repo.rb | 0 app/services/deck_generator.rb | 0 app/structs/.keep | 0 app/templates/layouts/app.html.erb | 14 ++ app/view.rb | 9 + app/views/context.rb | 10 + app/views/helpers.rb | 10 + bin/dev | 8 + bin/setup | 25 +++ config.ru | 5 + config/app.rb | 8 + config/assets.js | 17 ++ config/db/migrate/.keep | 0 config/db/seeds.rb | 15 ++ config/providers/db.rb | 0 config/puma.rb | 47 +++++ config/routes.rb | 7 + config/settings.rb | 9 + db/.keep | 0 db/development.sqlite3 | Bin 0 -> 12288 bytes lib/clash_deck_generator/types.rb | 11 ++ lib/tasks/.keep | 0 package.json | 8 + public/404.html | 82 ++++++++ public/500.html | 82 ++++++++ 42 files changed, 793 insertions(+) create mode 100644 .env create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Procfile.dev create mode 100644 README.md create mode 100644 Rakefile create mode 100644 app/action.rb create mode 100644 app/actions/.keep create mode 100644 app/assets/css/app.css create mode 100644 app/assets/images/favicon.ico create mode 100644 app/assets/js/app.js create mode 100644 app/db/relation.rb create mode 100644 app/db/repo.rb create mode 100644 app/db/struct.rb create mode 100644 app/operation.rb create mode 100644 app/relations/cards.rb create mode 100644 app/repos/card_repo.rb create mode 100644 app/services/deck_generator.rb create mode 100644 app/structs/.keep create mode 100644 app/templates/layouts/app.html.erb create mode 100644 app/view.rb create mode 100644 app/views/context.rb create mode 100644 app/views/helpers.rb create mode 100644 bin/dev create mode 100644 bin/setup create mode 100644 config.ru create mode 100644 config/app.rb create mode 100644 config/assets.js create mode 100644 config/db/migrate/.keep create mode 100644 config/db/seeds.rb create mode 100644 config/providers/db.rb create mode 100644 config/puma.rb create mode 100644 config/routes.rb create mode 100644 config/settings.rb create mode 100644 db/.keep create mode 100644 db/development.sqlite3 create mode 100644 lib/clash_deck_generator/types.rb create mode 100644 lib/tasks/.keep create mode 100644 package.json create mode 100644 public/404.html create mode 100644 public/500.html diff --git a/.env b/.env new file mode 100644 index 0000000..0834868 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +# This is checked into source control, so put sensitive values into `.env.local` +DATABASE_URL=sqlite://db/development.sqlite3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bf55af --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.env*.local +log/* +public/* +!public/404.html +!public/500.html +node_modules/ +db/*.sqlite diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..db2e83d --- /dev/null +++ b/Gemfile @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "hanami", "~> 2.3.0" +gem "hanami-assets", "~> 2.3.0" +gem "hanami-controller", "~> 2.3.0" +gem "hanami-db", "~> 2.3.0" +gem "hanami-router", "~> 2.3.0" +gem "hanami-validations", "~> 2.3.0" +gem "hanami-view", "~> 2.3.0" + +gem "dry-types", "~> 1.7" +gem "dry-operation", ">= 1.0.1" +gem "puma" +gem "rake" +gem "sqlite3" + +group :development do + gem "hanami-webconsole", "~> 2.3.0" +end + +group :development, :test do + gem "dotenv" +end + +group :cli, :development do + gem "hanami-reloader", "~> 2.3.0" +end + +group :cli, :development, :test do + gem "hanami-rspec", "~> 2.3.0" +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..c5f008c --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,304 @@ +GEM + remote: https://rubygems.org/ + specs: + base64 (0.3.0) + better_errors (2.10.1) + erubi (>= 1.0.0) + rack (>= 0.9.0) + rouge (>= 1.0.0) + bigdecimal (3.3.1) + binding_of_caller (1.0.1) + debug_inspector (>= 1.2.0) + coderay (1.1.3) + concurrent-ruby (1.3.6) + csv (3.3.5) + date (3.5.1) + debug_inspector (1.2.0) + diff-lcs (1.6.2) + dotenv (3.2.0) + dry-auto_inject (1.1.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-cli (1.4.1) + dry-configurable (1.3.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-core (1.2.0) + concurrent-ruby (~> 1.0) + logger + zeitwerk (~> 2.6) + dry-events (1.1.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.1) + dry-files (1.1.0) + dry-inflector (1.3.1) + dry-initializer (3.2.0) + dry-logger (1.2.1) + logger + dry-logic (1.6.0) + bigdecimal + concurrent-ruby (~> 1.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-monads (1.9.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-monitor (1.0.1) + dry-configurable (~> 1.0, < 2) + dry-core (~> 1.0, < 2) + dry-events (~> 1.0, < 2) + dry-operation (1.1.0) + dry-monads (~> 1.6) + zeitwerk (~> 2.6) + dry-schema (1.15.0) + concurrent-ruby (~> 1.0) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.1) + dry-initializer (~> 3.2) + dry-logic (~> 1.6) + dry-types (~> 1.8) + zeitwerk (~> 2.6) + dry-struct (1.8.0) + dry-core (~> 1.1) + dry-types (~> 1.8, >= 1.8.2) + ice_nine (~> 0.11) + zeitwerk (~> 2.6) + dry-system (1.2.5) + dry-auto_inject (~> 1.1) + dry-configurable (~> 1.3) + dry-core (~> 1.1) + dry-inflector (~> 1.1) + dry-transformer (1.1.0) + bigdecimal + zeitwerk (~> 2.6) + dry-types (1.9.1) + bigdecimal (>= 3.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) + zeitwerk (~> 2.6) + dry-validation (1.11.1) + concurrent-ruby (~> 1.0) + dry-core (~> 1.1) + dry-initializer (~> 3.2) + dry-schema (~> 1.14) + zeitwerk (~> 2.6) + erb (6.0.2) + erubi (1.13.1) + ffi (1.17.3-x64-mingw-ucrt) + formatador (1.2.3) + reline + guard (2.20.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + logger (~> 1.6) + lumberjack (>= 1.0.12, < 2.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.13.0) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-puma (0.9.2) + guard (~> 2.14) + guard-compat (~> 1.2) + puma (>= 4.0, < 8) + hanami (2.3.2) + bundler (>= 2.0) + dry-configurable (~> 1.0, >= 1.2.0, < 2) + dry-core (~> 1.0, < 2) + dry-inflector (~> 1.0, >= 1.1.0, < 2) + dry-logger (~> 1.2, < 2) + dry-monitor (~> 1.0, >= 1.0.1, < 2) + dry-system (~> 1.1) + hanami-cli (>= 2.3.1) + hanami-utils (>= 2.3.0) + json (>= 2.7.2) + rack-session + zeitwerk (~> 2.6) + hanami-assets (2.3.0) + zeitwerk (~> 2.6) + hanami-cli (2.3.5) + bundler (>= 2.1) + dry-cli (~> 1.0, >= 1.1.0) + dry-files (~> 1.0, >= 1.0.2) + dry-inflector (~> 1.0) + irb + rackup + rake (~> 13.0) + zeitwerk (~> 2.6) + hanami-controller (2.3.1) + dry-configurable (~> 1.0, < 2) + dry-core (~> 1.0) + hanami-utils (~> 2.3.0) + rack (>= 2.1) + zeitwerk (~> 2.6) + hanami-db (2.3.0) + rom (~> 5.4, >= 5.4.1) + rom-sql (~> 3.7) + zeitwerk (~> 2.6) + hanami-reloader (2.3.0) + guard (~> 2.19) + guard-puma (~> 0.8) + hanami-cli (~> 2.3.0) + zeitwerk (~> 2.6) + hanami-router (2.3.1) + csv (~> 3.3) + mustermann (~> 3.0) + mustermann-contrib (~> 3.0) + rack (>= 2.2.16) + hanami-rspec (2.3.1) + hanami-cli (~> 2.3.0) + rake (~> 13.0) + rspec (~> 3.12) + zeitwerk (~> 2.6) + hanami-utils (2.3.0) + bigdecimal (~> 3.1) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + dry-transformer (~> 1.0, < 2) + hanami-validations (2.3.0) + dry-validation (>= 1.10, < 2) + hanami-view (2.3.1) + dry-configurable (~> 1.0) + dry-core (~> 1.0) + dry-inflector (~> 1.0, < 2) + temple (~> 0.10.0, >= 0.10.2) + tilt (~> 2.3) + zeitwerk (~> 2.6) + hanami-webconsole (2.3.1) + better_errors (~> 2.10, >= 2.10.1) + binding_of_caller (~> 1.0) + hansi (0.2.1) + ice_nine (0.11.2) + io-console (0.8.2) + irb (1.17.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + json (2.18.1) + listen (3.10.0) + logger + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + lumberjack (1.4.2) + method_source (1.1.0) + mustermann (3.0.4) + ruby2_keywords (~> 0.0.1) + mustermann-contrib (3.0.4) + hansi (~> 0.2.0) + mustermann (= 3.0.4) + nenv (0.3.0) + nio4r (2.7.5) + notiffany (0.1.3) + nenv (~> 0.1) + shellany (~> 0.0) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.9.0) + pry (0.16.0) + coderay (~> 1.1) + method_source (~> 1.0) + reline (>= 0.6.0) + psych (5.3.1) + date + stringio + puma (7.2.0) + nio4r (~> 2.0) + rack (3.2.5) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rackup (2.3.1) + rack (>= 3) + rake (13.3.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rdoc (7.2.0) + erb + psych (>= 4.0.0) + tsort + reline (0.6.3) + io-console (~> 0.5) + rom (5.4.3) + rom-changeset (~> 5.4) + rom-core (~> 5.4) + rom-repository (~> 5.4, >= 5.4.3) + rom-changeset (5.4.0) + dry-core (~> 1.0) + rom-core (~> 5.4) + transproc (~> 1.1) + rom-core (5.4.0) + concurrent-ruby (~> 1.1) + dry-configurable (~> 1.0) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-initializer (~> 3.2) + dry-struct (~> 1.0) + dry-types (~> 1.6) + transproc (~> 1.1) + rom-repository (5.4.3) + dry-core (~> 1.0) + dry-initializer (~> 3.2) + rom-core (~> 5.4) + rom-sql (3.7.0) + dry-core (~> 1.1) + dry-types (~> 1.8) + rom (~> 5.4) + sequel (>= 4.49) + rouge (4.7.0) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.8) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.7) + ruby2_keywords (0.0.5) + sequel (5.102.0) + bigdecimal + shellany (0.0.1) + sqlite3 (2.9.1-x64-mingw-ucrt) + stringio (3.2.0) + temple (0.10.4) + thor (1.5.0) + tilt (2.7.0) + transproc (1.1.1) + tsort (0.2.0) + zeitwerk (2.7.5) + +PLATFORMS + x64-mingw-ucrt + +DEPENDENCIES + dotenv + dry-operation (>= 1.0.1) + dry-types (~> 1.7) + hanami (~> 2.3.0) + hanami-assets (~> 2.3.0) + hanami-controller (~> 2.3.0) + hanami-db (~> 2.3.0) + hanami-reloader (~> 2.3.0) + hanami-router (~> 2.3.0) + hanami-rspec (~> 2.3.0) + hanami-validations (~> 2.3.0) + hanami-view (~> 2.3.0) + hanami-webconsole (~> 2.3.0) + puma + rake + sqlite3 + +BUNDLED WITH + 2.5.22 diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 0000000..d8377a4 --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,2 @@ +web: bundle exec hanami server +assets: bundle exec hanami assets watch diff --git a/README.md b/README.md new file mode 100644 index 0000000..125c908 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# ClashDeckGenerator + +🌸 Welcome to your Hanami app! + +## Getting started + +- Set up the project with `bin/setup` +- Run the server with `bin/dev` +- View the app at [http://localhost:2300](http://localhost:2300) +- Run the tests with `bundle exec rake` + +## Useful links + +- [Hanami](http://hanamirb.org) +- [Hanami guides](https://guides.hanamirb.org/) diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..7493bd3 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require "hanami/rake_tasks" + +# Add your custom rake tasks to the lib/tasks directory +Rake.add_rakelib "lib/tasks" diff --git a/app/action.rb b/app/action.rb new file mode 100644 index 0000000..6844a7e --- /dev/null +++ b/app/action.rb @@ -0,0 +1,12 @@ +# auto_register: false +# frozen_string_literal: true + +require "hanami/action" +require "dry/monads" + +module ClashDeckGenerator + class Action < Hanami::Action + # Provide `Success` and `Failure` for pattern matching on operation results + include Dry::Monads[:result] + end +end diff --git a/app/actions/.keep b/app/actions/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/css/app.css b/app/assets/css/app.css new file mode 100644 index 0000000..b5ed0f7 --- /dev/null +++ b/app/assets/css/app.css @@ -0,0 +1,5 @@ +body { + background-color: #fff; + color: #000; + font-family: sans-serif; +} diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..617f5febba81a7e1819d674e3f857cc9e6524b0e GIT binary patch literal 154 zcmZQzU}RusFfd>M(i{vc_!t<>7#J876rg+#28Me;F#!PxKZBKlp-r5DK?A4;sD&W` zh(Y?mfD=N2Nk$0!{PiCUo@q}QBy8_8eEj^ELD}s-Lwv;xhA-d#GDMd?XSnzH7sK%j c-x=2K`poeE|9=JnvpWpG|NLX{NPWTp06eQDZU6uP literal 0 HcmV?d00001 diff --git a/app/assets/js/app.js b/app/assets/js/app.js new file mode 100644 index 0000000..0692b84 --- /dev/null +++ b/app/assets/js/app.js @@ -0,0 +1 @@ +import "../css/app.css"; diff --git a/app/db/relation.rb b/app/db/relation.rb new file mode 100644 index 0000000..7ee2217 --- /dev/null +++ b/app/db/relation.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "hanami/db/relation" + +module ClashDeckGenerator + module DB + class Relation < Hanami::DB::Relation + end + end +end diff --git a/app/db/repo.rb b/app/db/repo.rb new file mode 100644 index 0000000..fa839ac --- /dev/null +++ b/app/db/repo.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "hanami/db/repo" + +module ClashDeckGenerator + module DB + class Repo < Hanami::DB::Repo + end + end +end diff --git a/app/db/struct.rb b/app/db/struct.rb new file mode 100644 index 0000000..fb1085a --- /dev/null +++ b/app/db/struct.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "hanami/db/struct" + +module ClashDeckGenerator + module DB + class Struct < Hanami::DB::Struct + end + end +end diff --git a/app/operation.rb b/app/operation.rb new file mode 100644 index 0000000..e4df471 --- /dev/null +++ b/app/operation.rb @@ -0,0 +1,9 @@ +# auto_register: false +# frozen_string_literal: true + +require "dry/operation" + +module ClashDeckGenerator + class Operation < Dry::Operation + end +end diff --git a/app/relations/cards.rb b/app/relations/cards.rb new file mode 100644 index 0000000..e69de29 diff --git a/app/repos/card_repo.rb b/app/repos/card_repo.rb new file mode 100644 index 0000000..e69de29 diff --git a/app/services/deck_generator.rb b/app/services/deck_generator.rb new file mode 100644 index 0000000..e69de29 diff --git a/app/structs/.keep b/app/structs/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/layouts/app.html.erb b/app/templates/layouts/app.html.erb new file mode 100644 index 0000000..1a8cdb2 --- /dev/null +++ b/app/templates/layouts/app.html.erb @@ -0,0 +1,14 @@ + + + + + + Clash deck generator + <%= favicon_tag %> + <%= stylesheet_tag "app" %> + + + <%= yield %> + <%= javascript_tag "app" %> + + diff --git a/app/view.rb b/app/view.rb new file mode 100644 index 0000000..0f6497f --- /dev/null +++ b/app/view.rb @@ -0,0 +1,9 @@ +# auto_register: false +# frozen_string_literal: true + +require "hanami/view" + +module ClashDeckGenerator + class View < Hanami::View + end +end diff --git a/app/views/context.rb b/app/views/context.rb new file mode 100644 index 0000000..3e4b7ef --- /dev/null +++ b/app/views/context.rb @@ -0,0 +1,10 @@ +# auto_register: false +# frozen_string_literal: true + +module ClashDeckGenerator + module Views + class Context < Hanami::View::Context + # Define your view context here. See https://guides.hanamirb.org/views/context/ for details. + end + end +end diff --git a/app/views/helpers.rb b/app/views/helpers.rb new file mode 100644 index 0000000..5d9f92c --- /dev/null +++ b/app/views/helpers.rb @@ -0,0 +1,10 @@ +# auto_register: false +# frozen_string_literal: true + +module ClashDeckGenerator + module Views + module Helpers + # Add your view helpers here + end + end +end diff --git a/bin/dev b/bin/dev new file mode 100644 index 0000000..a43d573 --- /dev/null +++ b/bin/dev @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +if ! gem list foreman -i --silent; then + echo "Installing foreman..." + gem install foreman +fi + +exec foreman start -f Procfile.dev --env=/dev/null "$@" diff --git a/bin/setup b/bin/setup new file mode 100644 index 0000000..e77ca46 --- /dev/null +++ b/bin/setup @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +# This script is a way to set up and keep your development environment updated +# automatically. It is meant to be idempotent so that you can run it at any +# time to get the same result. Add any new necessary setup steps to this file +# as your application evolves. + +announce() { + local bold='\033[1m' + local reset='\033[0m' + printf "${bold}${1}${reset}\n" +} + +announce "Running bundle install..." +bundle check || bundle install + +announce "\nRunning npm install..." +npm install + +announce "\nPreparing the database..." +hanami db prepare + +announce "\n🌸 Setup complete!" diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..879c085 --- /dev/null +++ b/config.ru @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require "hanami/boot" + +run Hanami.app diff --git a/config/app.rb b/config/app.rb new file mode 100644 index 0000000..2bdcbe6 --- /dev/null +++ b/config/app.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require "hanami" + +module ClashDeckGenerator + class App < Hanami::App + end +end diff --git a/config/assets.js b/config/assets.js new file mode 100644 index 0000000..7090e73 --- /dev/null +++ b/config/assets.js @@ -0,0 +1,17 @@ +import * as assets from "hanami-assets"; + +// Assets are managed by esbuild (https://esbuild.github.io), and can be +// customized below. +// +// Learn more at https://guides.hanamirb.org/assets/customization/. + +await assets.run({ + esbuildOptionsFn: (args, esbuildOptions) => { + // Customize your `esbuildOptions` here. + // + // Use the `args.watch` boolean as a condition to apply diffierent options + // when running `hanami assets watch` vs `hanami assets compile`. + + return esbuildOptions; + }, +}); diff --git a/config/db/migrate/.keep b/config/db/migrate/.keep new file mode 100644 index 0000000..e69de29 diff --git a/config/db/seeds.rb b/config/db/seeds.rb new file mode 100644 index 0000000..fd04ba4 --- /dev/null +++ b/config/db/seeds.rb @@ -0,0 +1,15 @@ +# This seeds file should create the database records required to run the app. +# +# The code should be idempotent so that it can be executed at any time. +# +# To load the seeds, run `hanami db seed`. Seeds are also loaded as part of `hanami db prepare`. + +# For example, if you have appropriate repos available: +# +# category_repo = Hanami.app["repos.category_repo"] +# category_repo.create(title: "General") +# +# Alternatively, you can use relations directly: +# +# categories = Hanami.app["relations.categories"] +# categories.insert(title: "General") diff --git a/config/providers/db.rb b/config/providers/db.rb new file mode 100644 index 0000000..e69de29 diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..1866af8 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# +# Environment and port +# +port ENV.fetch("HANAMI_PORT", 2300) +environment ENV.fetch("HANAMI_ENV", "development") + +# +# Threads within each Puma/Ruby process (aka worker) +# + +# Configure the minimum and maximum number of threads to use to answer requests. +max_threads_count = ENV.fetch("HANAMI_MAX_THREADS", 5) +min_threads_count = ENV.fetch("HANAMI_MIN_THREADS") { max_threads_count } + +threads min_threads_count, max_threads_count + +# +# Workers (aka Puma/Ruby processes) +# + +puma_concurrency = Integer(ENV.fetch("HANAMI_WEB_CONCURRENCY", 0)) +puma_cluster_mode = puma_concurrency > 1 + +# How many worker (Puma/Ruby) processes to run. +# Typically this is set to the number of available cores. +workers puma_concurrency + +# +# Cluster mode (aka multiple workers) +# + +if puma_cluster_mode + # Preload the application before starting the workers. Only in cluster mode. + preload_app! + + # Code to run immediately before master process forks workers (once on boot). + # + # These hooks can block if necessary to wait for background operations unknown + # to puma to finish before the process terminates. This can be used to close + # any connections to remote servers (database, redis, …) that were opened when + # preloading the code. + before_fork do + Hanami.shutdown + end +end diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..02a1529 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module ClashDeckGenerator + class Routes < Hanami::Routes + # Add your routes here. See https://guides.hanamirb.org/routing/overview/ for details. + end +end diff --git a/config/settings.rb b/config/settings.rb new file mode 100644 index 0000000..3c67e29 --- /dev/null +++ b/config/settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module ClashDeckGenerator + class Settings < Hanami::Settings + # Define your app settings here, for example: + # + # setting :my_flag, default: false, constructor: Types::Params::Bool + end +end diff --git a/db/.keep b/db/.keep new file mode 100644 index 0000000..e69de29 diff --git a/db/development.sqlite3 b/db/development.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..f48fa96ca9bdd709e902f35828e400b62750a867 GIT binary patch literal 12288 zcmeI1KX2Pc7{>2J*%a-FS0j}P)wO*_23v((*vK3tj>FW3U8PZFqzQrwC+TEgL6Hhc zC05X>LB)N_BH`$^0D=vmfNoTTMeH#wyy8{ z+REO`@8vYl4oqtu|{c@{*m+$#^tD)#g-tfO^@Y*f75BB%@L2dW;fnSY9tkU5r zZF|Sx-s5W{ZMVkPR@+gp7lo_URrpXsBm1fiO&||t*b(s%`t2jp>nj*ksZ?d4j#b=j zM@c#{G}(Hz{JUeW`;9xkU*ns6t9FBLZd9uJK+Sa6Kka)o`9wDM2BAv9LTjLcjtUQ< zoAhN6Xe%md_GBvFYvV-cYa7+g3S7Bq?}|r>3On*Rc@RKl-xPy1GS5vzy18i@UDp@% zFRBPPbH63*ANGR%%AT|DS)1KtpRqajmHVgri~FNH1Q{VtMI;O;+@ht*F=HDXbdn%053{cVQOREz`w9Dw9BD)&E3XnX$=wiF!^;#PCug z^Js=eaHS{ zui1U}JNuda&3GK&j(n29K6KepEC={#a)#wyb+fpD00iN2FL6ttA(4EC(G kKu4* + + + + + The page you were looking for doesn’t exist (404) + + + + +
+
+

404

+

The page you were looking for doesn’t exist.

+
+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..1f8ff3c --- /dev/null +++ b/public/500.html @@ -0,0 +1,82 @@ + + + + + + We’re sorry, but something went wrong (500) + + + + +
+
+

500

+

We’re sorry, but something went wrong.

+
+
+ +