Run rubocop on all files

This commit is contained in:
2023-06-08 21:57:54 +10:00
parent 6a2bc82e3b
commit 9d9d8ccf6d
65 changed files with 114 additions and 158 deletions

View File

@@ -9,25 +9,24 @@ namespace :blog do
Dotenv.load("/home/blog/current/.env.production") Dotenv.load("/home/blog/current/.env.production")
end end
task :load_from_letterboxd => ["blog:load_environment"] do task load_from_letterboxd: ["blog:load_environment"] do
require "hanami/prepare" require "hanami/prepare"
require "scraperd" require "scraperd"
client = Scraperd::Base.new client = Scraperd::Base.new
activities = client.fetch('dnitza') activities = client.fetch("dnitza")
create_command = Admin::Container["commands.movies.create"] create_command = Admin::Container["commands.movies.create"]
activities.each do |activity| activities.each do |activity|
title = CGI.unescapeHTML(activity.title) title = CGI.unescapeHTML(activity.title)
create_command.({ create_command.call({
title: title, title: title,
year: activity.year, year: activity.year,
url: activity.film_link, url: activity.film_link,
watched_at: activity.watched_at watched_at: activity.watched_at
}) })
end end
end end
end end

View File

@@ -10,10 +10,10 @@ require "dry/matcher/result_matcher"
module Adamantium module Adamantium
class Action < Hanami::Action class Action < Hanami::Action
include Deps["logger", include Deps["logger",
"settings", "settings",
not_found_view: "views.not_found", not_found_view: "views.not_found",
error_view: "views.error", error_view: "views.error",
sentry: "sentry.client"] sentry: "sentry.client"]
include Dry::Matcher.for(:handle, with: Dry::Matcher::ResultMatcher) include Dry::Matcher.for(:handle, with: Dry::Matcher::ResultMatcher)
include Dry::Monads[:result] include Dry::Monads[:result]

View File

@@ -4,7 +4,6 @@ module Adamantium
module Actions module Actions
module Trips module Trips
class Show < Adamantium::Action class Show < Adamantium::Action
include Deps["views.trips.show"] include Deps["views.trips.show"]
def handle(req, res) def handle(req, res)

View File

@@ -5,9 +5,9 @@ module Adamantium
include Deps["geo.gpx_parser", "commands.workouts.create"] include Deps["geo.gpx_parser", "commands.workouts.create"]
def handle(req, res) def handle(req, res)
tempfile = Tempfile.new(%w/path .gpx/) tempfile = Tempfile.new(%w[path .gpx])
if req.params.to_h.dig(:file, :tempfile) != nil if !req.params.to_h.dig(:file, :tempfile).nil?
tempfile.write req.params[:file][:tempfile].read tempfile.write req.params[:file][:tempfile].read
else else
tempfile.write req.params[:file] tempfile.write req.params[:file]
@@ -15,7 +15,6 @@ module Adamantium
tempfile.rewind tempfile.rewind
gpxfile = gpx_parser.call(path: tempfile.path) gpxfile = gpx_parser.call(path: tempfile.path)
if gpxfile.success? if gpxfile.success?

View File

@@ -7,10 +7,10 @@ module Adamantium
def call(auto_tag_id: nil) def call(auto_tag_id: nil)
auto_taggings = if auto_tag_id auto_taggings = if auto_tag_id
auto_tagging_repo.find(auto_tag_id) auto_tagging_repo.find(auto_tag_id)
else else
auto_tagging_repo.all auto_tagging_repo.all
end end
auto_taggings.each do |auto_tagging| auto_taggings.each do |auto_tagging|
posts = auto_tagging.title_only? ? posts = auto_tagging.title_only? ?
@@ -19,7 +19,7 @@ module Adamantium
posts.each do |post| posts.each do |post|
post_repo.auto_tag_post(post_id: post.id, post_repo.auto_tag_post(post_id: post.id,
tag_id: auto_tagging.tag_id) tag_id: auto_tagging.tag_id)
end end
end end

