mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
Replace the Swift site generator with a Ruby and Phlex implementation. Loads site and projects from TOML, derive site metadata from posts. Migrate from make to bake and add standardrb and code coverage tasks. Update CI and docs to match the new workflow, and remove unused assets/dependencies plus obsolete tooling.
39 lines
1 KiB
Ruby
39 lines
1 KiB
Ruby
require "dry-struct"
|
|
|
|
module Pressa
|
|
module Types
|
|
include Dry.Types()
|
|
end
|
|
|
|
class Script < Dry::Struct
|
|
attribute :src, Types::String
|
|
attribute :defer, Types::Bool.default(true)
|
|
end
|
|
|
|
class Stylesheet < Dry::Struct
|
|
attribute :href, Types::String
|
|
end
|
|
|
|
class Site < Dry::Struct
|
|
attribute :author, Types::String
|
|
attribute :email, Types::String
|
|
attribute :title, Types::String
|
|
attribute :description, Types::String
|
|
attribute :url, Types::String
|
|
attribute :image_url, Types::String.optional.default(nil)
|
|
attribute :copyright_start_year, Types::Integer.optional.default(nil)
|
|
attribute :scripts, Types::Array.of(Script).default([].freeze)
|
|
attribute :styles, Types::Array.of(Stylesheet).default([].freeze)
|
|
attribute :plugins, Types::Array.default([].freeze)
|
|
attribute :renderers, Types::Array.default([].freeze)
|
|
|
|
def url_for(path)
|
|
"#{url}#{path}"
|
|
end
|
|
|
|
def image_url_for(path)
|
|
return nil unless image_url
|
|
"#{image_url}#{path}"
|
|
end
|
|
end
|
|
end
|