Local files can be used in recipe sources.
file:// can be used as scheme to make it clearer, but URLs without scheme will be assumed to be local files anyway.
This commit is contained in:
parent
3700d5769d
commit
e4ea6bcd11
@ -57,6 +57,8 @@ class Package::Recipe
|
||||
getter sources = Sources.new
|
||||
getter packages = Array(Package).new
|
||||
|
||||
property recipe_directory = "."
|
||||
|
||||
@working_uuid : UUID = UUID.random
|
||||
|
||||
def initialize(@context, @name, @version)
|
||||
@ -78,6 +80,8 @@ class Package::Recipe
|
||||
name : String? = nil
|
||||
version : String? = nil
|
||||
|
||||
@recipe_directory = File.dirname filename
|
||||
|
||||
raise "Could not parse `#{filename}`" if specs.nil?
|
||||
|
||||
specs.assignments.each do |key, value|
|
||||
@ -209,7 +213,14 @@ class Package::Recipe
|
||||
raise ExtractionError.new self, url unless status.success?
|
||||
else
|
||||
puts ":: Copying '#{url.filename}'"
|
||||
FileUtils.cp "#{@context.sources_directory}/#{url.filename}",
|
||||
|
||||
directory = if url.scheme == "file"
|
||||
@recipe_directory
|
||||
else
|
||||
@context.sources_directory
|
||||
end
|
||||
|
||||
FileUtils.cp "#{directory}/#{url.filename}",
|
||||
url.filename
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user