33 lines
684 B
Crystal
33 lines
684 B
Crystal
|
|
# User instructions for:
|
|
# source-split, [pre-](configure|build|install) and post-install
|
|
# Simple array of strings with a name.
|
|
#
|
|
# Methods:
|
|
# - run(directory) : BuildStatus
|
|
# execute each instruction in a shell in a sub process
|
|
|
|
class Package::Instructions < Array(String)
|
|
getter phase : String
|
|
def initialize(@phase)
|
|
super()
|
|
end
|
|
|
|
def run(directory : String) : BuildStatus
|
|
if size == 0
|
|
Baguette::Log.error "Empty instructions for phase #{@phase}"
|
|
return BuildStatus::Pass
|
|
end
|
|
|
|
each do |command|
|
|
child = Do.run directory, "sh", ["-x", "-c", command]
|
|
|
|
if child.exit_status != 0
|
|
return BuildStatus::Failed
|
|
end
|
|
end
|
|
|
|
BuildStatus::Success
|
|
end
|
|
end
|