Initial commit

This commit is contained in:
tofu
2026-03-03 21:42:51 +05:00
commit b1c3b657c2
43 changed files with 833 additions and 0 deletions

8
config/app.rb Normal file
View File

@@ -0,0 +1,8 @@
# frozen_string_literal: true
require "hanami"
module ClashDeckGenerator2
class App < Hanami::App
end
end

17
config/assets.js Normal file
View File

@@ -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;
},
});

0
config/db/migrate/.keep Normal file
View File

15
config/db/seeds.rb Normal file
View File

@@ -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")

20
config/providers/db.rb Normal file
View File

@@ -0,0 +1,20 @@
warn "DB PROVIDER FILE LOADED"
ClashDeckGenerator2::App.register_provider :db do
warn "DB PROVIDER REGISTERED"
prepare do
warn "DB PROVIDER PREPARE"
require "hanami/db"
end
start do
warn "DB PROVIDER START"
config = target["settings"].database_url
db = Hanami::DB.new(config)
register "db", db
register "db.rom", db.rom
register "db.gateway", db.gateway
end
end

47
config/puma.rb Normal file
View File

@@ -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

7
config/routes.rb Normal file
View File

@@ -0,0 +1,7 @@
# frozen_string_literal: true
module ClashDeckGenerator2
class Routes < Hanami::Routes
# Add your routes here. See https://guides.hanamirb.org/routing/overview/ for details.
end
end

9
config/settings.rb Normal file
View File

@@ -0,0 +1,9 @@
# frozen_string_literal: true
module ClashDeckGenerator2
class Settings < Hanami::Settings
# Define your app settings here, for example:
#
# setting :my_flag, default: false, constructor: Types::Params::Bool
end
end