samhuri.net/lib/pressa/utils/file_writer.rb
Sami Samhuri 007b1058b6
Migrate from Swift to Ruby (#33)
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.
2026-02-07 21:19:03 -08:00

20 lines
476 B
Ruby

require "fileutils"
module Pressa
module Utils
class FileWriter
def self.write(path:, content:, permissions: 0o644)
FileUtils.mkdir_p(File.dirname(path))
File.write(path, content, mode: "w")
File.chmod(permissions, path)
end
def self.write_data(path:, data:, permissions: 0o644)
FileUtils.mkdir_p(File.dirname(path))
File.binwrite(path, data)
File.chmod(permissions, path)
end
end
end
end