Update Hanami

This commit is contained in:
2023-09-18 18:17:09 +10:00
parent 642ae3fbf6
commit 004c202923
14 changed files with 5361 additions and 81 deletions

12
Gemfile
View File

@@ -4,11 +4,11 @@ source "https://rubygems.org"
ruby "3.2.2" ruby "3.2.2"
gem "hanami", "~> 2.0.0" gem "hanami", github: "hanami/hanami", branch: "main"
gem "hanami-router", "~> 2.0.0" gem "hanami-router", github: "hanami/router", branch: "main"
gem "hanami-controller", "~> 2.0.0" gem "hanami-controller", github: "hanami/controller", branch: "main"
gem "hanami-validations", "~> 2.0.0" gem "hanami-validations", github: "hanami/validations", branch: "main"
# gem "hanami-assets", github: "hanami/view", branch: "main" gem "hanami-assets", github: "hanami/assets", branch: "main"
gem "hanami-view", github: "hanami/view", branch: "main" gem "hanami-view", github: "hanami/view", branch: "main"
gem "rom-sql" gem "rom-sql"
@@ -46,7 +46,7 @@ gem "lastfm", "~> 1.27"
gem "mail" gem "mail"
gem "que" gem "que"
gem "connection_pool" gem "connection_pool"
gem "omdb-api", require: false gem "omdb-api", "1.4.3", require: false
gem "image_processing", "~> 1.0" gem "image_processing", "~> 1.0"
gem "sentry-ruby" gem "sentry-ruby"

View File

