forked from larsch/ocra
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor logging to use BuilderOpsLogger module
- Moved the logging implementation from the Builder class to the BuilderOpsLogger module. - Modified the Builder class to prepend the BuilderOpsLogger module when build logging is needed, enhancing modularity and separation of concerns.
- Loading branch information
Showing
4 changed files
with
39 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
module Ocran | ||
module BuilderOpsLogger | ||
def mkdir(target) | ||
puts "mkdir #{target}" | ||
super | ||
end | ||
|
||
def cp(source, target) | ||
puts "cp #{source} #{target}" | ||
super | ||
end | ||
|
||
def touch(target) | ||
puts "touch #{target}" | ||
super | ||
end | ||
|
||
def exec(image, script, *argv) | ||
args = argv.map { |s| replace_placeholder(s) }.join(" ") | ||
puts "exec #{image} #{script} #{args}" | ||
super | ||
end | ||
|
||
def export(name, value) | ||
puts "export #{name}=#{replace_placeholder(value)}" | ||
super | ||
end | ||
|
||
def replace_placeholder(s) | ||
s.to_s.gsub(TEMPDIR_ROOT.to_s, "<tempdir>") | ||
end | ||
private :replace_placeholder | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters