From 6f663722ab38b56e52907a4f1fb09888d5e27de8 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Wed, 21 Feb 2024 21:48:44 +1100 Subject: [PATCH] StandardRB --- config/routes.rb | 1 - lib/adamantium/link_finder.rb | 2 +- lib/adamantium/view_cache/cacher.rb | 2 +- slices/main/action.rb | 1 - slices/main/config/routes.rb | 3 +-- slices/main/templates/blogroll/opml.xml.builder | 2 +- slices/main/views/blogroll/index.rb | 3 +-- slices/main/views/blogroll/list.rb | 4 ++-- slices/main/views/blogroll/opml.rb | 4 ++-- slices/main/views/bookmarks/index.rb | 8 +++++++- slices/main/views/bookmarks/metadata.rb | 2 +- slices/main/views/bookmarks/show.rb | 2 +- slices/main/views/books/index.rb | 2 +- slices/main/views/error.rb | 2 +- slices/main/views/feeds/rss.rb | 2 +- slices/main/views/feeds/statuses_rss.rb | 2 +- slices/main/views/more/index.rb | 2 +- slices/main/views/movies/index.rb | 2 +- slices/main/views/not_found.rb | 2 +- slices/main/views/pages/show.rb | 2 +- slices/main/views/photos/index.rb | 2 +- slices/main/views/places/index.rb | 2 +- slices/main/views/places/map_page.rb | 2 +- slices/main/views/podcasts/index.rb | 2 +- slices/main/views/posts/archive.rb | 2 +- slices/main/views/posts/index.rb | 2 +- slices/main/views/posts/show.rb | 2 +- slices/main/views/posts/top_tracks.rb | 2 +- slices/main/views/recently_played/index.rb | 2 +- slices/main/views/site/home.rb | 2 +- slices/main/views/statuses/index.rb | 2 +- slices/main/views/tags/index.rb | 2 +- slices/main/views/tags/show.rb | 2 +- slices/main/views/timemachine/show.rb | 2 +- slices/main/views/trips/index.rb | 2 +- slices/main/views/trips/show.rb | 2 +- slices/main/views/workouts/index.rb | 2 +- 37 files changed, 43 insertions(+), 41 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 566869e..759fa2b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,5 @@ module Adamantium slice :main, at: "/" slice :admin, at: "/admin" slice :micropub, at: "/micropub" - end end diff --git a/lib/adamantium/link_finder.rb b/lib/adamantium/link_finder.rb index e3d8ca0..3203375 100644 --- a/lib/adamantium/link_finder.rb +++ b/lib/adamantium/link_finder.rb @@ -9,7 +9,7 @@ module Adamantium youtube.com bsky.app bsky.social - github.com] + github.com].freeze def call(content) links = URI::DEFAULT_PARSER.extract(content) diff --git a/lib/adamantium/view_cache/cacher.rb b/lib/adamantium/view_cache/cacher.rb index 4a40639..563f59e 100644 --- a/lib/adamantium/view_cache/cacher.rb +++ b/lib/adamantium/view_cache/cacher.rb @@ -8,7 +8,7 @@ module Adamantium return cached_content if cached_content - rendered_content = content_proc.() + rendered_content = content_proc.call data = JSON.generate(expire: expiry.to_i, content: rendered_content) diff --git a/slices/main/action.rb b/slices/main/action.rb index 4555c38..6e7ba02 100644 --- a/slices/main/action.rb +++ b/slices/main/action.rb @@ -3,6 +3,5 @@ module Main class Action < Adamantium::Action - end end diff --git a/slices/main/config/routes.rb b/slices/main/config/routes.rb index ca26081..6103a0e 100644 --- a/slices/main/config/routes.rb +++ b/slices/main/config/routes.rb @@ -1,4 +1,3 @@ - module Main class Routes < Hanami::Routes root to: "site.home" @@ -52,4 +51,4 @@ module Main redirect "deploying-a-hanami-app-to-fly-io", to: "/post/deploying-a-hanami-20-app-to-flyio" redirect "deploying-a-hanami-app-to-fly-io/", to: "/post/deploying-a-hanami-20-app-to-flyio" end -end \ No newline at end of file +end diff --git a/slices/main/templates/blogroll/opml.xml.builder b/slices/main/templates/blogroll/opml.xml.builder index c6d0a9f..bad9f00 100644 --- a/slices/main/templates/blogroll/opml.xml.builder +++ b/slices/main/templates/blogroll/opml.xml.builder @@ -1,5 +1,5 @@ # xml.instruct! "xml-stylesheet", {href: "/assets/style.xslt", type: "text/xsl"} -xml.opml("xmlns:frss" => "https://freshrss.org/opml", version: "2.0") do +xml.opml("xmlns:frss" => "https://freshrss.org/opml", :version => "2.0") do xml.head do |head| head.title "Daniel Nitsikopoulos's RSS subscriptions" head.link "https://dnitza.com/blogroll/opml" diff --git a/slices/main/views/blogroll/index.rb b/slices/main/views/blogroll/index.rb index 95471fb..01415c5 100644 --- a/slices/main/views/blogroll/index.rb +++ b/slices/main/views/blogroll/index.rb @@ -1,8 +1,7 @@ module Main module Views module Blogroll - class Index< Main::View - + class Index < Main::View end end end diff --git a/slices/main/views/blogroll/list.rb b/slices/main/views/blogroll/list.rb index 4608b00..e6d6f92 100644 --- a/slices/main/views/blogroll/list.rb +++ b/slices/main/views/blogroll/list.rb @@ -1,7 +1,7 @@ module Main module Views module Blogroll - class List< Main::View + class List < Main::View config.layout = false include Deps[blogroll_list: "queries.blogroll.index"] @@ -13,7 +13,7 @@ module Main url: feed["url"], html_url: feed["htmlUrl"], icon: feed["iconUrl"], - categories: feed["categories"].map {|cat| cat["label"]} + categories: feed["categories"].map { |cat| cat["label"] } } end end diff --git a/slices/main/views/blogroll/opml.rb b/slices/main/views/blogroll/opml.rb index b26e0ba..7b6ca7f 100644 --- a/slices/main/views/blogroll/opml.rb +++ b/slices/main/views/blogroll/opml.rb @@ -1,7 +1,7 @@ module Main module Views module Blogroll - class Opml< Main::View + class Opml < Main::View include Deps[blogroll_list: "queries.blogroll.index"] expose :blogroll do |blogroll_result| @@ -11,7 +11,7 @@ module Main url: feed["url"], html_url: feed["htmlUrl"], icon: feed["iconUrl"], - categories: feed["categories"].map {|cat| cat["label"]} + categories: feed["categories"].map { |cat| cat["label"] } } end end diff --git a/slices/main/views/bookmarks/index.rb b/slices/main/views/bookmarks/index.rb index e683a58..f233f85 100644 --- a/slices/main/views/bookmarks/index.rb +++ b/slices/main/views/bookmarks/index.rb @@ -1,7 +1,7 @@ module Main module Views module Bookmarks - class Index< Main::View + class Index < Main::View include Deps["repos.post_repo"] expose :bookmarks do |query:| @@ -10,6 +10,12 @@ module Main end end + expose :bookmarks_by_tag do + post_repo.bookmark_listing(query: query).map do |bookmark| + Decorators::Bookmarks::Decorator.new bookmark + end + end + expose :q do |query:| query end diff --git a/slices/main/views/bookmarks/metadata.rb b/slices/main/views/bookmarks/metadata.rb index b51ceee..37a4cdf 100644 --- a/slices/main/views/bookmarks/metadata.rb +++ b/slices/main/views/bookmarks/metadata.rb @@ -3,7 +3,7 @@ require "ogpr" module Main module Views module Bookmarks - class Metadata< Main::View + class Metadata < Main::View include Deps["repos.post_repo"] config.layout = nil diff --git a/slices/main/views/bookmarks/show.rb b/slices/main/views/bookmarks/show.rb index 3d57bb1..399fd95 100644 --- a/slices/main/views/bookmarks/show.rb +++ b/slices/main/views/bookmarks/show.rb @@ -1,7 +1,7 @@ module Main module Views module Bookmarks - class Show< Main::View + class Show < Main::View include Deps["repos.post_repo"] expose :bookmark do |slug:| diff --git a/slices/main/views/books/index.rb b/slices/main/views/books/index.rb index ca6147a..d56382c 100644 --- a/slices/main/views/books/index.rb +++ b/slices/main/views/books/index.rb @@ -1,7 +1,7 @@ module Main module Views module Books - class Index< Main::View + class Index < Main::View include Deps["repos.post_repo"] private_expose :books do diff --git a/slices/main/views/error.rb b/slices/main/views/error.rb index ab6dd2d..f6ad6dc 100644 --- a/slices/main/views/error.rb +++ b/slices/main/views/error.rb @@ -1,6 +1,6 @@ module Main module Views - class Error< Main::View + class Error < Main::View end end end diff --git a/slices/main/views/feeds/rss.rb b/slices/main/views/feeds/rss.rb index a3ff965..12d9cf6 100644 --- a/slices/main/views/feeds/rss.rb +++ b/slices/main/views/feeds/rss.rb @@ -3,7 +3,7 @@ require "builder" module Main module Views module Feeds - class Rss< Main::View + class Rss < Main::View include Deps["repos.post_repo"] expose :posts do diff --git a/slices/main/views/feeds/statuses_rss.rb b/slices/main/views/feeds/statuses_rss.rb index d084fec..fa16066 100644 --- a/slices/main/views/feeds/statuses_rss.rb +++ b/slices/main/views/feeds/statuses_rss.rb @@ -3,7 +3,7 @@ require "builder" module Main module Views module Feeds - class StatusesRss< Main::View + class StatusesRss < Main::View include Deps["repos.post_repo"] expose :posts do diff --git a/slices/main/views/more/index.rb b/slices/main/views/more/index.rb index d5ec74b..c5cb004 100644 --- a/slices/main/views/more/index.rb +++ b/slices/main/views/more/index.rb @@ -1,7 +1,7 @@ module Main module Views module More - class Index< Main::View + class Index < Main::View end end end diff --git a/slices/main/views/movies/index.rb b/slices/main/views/movies/index.rb index b69b18d..77dc4cb 100644 --- a/slices/main/views/movies/index.rb +++ b/slices/main/views/movies/index.rb @@ -1,7 +1,7 @@ module Main module Views module Movies - class Index< Main::View + class Index < Main::View include Deps["repos.movie_repo"] expose :movies do diff --git a/slices/main/views/not_found.rb b/slices/main/views/not_found.rb index a03f846..70dbbb7 100644 --- a/slices/main/views/not_found.rb +++ b/slices/main/views/not_found.rb @@ -1,6 +1,6 @@ module Main module Views - class NotFound< Main::View + class NotFound < Main::View end end end diff --git a/slices/main/views/pages/show.rb b/slices/main/views/pages/show.rb index 8f21e5a..d01c7ce 100644 --- a/slices/main/views/pages/show.rb +++ b/slices/main/views/pages/show.rb @@ -1,7 +1,7 @@ module Main module Views module Pages - class Show< Main::View + class Show < Main::View include Deps["repos.page_repo", renderer: "renderers.markdown"] expose :page_content do |page| diff --git a/slices/main/views/photos/index.rb b/slices/main/views/photos/index.rb index f866aaf..51dd960 100644 --- a/slices/main/views/photos/index.rb +++ b/slices/main/views/photos/index.rb @@ -1,7 +1,7 @@ module Main module Views module Photos - class Index< Main::View + class Index < Main::View include Deps["repos.post_repo"] expose :photos do diff --git a/slices/main/views/places/index.rb b/slices/main/views/places/index.rb index 41b381f..9e8e0e7 100644 --- a/slices/main/views/places/index.rb +++ b/slices/main/views/places/index.rb @@ -1,7 +1,7 @@ module Main module Views module Places - class Index< Main::View + class Index < Main::View include Deps["repos.post_repo"] expose :places do diff --git a/slices/main/views/places/map_page.rb b/slices/main/views/places/map_page.rb index 26f8bf4..78dc396 100644 --- a/slices/main/views/places/map_page.rb +++ b/slices/main/views/places/map_page.rb @@ -1,7 +1,7 @@ module Main module Views module Places - class MapPage< Main::View + class MapPage < Main::View include Deps["repos.post_repo"] config.layout = "map" diff --git a/slices/main/views/podcasts/index.rb b/slices/main/views/podcasts/index.rb index c96dc55..a1af14c 100644 --- a/slices/main/views/podcasts/index.rb +++ b/slices/main/views/podcasts/index.rb @@ -1,7 +1,7 @@ module Main module Views module Podcasts - class Index< Main::View + class Index < Main::View include Deps["repos.podcast_repo", "repos.podcast_scrobble_repo"] expose :podcasts do diff --git a/slices/main/views/posts/archive.rb b/slices/main/views/posts/archive.rb index 2e2b4b0..f9118d4 100644 --- a/slices/main/views/posts/archive.rb +++ b/slices/main/views/posts/archive.rb @@ -1,7 +1,7 @@ module Main module Views module Posts - class Archive< Main::View + class Archive < Main::View include Deps["repos.post_repo"] expose :year do |year:| diff --git a/slices/main/views/posts/index.rb b/slices/main/views/posts/index.rb index d89ce82..531ab13 100644 --- a/slices/main/views/posts/index.rb +++ b/slices/main/views/posts/index.rb @@ -1,7 +1,7 @@ module Main module Views module Posts - class Index< Main::View + class Index < Main::View include Deps["repos.post_repo"] expose :posts do |post_query| diff --git a/slices/main/views/posts/show.rb b/slices/main/views/posts/show.rb index 942709f..f9122ce 100644 --- a/slices/main/views/posts/show.rb +++ b/slices/main/views/posts/show.rb @@ -3,7 +3,7 @@ require "time_math" module Main module Views module Posts - class Show< Main::View + class Show < Main::View include Deps["repos.post_repo", "repos.movie_repo"] expose :post do |slug:| diff --git a/slices/main/views/posts/top_tracks.rb b/slices/main/views/posts/top_tracks.rb index 167bb2d..5caa37a 100644 --- a/slices/main/views/posts/top_tracks.rb +++ b/slices/main/views/posts/top_tracks.rb @@ -1,7 +1,7 @@ module Main module Views module Posts - class TopTracks< Main::View + class TopTracks < Main::View config.layout = false expose :name do |track:| diff --git a/slices/main/views/recently_played/index.rb b/slices/main/views/recently_played/index.rb index c8172b2..c17abb0 100644 --- a/slices/main/views/recently_played/index.rb +++ b/slices/main/views/recently_played/index.rb @@ -1,7 +1,7 @@ module Main module Views module RecentlyPlayed - class Index< Main::View + class Index < Main::View config.layout = false include Deps["queries.posts.recently_played"] diff --git a/slices/main/views/site/home.rb b/slices/main/views/site/home.rb index 3c7b901..5a9c145 100644 --- a/slices/main/views/site/home.rb +++ b/slices/main/views/site/home.rb @@ -1,7 +1,7 @@ module Main module Views module Site - class Home< Main::View + class Home < Main::View include Deps["repos.post_repo", renderer: "renderers.markdown"] expose :home_content do diff --git a/slices/main/views/statuses/index.rb b/slices/main/views/statuses/index.rb index 99a1c6f..fc7d879 100644 --- a/slices/main/views/statuses/index.rb +++ b/slices/main/views/statuses/index.rb @@ -1,7 +1,7 @@ module Main module Views module Statuses - class Index< Main::View + class Index < Main::View include Deps["repos.post_repo"] expose :posts do diff --git a/slices/main/views/tags/index.rb b/slices/main/views/tags/index.rb index 60e2ec3..2e6c560 100644 --- a/slices/main/views/tags/index.rb +++ b/slices/main/views/tags/index.rb @@ -1,7 +1,7 @@ module Main module Views module Tags - class Index< Main::View + class Index < Main::View include Deps["repos.tag_repo"] expose :tag_groups do diff --git a/slices/main/views/tags/show.rb b/slices/main/views/tags/show.rb index 9a72a60..bdfe8cc 100644 --- a/slices/main/views/tags/show.rb +++ b/slices/main/views/tags/show.rb @@ -1,7 +1,7 @@ module Main module Views module Tags - class Show< Main::View + class Show < Main::View include Deps[ "repos.post_tag_repo", "repos.tag_repo" diff --git a/slices/main/views/timemachine/show.rb b/slices/main/views/timemachine/show.rb index 4873acb..86ec14f 100644 --- a/slices/main/views/timemachine/show.rb +++ b/slices/main/views/timemachine/show.rb @@ -3,7 +3,7 @@ require "time_math" module Main module Views module Timemachine - class Show< Main::View + class Show < Main::View include Deps[ "repos.post_repo", "repos.movie_repo", diff --git a/slices/main/views/trips/index.rb b/slices/main/views/trips/index.rb index 9429020..0e49b29 100644 --- a/slices/main/views/trips/index.rb +++ b/slices/main/views/trips/index.rb @@ -1,7 +1,7 @@ module Main module Views module Trips - class Index< Main::View + class Index < Main::View include Deps["repos.trip_repo"] expose :trip_years do diff --git a/slices/main/views/trips/show.rb b/slices/main/views/trips/show.rb index f8a9394..6e40717 100644 --- a/slices/main/views/trips/show.rb +++ b/slices/main/views/trips/show.rb @@ -1,7 +1,7 @@ module Main module Views module Trips - class Show< Main::View + class Show < Main::View include Deps[ "repos.trip_repo" ] diff --git a/slices/main/views/workouts/index.rb b/slices/main/views/workouts/index.rb index d61b1cc..306a8c9 100644 --- a/slices/main/views/workouts/index.rb +++ b/slices/main/views/workouts/index.rb @@ -1,7 +1,7 @@ module Main module Views module Workouts - class Index< Main::View + class Index < Main::View include Deps["repos.workout_repo"] expose :workouts_by_year do