feat: 🔥 oh god

This commit is contained in:
David Bailey 2023-08-12 20:36:26 +02:00
parent cdb5492bfe
commit 3c7f48016d
30 changed files with 708 additions and 280 deletions

View file

@ -6,18 +6,23 @@ module Comfpile
alias path filename
alias file filename
def initialize(*args, file: filename, **opts)
def initialize(*args, file: nil, **opts)
super(*args, **opts)
@filename = file
@original_filename = file
unless File.exist? @filename
unless File.exist? @original_filename
fail! "File could not be loaded!"
return
end
# TODO add actual file reading/copying to build dir
@filename = @target
add_step do
FileUtils.mkpath File.dirname(@filename)
FileUtils.cp @original_filename, @filename
end
end
def mtime
@ -35,7 +40,7 @@ module Comfpile
def craft(stage, target, context)
return nil unless stage == :sourcefile
full_path = File.join(@root_path, target)
full_path = File.expand_path(File.join(@root_path, target))
return nil unless File.exists? full_path