From f3039744d72454e7e3b8cb1032266bcc172ce488 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 12 Sep 2021 14:17:19 +0200 Subject: Initial commit --- lib/util.rb | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 lib/util.rb (limited to 'lib/util.rb') diff --git a/lib/util.rb b/lib/util.rb new file mode 100644 index 0000000..48698ff --- /dev/null +++ b/lib/util.rb @@ -0,0 +1,85 @@ +SongsDir = 'songs' +SrcDir = 'src' +BuildDir = 'public' +TmpDir = 'tmp' +TemplatesDir = 'templates' + +def song filename + File.join SongsDir, filename +end + +def build filename + File.join BuildDir, filename +end + +def tmp filename + File.join TmpDir, filename +end + +def src filename + File.join SrcDir, filename +end + +def song_lyrics song_id + song "#{song_id}.txt" +end + +def song_ly song_id + song "#{song_id}.ly" +end + +def song_meta song_id + song "#{song_id}.yaml" +end + +def song_tex song_id + song "#{song_id}.tex" +end + +def song_sheet_pdf song_id + song "#{song_id}.cropped.pdf" +end + +def song_tmp_svg song_id + song "#{song_id}.cropped.svg" +end + +def song_pdf song_id + song "#{song_id}.pdf" +end + +def song_sheet_svg song_id + song "#{song_id}.svg" +end + +def song_svg song_id + song "#{song_id}.svg" +end + +def song_html song_id + song "#{song_id}.html" +end + +def template filename + ERB.new(File.read(filename), trim_mode: '-') +end + +def template_file filename + File.join TemplatesDir, filename +end + +def tex_template name + template(template_file "#{name}.tex.erb") +end + +def html_template name + template(template_file "#{name}.html.erb") +end + +def page_template + html_template 'template' +end + +def path_to asset_id + P.path_to asset_id +end -- cgit v1.2.3