Merge pull request #6 from dNitza/use-hanami-22b1

Upgrade to Hanami 2.2.0.beta1
This commit is contained in:
Daniel Nitsikopoulos
2024-08-05 18:52:29 +10:00
committed by GitHub
65 changed files with 194 additions and 209 deletions

20
Gemfile
View File

@@ -4,12 +4,13 @@ source "https://rubygems.org"
ruby "3.3.0"
gem "hanami", "2.1.0"
gem "hanami-router", "2.1.0"
gem "hanami-controller", "2.1.0"
gem "hanami-validations", "2.1.0"
gem "hanami-assets", "2.1.0"
gem "hanami-view", "2.1.0"
gem "hanami", "~> 2.2.0.beta"
gem "hanami-router", "~> 2.2.0.beta"
gem "hanami-controller", "~> 2.2.0.beta"
gem "hanami-validations", "~> 2.2.0.beta"
gem "hanami-assets", "~> 2.2.0.beta"
gem "hanami-view", "~> 2.2.0.beta"
gem "hanami-db", "~> 2.2.0.beta"
# gem "hanami-view", file: "~/Documents/projects/hanami/view"
gem "csv"
@@ -20,7 +21,7 @@ gem "dotenv"
gem "whenever", require: false
gem "warning"
gem "dry-types"
gem "dry-types", "~> 1.0", ">= 1.6.1"
gem "dry-matcher"
gem "dry-monads"
gem "puma"
@@ -69,7 +70,7 @@ gem "steam-api"
group :cli, :development do
gem "irb"
gem "hanami-reloader", "~> 2.1.0.rc"
gem "hanami-reloader", "~> 2.2.0.beta"
gem "rubocop", require: false
end
@@ -80,7 +81,8 @@ end
group :development do
gem "ed25519"
gem "bcrypt_pbkdf"
gem "guard-puma", "~> 0.8"
gem "hanami-webconsole", "~> 2.2.0.beta"
gem "guard-puma"
gem "standardrb"
gem "capistrano", "~> 3.7", require: false
gem "capistrano-bundler"

View File