@@ -22,6 +22,61 @@ GIT
specs: specs:
ruby-filemagic (0.7.3) ruby-filemagic (0.7.3)
GIT
remote: https://github.com/hanami/assets.git
revision: 72bcef964c7810047d6657f2c07104f363c56c09
branch: main
specs:
hanami-assets (2.1.0.alpha1)
GIT
remote: https://github.com/hanami/controller.git
revision: 2eb83900e298a03a7dadce9cbd1adef33dfec83e
branch: main
specs:
hanami-controller (2.1.0.beta1)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0)
hanami-utils (~> 2.0)
rack (~> 2.0)
zeitwerk (~> 2.6)
GIT
remote: https://github.com/hanami/hanami.git
revision: f57e241386a472c59915cbf26e7ea709dbfb366e
branch: main
specs:
hanami (2.1.0.beta1)
bundler (>= 1.16, < 3)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0, < 2)
dry-inflector (~> 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.beta)
hanami-utils (~> 2.1.beta)
zeitwerk (~> 2.6)
GIT
remote: https://github.com/hanami/router.git
revision: b502a68d66f637999ccc6291b97c7b72e97a5028
branch: main
specs:
hanami-router (2.1.0.beta1)
mustermann (~> 3.0)
mustermann-contrib (~> 3.0)
rack (~> 2.0)
GIT
remote: https://github.com/hanami/validations.git
revision: c675f43fa098938af950ed8d0e3ba90e5b0a1315
branch: main
specs:
hanami-validations (2.1.0.beta1)
dry-validation (>= 1.10, < 2)
zeitwerk (~> 2.6.0)
GIT GIT
remote: https://github.com/hanami/view.git remote: https://github.com/hanami/view.git
revision: 083f8325b86685e18be856ef62c70d599b6d9596 revision: 083f8325b86685e18be856ef62c70d599b6d9596
@@ -48,11 +103,12 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
activesupport (7.0.8) activesupport (6.0.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 0.7, < 2)
minitest (>= 5.1) minitest (~> 5.1)
tzinfo (~> 2.0) tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.5) addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0) public_suffix (>= 2.0.2, < 6.0)
airbrussh (1.4.2) airbrussh (1.4.2)
@@ -152,8 +208,8 @@ GEM
dry-initializer (~> 3.0) dry-initializer (~> 3.0)
dry-schema (>= 1.12, < 2) dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
faker (2.23.0) faker (2.2.1)
i18n (>= 1.8.11, < 2) i18n (>= 0.8)
ffi (1.15.5) ffi (1.15.5)
ffi-compiler (1.0.1) ffi-compiler (1.0.1)
ffi (>= 1.0.0) ffi (>= 1.0.0)
@@ -179,49 +235,25 @@ GEM
guard-compat (~> 1.2) guard-compat (~> 1.2)
puma (>= 4.0, < 7) puma (>= 4.0, < 7)
guess_html_encoding (0.0.11) guess_html_encoding (0.0.11)
hanami (2.0.3) hanami-cli (2.1.0.beta1)
bundler (>= 1.16, < 3)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0, < 2)
dry-inflector (~> 1.0, < 2)
dry-logger (~> 1.0, < 2)
dry-monitor (~> 1.0, >= 1.0.1, < 2)
dry-system (~> 1.0, < 2)
hanami-cli (~> 2.0)
hanami-utils (~> 2.0)
zeitwerk (~> 2.6)
hanami-cli (2.0.3)
bundler (~> 2.1) bundler (~> 2.1)
dry-cli (~> 1.0, < 2) dry-cli (~> 1.0, < 2)
dry-files (~> 1.0, >= 1.0.1, < 2) dry-files (~> 1.0, >= 1.0.1, < 2)
dry-inflector (~> 1.0, < 2) dry-inflector (~> 1.0, < 2)
rake (~> 13.0) rake (~> 13.0)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
hanami-controller (2.0.2)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0)
hanami-utils (~> 2.0)
rack (~> 2.0)
zeitwerk (~> 2.6)
hanami-reloader (2.0.2) hanami-reloader (2.0.2)
hanami-cli (~> 2.0) hanami-cli (~> 2.0)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
hanami-router (2.0.2)
mustermann (~> 3.0)
mustermann-contrib (~> 3.0)
rack (~> 2.0)
hanami-rspec (2.0.1) hanami-rspec (2.0.1)
hanami-cli (~> 2.0) hanami-cli (~> 2.0)
rake (~> 13.0) rake (~> 13.0)
rspec (~> 3.12) rspec (~> 3.12)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
hanami-utils (2.0.3) hanami-utils (2.1.0.beta1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2) dry-core (~> 1.0, < 2)
dry-transformer (~> 1.0, < 2) dry-transformer (~> 1.0, < 2)
hanami-validations (2.0.1)
dry-validation (>= 1.10, < 2)
zeitwerk (~> 2.6.0)
hansi (0.2.1) hansi (0.2.1)
hashie (2.1.2) hashie (2.1.2)
http (5.1.1) http (5.1.1)
@@ -236,7 +268,7 @@ GEM
httparty (0.21.0) httparty (0.21.0)
mini_mime (>= 1.0.0) mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
i18n (1.14.1) i18n (0.9.5)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
ice_nine (0.11.2) ice_nine (0.11.2)
image_processing (1.12.2) image_processing (1.12.2)
@@ -397,7 +429,7 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0) unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0) rubocop-ast (1.29.0)
parser (>= 3.2.1.0) parser (>= 3.2.1.0)
rubocop-performance (1.19.0) rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
@@ -438,13 +470,14 @@ GEM
standard standard
temple (0.10.2) temple (0.10.2)
thor (1.2.2) thor (1.2.2)
thread_safe (0.3.6)
tilt (2.3.0) tilt (2.3.0)
time_math2 (0.1.1) time_math2 (0.1.1)
timecop (0.9.8) timecop (0.9.8)
timeout (0.4.0) timeout (0.4.0)
transproc (1.1.1) transproc (1.1.1)
tzinfo (2.0.6) tzinfo (1.2.11)
concurrent-ruby (~> 1.0) thread_safe (~> 0.1)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.8.2) unf_ext (0.0.8.2)
@@ -482,12 +515,13 @@ DEPENDENCIES
gnuplot gnuplot
gpx gpx
guard-puma (~> 0.8) guard-puma (~> 0.8)
hanami (~> 2.0.0) hanami!
hanami-controller (~> 2.0.0) hanami-assets!
hanami-controller!
hanami-reloader hanami-reloader
hanami-router (~> 2.0.0) hanami-router!
hanami-rspec hanami-rspec
hanami-validations (~> 2.0.0) hanami-validations!
hanami-view! hanami-view!
httparty httparty
image_processing (~> 1.0) image_processing (~> 1.0)
@@ -495,7 +529,7 @@ DEPENDENCIES
mail mail
matrix matrix
ogpr ogpr
omdb-api omdb-api (= 1.4.3)
pg pg
pinboard! pinboard!
puma puma

