Class: RosettAi::Thor::Tasks::BuildContext
- Inherits:
-
Struct
- Object
- Struct
- RosettAi::Thor::Tasks::BuildContext
- Defined in:
- lib/rosett_ai/thor/tasks/build.rb
Overview
Mutable build state: ID, log path, timings, and failure info.
Instance Attribute Summary collapse
-
#build_id ⇒ Object
Returns the value of attribute build_id.
-
#build_log ⇒ Object
Returns the value of attribute build_log.
-
#build_start ⇒ Object
Returns the value of attribute build_start.
-
#completed_stages ⇒ Object
Returns the value of attribute completed_stages.
-
#failed_stage ⇒ Object
Returns the value of attribute failed_stage.
-
#failure_reason ⇒ Object
Returns the value of attribute failure_reason.
-
#stage_timings ⇒ Object
Returns the value of attribute stage_timings.
-
#summary_printed ⇒ Object
Returns the value of attribute summary_printed.
Class Method Summary collapse
Instance Attribute Details
#build_id ⇒ Object
Returns the value of attribute build_id
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def build_id @build_id end |
#build_log ⇒ Object
Returns the value of attribute build_log
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def build_log @build_log end |
#build_start ⇒ Object
Returns the value of attribute build_start
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def build_start @build_start end |
#completed_stages ⇒ Object
Returns the value of attribute completed_stages
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def completed_stages @completed_stages end |
#failed_stage ⇒ Object
Returns the value of attribute failed_stage
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def failed_stage @failed_stage end |
#failure_reason ⇒ Object
Returns the value of attribute failure_reason
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def failure_reason @failure_reason end |
#stage_timings ⇒ Object
Returns the value of attribute stage_timings
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def stage_timings @stage_timings end |
#summary_printed ⇒ Object
Returns the value of attribute summary_printed
20 21 22 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 20 def summary_printed @summary_printed end |
Class Method Details
.create(log_dir) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rosett_ai/thor/tasks/build.rb', line 25 def self.create(log_dir) id = SecureRandom.uuid log_path = log_dir.join("build-#{id}.log") FileUtils.mkdir_p(log_path.dirname) ctx = new( build_id: id, build_start: Time.now, build_log: log_path, stage_timings: {}, completed_stages: [], failed_stage: nil, failure_reason: nil, summary_printed: false ) File.open(log_path, 'w', 0o644) do |f| f.write("# rosett-ai build log\n# Build ID: #{id}\n" \ "# Started: #{ctx.build_start.iso8601}\n\n") end ctx end |