@@ -36,7 +36,7 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.3)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -46,8 +46,8 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.2)
sshkit (>= 1.6.1, != 1.7.0)
ast (2.4.2)
@@ -56,14 +56,20 @@ GEM
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-arm64-darwin)
bcrypt_pbkdf (1.1.1-x86_64-darwin)
better_errors (2.10.1)
erubi (>= 1.0.0)
rack (>= 0.9.0)
rouge (>= 1.0.0)
bigdecimal (3.1.8)
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
bskyrb (0.5.3)
date (>= 3.3.3)
httparty (>= 0.21.0)
json (>= 2.0)
xrpc (>= 0.0.4)
builder (3.2.4)
capistrano (3.18.1)
builder (3.3.0)
capistrano (3.19.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
@@ -75,10 +81,10 @@ GEM
sshkit (~> 1.3)
capistrano-systemd-multiservice (0.1.0.beta13)
capistrano (~> 3.7)
charlock_holmes (0.7.7)
charlock_holmes (0.7.9)
chronic (0.10.2)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
crass (1.0.6)
csv (3.3.0)
@@ -87,6 +93,7 @@ GEM
database_cleaner-core (~> 2.0.0)
sequel
date (3.3.4)
debug_inspector (1.2.0)
diff-lcs (1.5.1)
domain_name (0.6.20240107)
dotenv (3.1.2)
@@ -96,8 +103,8 @@ GEM
dry-auto_inject (1.0.1)
dry-core (~> 1.0)
zeitwerk (~> 2.6)
dry-cli (1.0.0)
dry-configurable (1.1.0)
dry-cli (1.1.0)
dry-configurable (1.2.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
@@ -107,7 +114,7 @@ GEM
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-files (1.1.0)
dry-inflector (1.0.0)
dry-inflector (1.1.0)
dry-initializer (3.1.1)
dry-logger (1.0.4)
dry-logic (1.5.0)
@@ -137,11 +144,11 @@ GEM
dry-types (>= 1.7, < 2)
ice_nine (~> 0.11)
zeitwerk (~> 2.6)
dry-system (1.0.1)
dry-auto_inject (~> 1.0, < 2)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0, < 2)
dry-inflector (~> 1.0, < 2)
dry-system (1.1.0.beta1)
dry-auto_inject (~> 1.0)
dry-configurable (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-transformer (1.0.1)
zeitwerk (~> 2.6)
dry-types (1.7.2)
@@ -158,7 +165,8 @@ GEM
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
ed25519 (1.3.0)
faker (3.3.1)
erubi (1.13.0)
faker (3.4.2)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
@@ -178,16 +186,18 @@ GEM
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.16.3)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
formatador (1.1.0)
georuby (2.5.2)
gnuplot (2.6.2)
gpx (1.1.1)
gpx (1.2.0)
nokogiri (~> 1.7)
rake
guard (2.18.1)
@@ -205,36 +215,40 @@ GEM
guard-compat (~> 1.2)
puma (>= 4.0, < 7)
guess_html_encoding (0.0.11)
hanami (2.1.0)
hanami (2.2.0.beta1)
bundler (>= 1.16, < 3)
dry-configurable (~> 1.0, < 2)
dry-configurable (~> 1.0, >= 1.2.0, < 2)
dry-core (~> 1.0, < 2)
dry-inflector (~> 1.0, < 2)
dry-inflector (~> 1.0, >= 1.1.0, < 2)
dry-logger (~> 1.0, < 2)
dry-monitor (~> 1.0, >= 1.0.1, < 2)
dry-system (~> 1.0, < 2)
hanami-cli (~> 2.1)
hanami-utils (~> 2.1)
dry-system (= 1.1.0.beta1)
hanami-cli (= 2.2.0.beta1)
hanami-utils (~> 2.2.beta)
zeitwerk (~> 2.6)
hanami-assets (2.1.0)
hanami-assets (2.2.0.beta1)
zeitwerk (~> 2.6)
hanami-cli (2.1.1)
hanami-cli (2.2.0.beta1)
bundler (~> 2.1)
dry-cli (~> 1.0, < 2)
dry-cli (~> 1.0, >= 1.1.0)
dry-files (~> 1.0, >= 1.0.2, < 2)
dry-inflector (~> 1.0, < 2)
rake (~> 13.0)
zeitwerk (~> 2.6)
hanami-controller (2.1.0)
hanami-controller (2.2.0.beta1)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0)
hanami-utils (~> 2.1)
hanami-utils (~> 2.2.beta)
rack (~> 2.0)
zeitwerk (~> 2.6)
hanami-reloader (2.1.0)
hanami-cli (~> 2.1)
hanami-db (2.2.0.beta1)
rom (~> 5.3)
rom-sql (~> 3.6, >= 3.6.4)
zeitwerk (~> 2.6)
hanami-router (2.1.0)
hanami-reloader (2.2.0.beta1)
hanami-cli (~> 2.2.beta)
zeitwerk (~> 2.6)
hanami-router (2.2.0.beta1)
mustermann (~> 3.0)
mustermann-contrib (~> 3.0)
rack (~> 2.0)
@@ -243,24 +257,27 @@ GEM
rake (~> 13.0)
rspec (~> 3.12)
zeitwerk (~> 2.6)
hanami-utils (2.1.0)
hanami-utils (2.2.0.beta1)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-transformer (~> 1.0, < 2)
hanami-validations (2.1.0)
hanami-validations (2.2.0.beta1)
dry-validation (>= 1.10, < 2)
zeitwerk (~> 2.6.0)
hanami-view (2.1.0)
hanami-view (2.2.0.beta1)
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.2.0.beta1)
better_errors (~> 2.10, >= 2.10.1)
binding_of_caller (~> 1.0)
hansi (0.2.1)
hashie (2.1.2)
http-accept (1.7.0)
http-cookie (1.0.5)
http-cookie (1.0.6)
domain_name (~> 0.5)
httparty (0.22.0)
csv
@@ -269,15 +286,15 @@ GEM
i18n (1.14.5)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
image_processing (1.12.2)
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.7.2)
irb (1.13.1)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
jwt (2.8.1)
jwt (2.8.2)
base64
language_server-protocol (3.17.0.3)
lastfm (1.27.4)
@@ -287,6 +304,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
lumberjack (1.2.10)
mail (2.8.1)
mini_mime (>= 0.1.1)
@@ -297,21 +315,21 @@ GEM
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0507)
mini_magick (4.12.0)
mime-types-data (3.2024.0702)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.23.1)
minitest (5.24.1)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
multipart-post (2.4.1)
mustermann (3.0.0)
mustermann (3.0.1)
ruby2_keywords (~> 0.0.1)
mustermann-contrib (3.0.0)
mustermann-contrib (3.0.1)
hansi (~> 0.2.0)
mustermann (= 3.0.0)
mustermann (= 3.0.1)
mutex_m (0.2.0)
nenv (0.3.0)
net-imap (0.4.11)
net-imap (0.4.14)
date
net-protocol
net-pop (0.1.2)
@@ -327,11 +345,11 @@ GEM
net-ssh (7.2.3)
netrc (0.11.0)
nio4r (2.7.3)
nokogiri (1.16.5-arm64-darwin)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-darwin)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
@@ -349,21 +367,21 @@ GEM
omdb-api (1.4.3)
activesupport
httparty
parallel (1.24.0)
parser (3.3.1.0)
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
pg (1.5.6)
pg (1.5.7)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.2)
stringio
public_suffix (5.0.5)
public_suffix (6.0.1)
puma (6.4.2)
nio4r (~> 2.0)
que (2.3.0)
racc (1.8.0)
racc (1.8.1)
rack (2.2.9)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
@@ -387,7 +405,7 @@ GEM
redis-client (0.22.2)
connection_pool
regexp_parser (2.9.2)
reline (0.5.7)
reline (0.5.9)
io-console (~> 0.5)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
@@ -396,7 +414,7 @@ GEM
netrc (~> 0.8)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.2)
rexml (3.3.4)
strscan
rom (5.3.2)
rom-changeset (~> 5.3, >= 5.3.0)
@@ -425,25 +443,26 @@ GEM
dry-core (~> 1.0)
dry-initializer (~> 3.0, >= 3.0.1)
rom-core (~> 5.3, >= 5.3.0)
rom-sql (3.6.3)
rom-sql (3.6.4)
dry-core (~> 1.0)
dry-types (~> 1.0)
rom (~> 5.2, >= 5.2.1)
sequel (>= 4.49)
rouge (4.3.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.63.5)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
@@ -456,20 +475,21 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-performance (1.21.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
ruby-readability (0.7.0)
ruby-readability (0.7.1)
guess_html_encoding (>= 0.0.4)
nokogiri (>= 1.6.0)
ruby-vips (2.2.1)
ruby-vips (2.2.2)
ffi (~> 1.12)
logger
ruby2_keywords (0.0.5)
sanitize (6.1.0)
sanitize (6.1.2)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sequel (5.80.0)
sequel (5.83.0)
bigdecimal
shellany (0.0.1)
simple-rss (1.3.3)
@@ -479,16 +499,15 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
sshkit (1.22.2)
sshkit (1.23.0)
base64
mutex_m
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
standard (1.36.0)
standard (1.39.2)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.63.0)
rubocop (~> 1.64.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-custom (1.0.2)
@@ -501,13 +520,13 @@ GEM
standard
steam-api (1.2.0)
faraday (~> 1.0)
stringio (3.1.0)
stringio (3.1.1)
strscan (3.1.0)
temple (0.10.3)
thor (1.3.1)
tilt (2.3.0)
tilt (2.4.0)
time_math2 (0.1.1)
timecop (0.9.8)
timecop (0.9.10)
timeout (0.4.1)
transproc (1.1.1)
tzinfo (2.0.6)
@@ -516,7 +535,7 @@ GEM
unicode-emoji (3.4.0)
unicode-version (~> 1.0)
unicode-version (1.4.0)
vernier (1.0.1)
vernier (1.1.1)
version_gem (1.1.4)
warning (1.4.0)
whenever (1.0.0)
@@ -527,7 +546,7 @@ GEM
date
httparty
json (>= 2.0)
zeitwerk (2.6.15)
zeitwerk (2.6.17)
PLATFORMS
arm64-darwin-23
@@ -553,20 +572,22 @@ DEPENDENCIES
down
dry-matcher
dry-monads
dry-types
dry-types (~> 1.0, >= 1.6.1)
ed25519
georuby
gnuplot
gpx
guard-puma (~> 0.8)
hanami (= 2.1.0)
hanami-assets (= 2.1.0)
hanami-controller (= 2.1.0)
hanami-reloader (~> 2.1.0.rc)
hanami-router (= 2.1.0)
guard-puma
hanami (~> 2.2.0.beta)
hanami-assets (~> 2.2.0.beta)
hanami-controller (~> 2.2.0.beta)
hanami-db (~> 2.2.0.beta)
hanami-reloader (~> 2.2.0.beta)
hanami-router (~> 2.2.0.beta)
hanami-rspec (~> 2.1.0.rc)
hanami-validations (= 2.1.0)
hanami-view (= 2.1.0)
hanami-validations (~> 2.2.0.beta)
hanami-view (~> 2.2.0.beta)
hanami-webconsole (~> 2.2.0.beta)
httparty
image_processing (~> 1.0)
irb

View File

@@ -85,7 +85,7 @@ namespace :blog do
require "hanami/prepare"
require "que"
Que.connection = Adamantium::Container["persistence.db"]
Que.connection = Adamantium::Container["db.gateway"].connection
Adamantium::Jobs::ArchiveDeletedWebmentions.enqueue
end

10
app/db/relation.rb Normal file
View File

@@ -0,0 +1,10 @@
# frozen_string_literal: true
require "hanami/db/relation"
module Adamantium
module DB
class Relation < Hanami::DB::Relation
end
end
end

10
app/db/repo.rb Normal file
View File

@@ -0,0 +1,10 @@
# frozen_string_literal: true
require "hanami/db/repo"
module Adamantium
module DB
class Repo < Hanami::DB::Repo
end
end
end

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class AutoTaggings < ROM::Relation[:sql]
class AutoTaggings < Adamantium::DB::Relation
schema :auto_taggings, infer: true do
associations do
belongs_to :tag

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Highlights < ROM::Relation[:sql]
class Highlights < Adamantium::DB::Relation
schema :highlights, infer: true do
associations do
belongs_to :post

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class LoginTokens < ROM::Relation[:sql]
class LoginTokens < Adamantium::DB::Relation
schema :login_tokens, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Movies < ROM::Relation[:sql]
class Movies < Adamantium::DB::Relation
schema :movies, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Pages < ROM::Relation[:sql]
class Pages < Adamantium::DB::Relation
schema :pages, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class PodcastScrobbles < ROM::Relation[:sql]
class PodcastScrobbles < Adamantium::DB::Relation
schema :podcast_scrobbles, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Podcasts < ROM::Relation[:sql]
class Podcasts < Adamantium::DB::Relation
schema :podcasts, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class PostTags < ROM::Relation[:sql]
class PostTags < Adamantium::DB::Relation
schema :post_tags, infer: true do
associations do
belongs_to :post

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class PostTrips < ROM::Relation[:sql]
class PostTrips < Adamantium::DB::Relation
schema :post_trips, infer: true do
associations do
belongs_to :post

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Posts < ROM::Relation[:sql]
class Posts < Adamantium::DB::Relation
schema :posts, infer: true do
associations do
has_many :post_tags

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Reactions < ROM::Relation[:sql]
class Reactions < Adamantium::DB::Relation
schema :reactions, infer: true do
associations do
belongs_to :post

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Tags < ROM::Relation[:sql]
class Tags < Adamantium::DB::Relation
schema :tags, infer: true do
associations do
has_many :post_tags

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class TopTracks < ROM::Relation[:sql]
class TopTracks < Adamantium::DB::Relation
schema :top_tracks, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Trips < ROM::Relation[:sql]
class Trips < Adamantium::DB::Relation
schema :trips, infer: true do
associations do
has_many :post_trips

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Users < ROM::Relation[:sql]
class Users < Adamantium::DB::Relation
schema :users, infer: true
auto_struct(true)

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Webmentions < ROM::Relation[:sql]
class Webmentions < Adamantium::DB::Relation
schema :webmentions, infer: true do
associations do
belongs_to :post

View File

@@ -2,7 +2,7 @@
module Adamantium
module Relations
class Workouts < ROM::Relation[:sql]
class Workouts < Adamantium::DB::Relation
schema :workouts, infer: true
auto_struct(true)

View File

@@ -1,6 +1,6 @@
module Adamantium
module Repos
class PageRepo < Adamantium::Repo[:pages]
class PageRepo < Adamantium::DB::Repo[:pages]
def fetch!(slug:)
pages
.published

View File

@@ -1,6 +1,6 @@
module Adamantium
module Repos
class PodcastScrobbleRepo < Adamantium::Repo[:podcast_scrobbles]
class PodcastScrobbleRepo < Adamantium::DB::Repo[:podcast_scrobbles]
commands :create
def exists?(id:)

View File

@@ -2,7 +2,7 @@ require "time_math"
module Adamantium
module Repos
class PostRepo < Adamantium::Repo[:posts]
class PostRepo < Adamantium::DB::Repo[:posts]
def recent(limit:)
date = Time.now

View File

@@ -29,6 +29,7 @@ module Adamantium
"clients.blue_sky",
"clients.mastodon",
"clients.steam",
"db.rom",
"geo.gpx_parser",
"param_parser.micropub_post",
"param_parser.webmention",

View File

@@ -1,45 +0,0 @@
# frozen_string_literal: true
Hanami.app.register_provider :persistence, namespace: true do
prepare do
require "rom-changeset"
require "rom/core"
require "rom/sql"
# TODO(Hanami): As part of built-in rom setup, configure ROM with app inflector
silence_warnings { ROM::Inflector = Hanami.app["inflector"] }
rom_config = ROM::Configuration.new(:sql, target["settings"].database_url)
rom_config.plugin(:sql, relations: :instrumentation) do |plugin_config|
plugin_config.notifications = target["notifications"]
end
rom_config.plugin(:sql, relations: :auto_restrictions)
register "config", rom_config
register "db", rom_config.gateways[:default].connection
end
start do
rom_config = target["persistence.config"]
rom_config.auto_registration(
target.root.join("app"),
namespace: Hanami.app.namespace.to_s
)
register "rom", ROM.container(rom_config)
end
stop do
target["persistence.rom"].disconnect
end
define_method(:silence_warnings) do |&block|
orig_verbose = $VERBOSE
$VERBOSE = nil
result = block.call
$VERBOSE = orig_verbose
result
end
end

View File

@@ -1,10 +0,0 @@
# auto_register: false
# frozen_string_literal: true
require "rom-repository"
module Adamantium
class Repo < ROM::Repository::Root
include Deps[container: "persistence.rom"]
end
end

View File

@@ -5,7 +5,7 @@ module Admin
module Bookmarks
class Clean < Action
def handle(req, res)
Que.connection = Adamantium::Container["persistence.db"]
Que.connection = Adamantium::Container["db.gateway"].connection
res.status = 200
if Que.job_stats.any? { |job| job[:job_class] == Adamantium::Jobs::ArchiveDeadBookmarks.name }

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class AutoTaggingRepo < Adamantium::Repo[:auto_taggings]
class AutoTaggingRepo < Adamantium::DB::Repo[:auto_taggings]
commands :create
def find(id)

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class BookRepo < Adamantium::Repo[:posts]
class BookRepo < Adamantium::DB::Repo[:posts]
commands :create, update: :by_pk
def list_all

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class BookmarkRepo < Adamantium::Repo[:posts]
class BookmarkRepo < Adamantium::DB::Repo[:posts]
def list
posts
.where(post_type: "bookmark")

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class HighlightRepo < Adamantium::Repo[:highlights]
class HighlightRepo < Adamantium::DB::Repo[:highlights]
commands :create, delete: :by_pk
def list_all

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class LoginTokensRepo < Adamantium::Repo[:login_tokens]
class LoginTokensRepo < Adamantium::DB::Repo[:login_tokens]
commands :create
def by_token(token:)

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class MovieRepo < Adamantium::Repo[:movies]
class MovieRepo < Adamantium::DB::Repo[:movies]
commands :create
def by_title_and_year(title:, year:)

View File

@@ -2,7 +2,7 @@ require "time_math"
module Admin
module Repos
class PageRepo < Adamantium::Repo[:pages]
class PageRepo < Adamantium::DB::Repo[:pages]
commands :create, update: :by_pk
def list

View File

@@ -2,7 +2,7 @@ require "time_math"
module Admin
module Repos
class PostRepo < Adamantium::Repo[:posts]
class PostRepo < Adamantium::DB::Repo[:posts]
commands update: :by_pk
def tag_post(post_id:, tags:)

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class PostTagRepo < Adamantium::Repo[:post_tags]
class PostTagRepo < Adamantium::DB::Repo[:post_tags]
def merge_tags(target_id:, source_id:)
post_tags.where(tag_id: source_id).update(tag_id: target_id)
end

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class PostTripRepo < Adamantium::Repo[:post_trips]
class PostTripRepo < Adamantium::DB::Repo[:post_trips]
commands :create
def remove(trip_id:, post_id:)

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class TagRepo < Adamantium::Repo[:tags]
class TagRepo < Adamantium::DB::Repo[:tags]
def list
tags
.order(Sequel.function(:lower, :label))

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class TripRepo < Adamantium::Repo[:trips]
class TripRepo < Adamantium::DB::Repo[:trips]
commands :create
def list

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class UserRepo < Adamantium::Repo[:users]
class UserRepo < Adamantium::DB::Repo[:users]
commands :create
def exists(id)

View File

@@ -1,6 +1,6 @@
module Admin
module Repos
class WebmentionRepo < Adamantium::Repo[:webmentions]
class WebmentionRepo < Adamantium::DB::Repo[:webmentions]
commands update: :by_pk
def list_all_for_check

View File

@@ -19,7 +19,7 @@ module Admin
end
expose :running_jobs do
Que.connection = Adamantium::Container["persistence.db"]
Que.connection = Adamantium::Container["db.gateway"].connection
Que.job_stats.any? { |job| job[:job_class] == Adamantium::Jobs::ArchiveDeadBookmarks.name }
end
end

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class MovieRepo < Adamantium::Repo[:movies]
class MovieRepo < Adamantium::DB::Repo[:movies]
def listing
movies.order(Sequel.lit("year desc")).to_a
end

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class PageRepo < Adamantium::Repo[:pages]
class PageRepo < Adamantium::DB::Repo[:pages]
def fetch!(slug:)
pages
.published

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class PodcastRepo < Adamantium::Repo[:podcasts]
class PodcastRepo < Adamantium::DB::Repo[:podcasts]
def listing
podcasts.order(:name).to_a
end

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class PodcastScrobbleRepo < Adamantium::Repo[:podcast_scrobbles]
class PodcastScrobbleRepo < Adamantium::DB::Repo[:podcast_scrobbles]
def exists?(id:)
!!podcast_scrobbles
.where(overcast_id: id)

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class PostRepo < Adamantium::Repo[:posts]
class PostRepo < Adamantium::DB::Repo[:posts]
Sequel.extension :pg_json
Sequel.extension :pg_json_ops

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class PostTagRepo < Adamantium::Repo[:post_tags]
class PostTagRepo < Adamantium::DB::Repo[:post_tags]
def posts_tagged(tag:)
tag_id = post_tags
.tags

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class ReactionRepo < Adamantium::Repo[:reactions]
class ReactionRepo < Adamantium::DB::Repo[:reactions]
commands :create
def count(post_id:)

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class TagRepo < Adamantium::Repo[:tags]
class TagRepo < Adamantium::DB::Repo[:tags]
def fetch!(slug)
tags.where(slug: slug).one!
end

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class TopTrackRepo < Adamantium::Repo[:top_tracks]
class TopTrackRepo < Adamantium::DB::Repo[:top_tracks]
def for_post(id:)
top_tracks
.where(post_id: id)

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class TripRepo < Adamantium::Repo[:trips]
class TripRepo < Adamantium::DB::Repo[:trips]
def fetch!(id)
trips
.where(id: id)

View File

@@ -1,6 +1,6 @@
module Main
module Repos
class WorkoutRepo < Adamantium::Repo[:workouts]
class WorkoutRepo < Adamantium::DB::Repo[:workouts]
def list
workouts.order(:published_at).to_a
end

View File

@@ -8,7 +8,7 @@ module Micropub
include Deps["settings", "post_utilities.link_finder"]
def call(post_content:, post_url:, in_reply_to:)
Que.connection = Adamantium::Container["persistence.db"]
Que.connection = Adamantium::Container["db.gateway"].connection
Adamantium::Jobs::SendWebMentions.enqueue(post_content: post_content, post_url: post_url, in_reply_to: in_reply_to)
end

View File

@@ -1,6 +1,6 @@
module Micropub
module Repos
class AutoTaggingRepo < Adamantium::Repo[:auto_taggings]
class AutoTaggingRepo < Adamantium::DB::Repo[:auto_taggings]
def find(id)
auto_taggings
.where(id: id)

View File

@@ -1,6 +1,6 @@
module Micropub
module Repos
class MovieRepo < Adamantium::Repo[:movies]
class MovieRepo < Adamantium::DB::Repo[:movies]
commands :create
end
end

View File

@@ -1,6 +1,6 @@
module Micropub
module Repos
class PodcastRepo < Adamantium::Repo[:podcasts]
class PodcastRepo < Adamantium::DB::Repo[:podcasts]
commands :create
def listing

View File

@@ -1,6 +1,6 @@
module Micropub
module Repos
class PostRepo < Adamantium::Repo[:posts]
class PostRepo < Adamantium::DB::Repo[:posts]
commands update: :by_pk
def remove_tag(post_id:, tag:)

View File

@@ -1,6 +1,6 @@
module Micropub
module Repos
class WebmentionsRepo < Adamantium::Repo[:webmentions]
class WebmentionsRepo < Adamantium::DB::Repo[:webmentions]
commands :create
end
end

View File

@@ -1,6 +1,6 @@
module Micropub
module Repos
class WorkoutRepo < Adamantium::Repo[:workouts]
class WorkoutRepo < Adamantium::DB::Repo[:workouts]
commands :create, update: :by_pk
end
end

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "Webmention creation", :db, :requests do
let(:post_repo) { Adamantium::Repos::PostRepo.new }
let(:post_repo) { Adamantium::DB::Repos::PostRepo.new }
let(:post_record) { Test::Factory[:post] }
context "reply" do

View File

@@ -6,10 +6,6 @@ require_relative "db/database_cleaner"
require_relative "db/factory"
RSpec.configure do |config|
config.before :suite do
Hanami.app.start :persistence
end
config.include Test::DB::Helpers, :db
config.include(Test::DB::FactoryHelper.new, factory: nil)

View File

@@ -8,11 +8,11 @@ module Test
end
def rom
Hanami.app["persistence.rom"]
Hanami.app["db.rom"]
end
def db
Hanami.app["persistence.db"]
Hanami.app["db.gateway"].connection
end
end
end