View File

@@ -21,12 +21,12 @@ html
link rel="me" href=Hanami.app.settings.mastodon_url link rel="me" href=Hanami.app.settings.mastodon_url
link rel="me" href=Hanami.app.settings.github_url link rel="me" href=Hanami.app.settings.github_url
link rel="stylesheet" href=asset_from_manifest("index.css") link rel="stylesheet" href=assets["index.css"]
link rel="icon" type="image/x-icon" href="/assets/favicon.ico" link rel="icon" type="image/x-icon" href="/assets/favicon.ico"
script data-domain="dnitza.com" src="https://stats.dnitza.com/js/script.js" defer="true" script data-domain="dnitza.com" src="https://stats.dnitza.com/js/script.js" defer="true"
script src="/assets/gallery.js" script src="/assets/gallery.js"
script src=asset_from_manifest("index.js") script src=assets["index.js"]
script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous" script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"
script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer="true" script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer="true"
@@ -46,10 +46,10 @@ html
a href="/" rel="me" class="u-url u-uid" a href="/" rel="me" class="u-url u-uid"
h1 class="p-name uppercase text-sm md:text-sm text-gray-400 dark:text-gray-400" = Hanami.app.settings.site_name h1 class="p-name uppercase text-sm md:text-sm text-gray-400 dark:text-gray-400" = Hanami.app.settings.site_name
nav class="space-x-1 text-sm md:text-sm uppercase md:block" nav class="space-x-1 text-sm md:text-sm uppercase md:block"
a class="p-1 rounded hover:bg-red-100 hover:text-red-400 dark:hover:bg-red-200 #{link_active?('about') ? 'text-red-600 dark:text-red-400' : 'text-gray-400'}" href="/about" About a class="p-1 rounded hover:bg-pink-100 hover:text-pink-400 dark:text-pink-100 dark:hover:bg-pink-200 #{context.current_path.start_with?('/about') ? 'text-pink-600 bg-pink-50 dark:bg-pink-900 dark:text-pink-400' : 'text-gray-400'}" href="/about" About
span class="text-gray-400 dark:text-gray-600" span class="text-gray-400 dark:text-gray-600"
= "/" = "/"
a class="p-1 rounded hover:bg-blue-100 hover:text-blue-400 dark:hover:bg-blue-200 #{link_active?('posts') ? 'text-blue-400 dark:text-blue-400' : 'text-gray-400'}" href="/posts" Writing a class="p-1 rounded hover:bg-blue-100 hover:text-blue-400 dark:hover:bg-blue-200 #{context.current_path.start_with?('/post') ? 'text-blue-400 bg-blue-50 dark:bg-blue-900 dark:text-blue-400' : 'text-gray-400'}" href="/posts" Writing
span class="text-gray-400 dark:text-gray-600" span class="text-gray-400 dark:text-gray-600"
= "/" = "/"
a class="p-1 rounded text-gray-400 hover:bg-orange-100 hover:text-orange-400 dark:hover:bg-orange-200" href="#{Hanami.app.settings.micropub_site_url}/feeds/rss" RSS a class="p-1 rounded text-gray-400 hover:bg-orange-100 hover:text-orange-400 dark:hover:bg-orange-200" href="#{Hanami.app.settings.micropub_site_url}/feeds/rss" RSS

View File

