2023-10-07 08:21:48 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mixin
|
2024-05-25 05:53:15 +02:00
|
|
|
require "test-cmd"
|
2023-10-07 08:21:48 +02:00
|
|
|
require_relative "mixin/t"
|
|
|
|
require_relative "mixin/inline"
|
|
|
|
require_relative "mixin/erb"
|
|
|
|
require_relative "mixin/opengraph"
|
|
|
|
|
2024-05-01 16:51:18 +02:00
|
|
|
def app_version
|
|
|
|
@app_version ||= begin
|
|
|
|
ver = File.read File.join(Dir.getwd, "VERSION")
|
2024-05-02 15:46:40 +02:00
|
|
|
ver.gsub(/[^\d.]/, "")
|
2024-05-01 16:51:18 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-05-25 05:53:15 +02:00
|
|
|
def revision
|
2024-05-25 06:01:31 +02:00
|
|
|
cmd("git rev-parse HEAD").stdout.strip
|
2024-05-25 05:53:15 +02:00
|
|
|
end
|
|
|
|
|
2023-10-07 08:21:48 +02:00
|
|
|
def build_dir
|
2024-05-02 13:34:35 +02:00
|
|
|
@build_dir ||= begin
|
|
|
|
nanoc = Ryo.from YAML.load_file(File.join(Dir.getwd, "nanoc.yaml"))
|
|
|
|
nanoc.output_dir
|
|
|
|
end
|
2023-10-07 08:21:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
include T
|
|
|
|
include Inline
|
|
|
|
include ERB
|
|
|
|
include OpenGraph
|
|
|
|
end
|
|
|
|
use_helper Mixin
|