View File

@@ -1,4 +1,3 @@
require "securerandom" require "securerandom"
require "dry/monads" require "dry/monads"
require "filemagic" require "filemagic"

View File

@@ -6,7 +6,6 @@ module Adamantium
module Decorators module Decorators
module Movies module Movies
class Decorator < SimpleDelegator class Decorator < SimpleDelegator
include Deps["clients.omdb"] include Deps["clients.omdb"]
def poster def poster

View File

@@ -30,4 +30,4 @@ module Adamantium
end end
end end
end end
end end

View File

@@ -48,13 +48,12 @@ module Adamantium
end end
def auto_tag_post(post_id:, tag_id:) def auto_tag_post(post_id:, tag_id:)
return if posts return if posts
.post_tags .post_tags
.where( .where(
post_id: post_id, post_id: post_id,
tag_id: tag_id tag_id: tag_id
).count > 0 ).count > 0
posts posts
.post_tags .post_tags

View File

@@ -8,4 +8,4 @@ module Adamantium
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Adamantium
module Views module Views
module Movies module Movies
class Index < View class Index < View
include Deps["repos.movie_repo"] include Deps["repos.movie_repo"]
expose :movies do expose :movies do

View File

@@ -4,14 +4,14 @@ require "connection_pool"
require "que" require "que"
require "hanami/boot" require "hanami/boot"
uri = URI.parse(ENV['DATABASE_URL']) uri = URI.parse(ENV["DATABASE_URL"])
Que.connection = ConnectionPool.new(size: 10) do Que.connection = ConnectionPool.new(size: 10) do
PG::Connection.open( PG::Connection.open(
host: uri.host, host: uri.host,
user: uri.user, user: uri.user,
password: uri.password, password: uri.password,
port: uri.port || 5432, port: uri.port || 5432,
dbname: uri.path[1..-1] dbname: uri.path[1..]
) )
end end

View File

@@ -52,8 +52,10 @@ module Adamantium
mastodon_token = settings.mastodon_token mastodon_token = settings.mastodon_token
file = Tempfile.new(SecureRandom.uuid) file = Tempfile.new(SecureRandom.uuid)
# rubocop:disable Security/Open
file.write(URI.open(photo["value"]).read) file.write(URI.open(photo["value"]).read)
file.rewind file.rewind
# rubocop:enable Security/Open
file_size = file.size.to_f / 2**20 file_size = file.size.to_f / 2**20
formatted_file_size = "%.2f" % file_size formatted_file_size = "%.2f" % file_size

View File

@@ -12,4 +12,4 @@ module Adamantium
end end
end end
end end
end end

View File

@@ -18,4 +18,4 @@ module Adamantium
end end
end end
end end
end end

View File

@@ -3,7 +3,7 @@ module Adamantium
class BasicAuth < Rack::Auth::Basic class BasicAuth < Rack::Auth::Basic
def call(env) def call(env)
request = Rack::Request.new(env) request = Rack::Request.new(env)
if request.path.match(/^\/admin*/) if /^\/admin*/.match?(request.path)
# Execute basic authentication # Execute basic authentication
super(env) super(env)
else else

View File

