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

@ -25,7 +25,9 @@ module Comfpile
end
@config_file_artefact = craft_artefact(:sourcefile, File.join(@target, "comf.yml"))
wait_on @config_file_artefact
return if @config_file_artefact.nil?
wait_on @config_file_artefact
add_step do
unless @config_file_artefact.nil?

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

View file

@ -117,7 +117,7 @@ module Comfpile
end
def sourcefile_dependency_step
['include', 'require', 'reference'].map do |key|
['include', 'require', 'reference'].each do |key|
key_artefacts = resolve_sourcefile(find_parsed_parameters(key), optional: key == 'include')
@parsed_dependencies[key] = key_artefacts.map { |key| craft_artefact(:parsed, key) }