@@ -21,14 +21,14 @@ html
link rel="me" href=Hanami.app.settings.mastodon_url link rel="me" href=Hanami.app.settings.mastodon_url
link rel="me" href=Hanami.app.settings.github_url link rel="me" href=Hanami.app.settings.github_url
link rel="stylesheet" href=asset_from_manifest("index.css") link rel="stylesheet" href=assets["index.css"]
link rel="icon" type="image/x-icon" href="/assets/favicon.ico" link rel="icon" type="image/x-icon" href="/assets/favicon.ico"
script src='https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.js' script src='https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.js'
link href='https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.css' rel='stylesheet' link href='https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.css' rel='stylesheet'
script data-domain="dnitza.com" src="https://stats.dnitza.com/js/script.js" defer="true" script data-domain="dnitza.com" src="https://stats.dnitza.com/js/script.js" defer="true"
script src=asset_from_manifest("index.js") script src=assets["index.js"]
body class="bg-white dark:bg-black selection:bg-blue-100 selection:text-blue-900 dark:selection:bg-blue-600 dark:selection:text-blue-100" body class="bg-white dark:bg-black selection:bg-blue-100 selection:text-blue-900 dark:selection:bg-blue-600 dark:selection:text-blue-100"
== yield == yield

View File

@@ -24,5 +24,7 @@ module Adamantium
"syndication.dayone", "syndication.dayone",
"renderers.markdown" "renderers.markdown"
] ]
config.assets.manifest_path = Hanami.env == :production ? "public/assets/asset-manifest.json" : nil
end end
end end

View File

@@ -6,23 +6,5 @@ module Adamantium
@options = options @options = options
super(**options) super(**options)
end end
def asset_from_manifest(filename)
return "/assets/#{filename}" if Hanami.env != :production
hashed_filename = asset_manifest[filename]
"/assets/dist/#{hashed_filename}"
end
def link_active? path
# TODO: waiting for Hanami View to be released
# to access current_path
false
end
private
def asset_manifest
@asset_manifest ||= JSON.parse(File.read("public/assets/asset-manifest.json"))
end
end end
end end

View File

@@ -1 +1 @@
{"gallery.js":"gallery-p46-IfnmuEW3.js","index.js":"index-p46-IfnmuEW3.js","index.css":"index-p46-IfnmuEW3.css"} {"gallery.js":{"url":"/assets/dist/gallery-vGVtDSqEMfJm.js"},"index.js":{"url":"/assets/dist/index-vGVtDSqEMfJm.js"},"index.css":{"url":"/assets/dist/index-vGVtDSqEMfJm.css"}}

File diff suppressed because one or more lines are too long

2613
public/assets/dist/index-vGVtDSqEMfJm.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -8,10 +8,10 @@ html
title Admin // Daniel Nitsikopoulos title Admin // Daniel Nitsikopoulos
link rel="stylesheet" href=asset_from_manifest("index.css") link rel="stylesheet" href=assets["index.css"]
link rel="icon" type="image/x-icon" href="/assets/favicon.ico" link rel="icon" type="image/x-icon" href="/assets/favicon.ico"
script src=asset_from_manifest("index.js") script src=assets["index.js"]
script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous" script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"
script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer="true" script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer="true"

View File

@@ -1,7 +1,5 @@
# get index.css, index.js # generates a Hanami::Assets compatible asset manifest
# generate hash # from the few asset files in this project
# rename files
# write asset manifest
require "securerandom" require "securerandom"
require "json" require "json"
@@ -20,7 +18,7 @@ end
Dir.glob(dist_path + "/*.{js,css}").each_with_object(filenames) do |f, memo| Dir.glob(dist_path + "/*.{js,css}").each_with_object(filenames) do |f, memo|
filename = File.basename(f, File.extname(f)) filename = File.basename(f, File.extname(f))
memo[filename + File.extname(f)] = filename + "-" + hash + File.extname(f) memo[filename + File.extname(f)] = {url: "/assets/dist/" + filename + "-" + hash + File.extname(f)}
File.rename(f, dist_path + "/" + filename + "-" + hash + File.extname(f)) File.rename(f, dist_path + "/" + filename + "-" + hash + File.extname(f))
end end