@@ -2,12 +2,11 @@ module Admin
module Actions module Actions
module AutoTagging module AutoTagging
class Create < Action class Create < Action
include Deps["commands.auto_tagging.create", include Deps["commands.auto_tagging.create",
"views.auto_tagging.index", "views.auto_tagging.index",
"validation.contracts.auto_tagging_contract", "validation.contracts.auto_tagging_contract",
auto_tag: "commands.auto_tagging.tag", auto_tag: "commands.auto_tagging.tag",
new_view: "views.auto_tagging.new"] new_view: "views.auto_tagging.new"]
def handle(req, res) def handle(req, res)
title_contains = req.params[:title_contains] title_contains = req.params[:title_contains]
@@ -16,16 +15,16 @@ module Admin
tag_now = req.params[:tag_now] tag_now = req.params[:tag_now]
validation = auto_tagging_contract.call(title_contains: title_contains, validation = auto_tagging_contract.call(title_contains: title_contains,
body_contains: body_contains, body_contains: body_contains,
tag_id: tag_id) tag_id: tag_id)
if validation.success? if validation.success?
result = create.(title_contains: title_contains, result = create.call(title_contains: title_contains,
body_contains: body_contains, body_contains: body_contains,
tag_id: tag_id) tag_id: tag_id)
if result.success? && tag_now if result.success? && tag_now
auto_tag.(auto_tag_id: result.value!) auto_tag.call(auto_tag_id: result.value!)
end end
res.render index res.render index
@@ -36,4 +35,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module AutoTagging module AutoTagging
class Delete < Action class Delete < Action
include Deps["repos.auto_tagging_repo"] include Deps["repos.auto_tagging_repo"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module AutoTagging module AutoTagging
class Index < Action class Index < Action
include Deps["views.auto_tagging.index"] include Deps["views.auto_tagging.index"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module AutoTagging module AutoTagging
class New < Action class New < Action
include Deps[new_view: "views.auto_tagging.new"] include Deps[new_view: "views.auto_tagging.new"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Bookmarks module Bookmarks
class Archive < Action class Archive < Action
include Deps["repos.bookmark_repo"] include Deps["repos.bookmark_repo"]
def handle(req, res) def handle(req, res)
@@ -13,4 +12,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,19 +2,18 @@ module Admin
module Actions module Actions
module Bookmarks module Bookmarks
class Cache < Action class Cache < Action
include Deps["commands.bookmarks.cache"] include Deps["commands.bookmarks.cache"]
def handle(req, res) def handle(req, res)
bookmark_id = req.params[:id] bookmark_id = req.params[:id]
if cache.(bookmark_id: bookmark_id).success? res.body = if cache.call(bookmark_id: bookmark_id).success?
res.body = "Success" "Success"
else else
res.body = "Failed" "Failed"
end end
end end
end end
end end
end end
end end

View File

@@ -4,7 +4,6 @@ module Admin
module Actions module Actions
module Bookmarks module Bookmarks
class Clean < Action class Clean < Action
def handle(req, res) def handle(req, res)
Que.connection = Adamantium::Container["persistence.db"] Que.connection = Adamantium::Container["persistence.db"]
@@ -19,4 +18,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Bookmarks module Bookmarks
class Delete < Action class Delete < Action
include Deps["repos.bookmark_repo", "repos.post_tag_repo"] include Deps["repos.bookmark_repo", "repos.post_tag_repo"]
def handle(req, res) def handle(req, res)
@@ -14,4 +13,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Bookmarks module Bookmarks
class Index < Action class Index < Action
include Deps["views.bookmarks.index"] include Deps["views.bookmarks.index"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -1,12 +1,11 @@
module Admin module Admin
module Actions module Actions
class Index < Action class Index < Action
include Deps["views.index"] include Deps["views.index"]
def handle(req, res) def handle(req, res)
res.render index res.render index
end end
end
end end
end end
end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module MergeTags module MergeTags
class Index < Action class Index < Action
include Deps["views.merge_tags.index"] include Deps["views.merge_tags.index"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,14 +2,13 @@ module Admin
module Actions module Actions
module MergeTags module MergeTags
class Merge < Action class Merge < Action
include Deps["commands.merge_tags.merge"] include Deps["commands.merge_tags.merge"]
def handle(req, res) def handle(req, res)
target_id = req.params[:target_id] target_id = req.params[:target_id]
source_id = req.params[:source_id] source_id = req.params[:source_id]
result = merge.(target_id: target_id, source_id: source_id) result = merge.call(target_id: target_id, source_id: source_id)
if result.success? if result.success?
res.redirect_to "/admin/tags/merge" res.redirect_to "/admin/tags/merge"
@@ -21,4 +20,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module MergeTags module MergeTags
class New < Action class New < Action
include Deps[new_view: "views.merge_tags.new"] include Deps[new_view: "views.merge_tags.new"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Photos module Photos
class Index < Action class Index < Action
include Deps["views.photos.index"] include Deps["views.photos.index"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Posts module Posts
class Archive < Action class Archive < Action
include Deps["repos.post_repo"] include Deps["repos.post_repo"]
def handle(req, res) def handle(req, res)
@@ -13,4 +12,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Posts module Posts
class Delete < Action class Delete < Action
include Deps["repos.post_repo", "repos.post_tag_repo"] include Deps["repos.post_repo", "repos.post_tag_repo"]
def handle(req, res) def handle(req, res)
@@ -14,4 +13,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Posts module Posts
class Index < Action class Index < Action
include Deps["views.posts.index"] include Deps["views.posts.index"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Posts module Posts
class Publish < Action class Publish < Action
include Deps["repos.post_repo"] include Deps["repos.post_repo"]
def handle(req, res) def handle(req, res)
post_id = req.params[:id] post_id = req.params[:id]
@@ -12,4 +11,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Tags module Tags
class Delete < Action class Delete < Action
include Deps["repos.post_tag_repo", "repos.tag_repo"] include Deps["repos.post_tag_repo", "repos.tag_repo"]
def handle(req, res) def handle(req, res)
@@ -14,4 +13,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Actions module Actions
module Tags module Tags
class Index < Action class Index < Action
include Deps["views.tags.index"] include Deps["views.tags.index"]
def handle(req, res) def handle(req, res)
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -4,7 +4,6 @@ module Admin
module Actions module Actions
module Trips module Trips
class AddPost < Admin::Action class AddPost < Admin::Action
include Deps["commands.trips.add_post"] include Deps["commands.trips.add_post"]
def handle(req, res) def handle(req, res)

View File

@@ -4,7 +4,6 @@ module Admin
module Actions module Actions
module Trips module Trips
class Create < Admin::Action class Create < Admin::Action
include Deps["commands.trips.create"] include Deps["commands.trips.create"]
def handle(req, res) def handle(req, res)

View File

@@ -4,7 +4,6 @@ module Admin
module Actions module Actions
module Trips module Trips
class Show < Admin::Action class Show < Admin::Action
include Deps["views.trips.show"] include Deps["views.trips.show"]
def handle(req, res) def handle(req, res)

View File

@@ -4,7 +4,6 @@ module Admin
module Actions module Actions
module Trips module Trips
class Update < Admin::Action class Update < Admin::Action
include Deps["commands.trips.update"] include Deps["commands.trips.update"]
def handle(req, res) def handle(req, res)

View File

@@ -9,8 +9,8 @@ module Admin
Failure() if !title_contains.empty? && !body_contains.empty? Failure() if !title_contains.empty? && !body_contains.empty?
result = auto_tagging_repo.create(title_contains: title_contains, result = auto_tagging_repo.create(title_contains: title_contains,
body_contains: body_contains, body_contains: body_contains,
tag_id: tag_id) tag_id: tag_id)
Success(result.id) Success(result.id)
end end

View File

@@ -7,10 +7,10 @@ module Admin
def call(auto_tag_id: nil) def call(auto_tag_id: nil)
auto_taggings = if auto_tag_id auto_taggings = if auto_tag_id
auto_tagging_repo.find(auto_tag_id) auto_tagging_repo.find(auto_tag_id)
else else
auto_tagging_repo.all auto_tagging_repo.all
end end
auto_taggings.each do |auto_tagging| auto_taggings.each do |auto_tagging|
posts = auto_tagging.title_only? ? posts = auto_tagging.title_only? ?
@@ -19,7 +19,7 @@ module Admin
posts.each do |post| posts.each do |post|
post_repo.tag_post(post_id: post.id, post_repo.tag_post(post_id: post.id,
tag_id: auto_tagging.tag_id) tag_id: auto_tagging.tag_id)
end end
end end

View File

@@ -8,7 +8,7 @@ module Admin
include Dry::Monads[:result] include Dry::Monads[:result]
include Deps["repos.bookmark_repo"] include Deps["repos.bookmark_repo"]
def call(bookmark_id: ) def call(bookmark_id:)
bookmark = bookmark_repo.fetch(id: bookmark_id) bookmark = bookmark_repo.fetch(id: bookmark_id)
bookmark.url bookmark.url

View File

@@ -4,7 +4,6 @@ module Admin
module Commands module Commands
module Movies module Movies
class Create class Create
include Deps["repos.movie_repo"] include Deps["repos.movie_repo"]
def call(movie) def call(movie)
@@ -20,8 +19,7 @@ module Admin
repo.create(movie) repo.create(movie)
end end
end
end end
end end
end end
end end

View File

@@ -32,4 +32,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -16,4 +16,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -4,13 +4,12 @@ module Admin
module Repos module Repos
class PostRepo < Adamantium::Repo[:posts] class PostRepo < Adamantium::Repo[:posts]
def tag_post(post_id:, tag_id:) def tag_post(post_id:, tag_id:)
return if posts return if posts
.post_tags .post_tags
.where( .where(
post_id: post_id, post_id: post_id,
tag_id: tag_id tag_id: tag_id
).count > 0 ).count > 0
posts posts
.post_tags .post_tags
@@ -64,4 +63,4 @@ module Admin
end end
end end
end end
end end

View File

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

View File

@@ -6,6 +6,7 @@ module Admin
.order(Sequel.function(:lower, :label)) .order(Sequel.function(:lower, :label))
.to_a .to_a
end end
def list_with_posts def list_with_posts
tags tags
.combine(:posts) .combine(:posts)

View File

@@ -10,4 +10,4 @@ module Admin
attribute :label, Types::Coercible::String attribute :label, Types::Coercible::String
end end
end end
end end

View File

@@ -3,4 +3,4 @@ module Admin
config.layouts_dir = "layouts" config.layouts_dir = "layouts"
config.paths = "slices/admin/templates" config.paths = "slices/admin/templates"
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module AutoTagging module AutoTagging
class Index < Admin::View class Index < Admin::View
include Deps["repos.auto_tagging_repo"] include Deps["repos.auto_tagging_repo"]
expose :auto_taggings do expose :auto_taggings do
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module AutoTagging module AutoTagging
class New < Admin::View class New < Admin::View
include Deps["repos.tag_repo"] include Deps["repos.tag_repo"]
expose :tags do expose :tags do
@@ -15,4 +14,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -4,7 +4,6 @@ module Admin
module Views module Views
module Bookmarks module Bookmarks
class Index < Admin::View class Index < Admin::View
include Deps["repos.bookmark_repo"] include Deps["repos.bookmark_repo"]
expose :published_bookmarks do |bookmarks| expose :published_bookmarks do |bookmarks|
@@ -16,7 +15,7 @@ module Admin
end end
expose :bookmarks do expose :bookmarks do
bookmark_repo.list.partition{|p| p.published_at } bookmark_repo.list.partition { |p| p.published_at }
end end
expose :running_jobs do expose :running_jobs do
@@ -26,4 +25,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -1,7 +1,6 @@
module Admin module Admin
module Views module Views
class Index < Admin::View class Index < Admin::View
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module MergeTags module MergeTags
class Index < Admin::View class Index < Admin::View
include Deps["repos.tag_repo"] include Deps["repos.tag_repo"]
expose :tags do expose :tags do
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module MergeTags module MergeTags
class New < Admin::View class New < Admin::View
include Deps["repos.tag_repo"] include Deps["repos.tag_repo"]
expose :tag do |id:| expose :tag do |id:|
@@ -15,4 +14,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module Photos module Photos
class Index < Admin::View class Index < Admin::View
MEDIA_DIR = "public/media/".freeze MEDIA_DIR = "public/media/".freeze
expose :photos_buckets do expose :photos_buckets do
@@ -13,4 +12,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module Posts module Posts
class Index < Admin::View class Index < Admin::View
include Deps["repos.post_repo"] include Deps["repos.post_repo"]
expose :published_posts do |posts| expose :published_posts do |posts|
@@ -14,9 +13,9 @@ module Admin
end end
expose :posts do expose :posts do
post_repo.list.partition{|p| p.published_at } post_repo.list.partition { |p| p.published_at }
end end
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module Tags module Tags
class Index < Admin::View class Index < Admin::View
include Deps["repos.tag_repo"] include Deps["repos.tag_repo"]
expose :tags do expose :tags do
@@ -10,13 +9,13 @@ module Admin
end end
expose :unused_tags do |tags| expose :unused_tags do |tags|
tags.partition {|t| t.posts.count == 0}.first tags.partition { |t| t.posts.count == 0 }.first
end end
expose :used_tags do |tags| expose :used_tags do |tags|
tags.partition {|t| t.posts.count == 0}.last tags.partition { |t| t.posts.count == 0 }.last
end end
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module Trips module Trips
class Index < Admin::View class Index < Admin::View
include Deps["repos.trip_repo"] include Deps["repos.trip_repo"]
expose :trips do expose :trips do
@@ -11,4 +10,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -8,4 +8,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -2,7 +2,6 @@ module Admin
module Views module Views
module Trips module Trips
class Show < Admin::View class Show < Admin::View
include Deps["repos.trip_repo", "repos.post_repo"] include Deps["repos.trip_repo", "repos.post_repo"]
expose :trip do |id:| expose :trip do |id:|
@@ -15,4 +14,4 @@ module Admin
end end
end end
end end
end end

View File

@@ -1,15 +1,14 @@
# frozen_string_literal: true # frozen_string_literal: true
require "spec_helper" require "spec_helper"
RSpec.describe Adamantium::Geo::GpxParser do RSpec.describe Adamantium::Geo::GpxParser do
subject { described_class.new } subject { described_class.new }
let(:gpx_file) { File.join(SPEC_ROOT, "support", "fixtures", "geo.gpx") } let(:gpx_file) { File.join(SPEC_ROOT, "support", "fixtures", "geo.gpx") }
let(:expected_svg) { File.read(File.join(SPEC_ROOT, "support", "fixtures", "geo.svg")) } let(:expected_svg) { File.read(File.join(SPEC_ROOT, "support", "fixtures", "geo.svg")) }
it "parses a gpx file" do it "parses a gpx file" do
# puts gpx_file.inspect
result = subject.call(path: gpx_file).value! result = subject.call(path: gpx_file).value!
parsed_svg = Nokogiri::XML::Document.parse(result[:svg]) parsed_svg = Nokogiri::XML::Document.parse(result[:svg])
@@ -18,4 +17,4 @@ RSpec.describe Adamantium::Geo::GpxParser do
expect(result[:distance]).to eq 3.0724966849262554 expect(result[:distance]).to eq 3.0724966849262554
expect(result[:duration]).to eq 15237.0 expect(result[:duration]).to eq 15237.0
end end
end end

View File

@@ -24,4 +24,4 @@ Dir.glob(dist_path + "/*.{js,css}").each_with_object(filenames) do |f, memo|
File.rename(f, dist_path + "/" + filename + "-" + hash + File.extname(f)) File.rename(f, dist_path + "/" + filename + "-" + hash + File.extname(f))
end end
File.open(folder_path + "/asset-manifest.json", "wb") {|f| f.write(JSON.generate(filenames)) } File.binwrite(folder_path + "/asset-manifest.json", JSON.generate(filenames))