Module: Taski
- Defined in:
- lib/taski.rb,
lib/taski/env.rb,
lib/taski/args.rb,
lib/taski/task.rb,
lib/taski/logging.rb,
lib/taski/version.rb,
lib/taski/task_proxy.rb,
lib/taski/test_helper.rb,
lib/taski/progress/config.rb,
lib/taski/test_helper/rspec.rb,
lib/taski/execution/executor.rb,
lib/taski/execution/registry.rb,
lib/taski/test_helper/errors.rb,
lib/taski/execution/scheduler.rb,
lib/taski/progress/layout/log.rb,
lib/taski/progress/theme/base.rb,
lib/taski/progress/layout/base.rb,
lib/taski/progress/layout/tags.rb,
lib/taski/progress/layout/tree.rb,
lib/taski/progress/theme/plain.rb,
lib/taski/test_helper/minitest.rb,
lib/taski/execution/worker_pool.rb,
lib/taski/progress/theme/detail.rb,
lib/taski/execution/task_wrapper.rb,
lib/taski/progress/layout/simple.rb,
lib/taski/progress/theme/compact.rb,
lib/taski/progress/theme/default.rb,
lib/taski/execution/task_observer.rb,
lib/taski/progress/layout/filters.rb,
lib/taski/static_analysis/visitor.rb,
lib/taski/execution/fiber_protocol.rb,
lib/taski/static_analysis/analyzer.rb,
lib/taski/test_helper/mock_wrapper.rb,
lib/taski/progress/layout/tree/live.rb,
lib/taski/test_helper/mock_registry.rb,
lib/taski/execution/execution_facade.rb,
lib/taski/execution/task_output_pipe.rb,
lib/taski/progress/layout/theme_drop.rb,
lib/taski/progress/layout/tree/event.rb,
lib/taski/execution/task_output_router.rb,
lib/taski/progress/layout/tree/structure.rb,
lib/taski/static_analysis/dependency_graph.rb,
lib/taski/static_analysis/start_dep_analyzer.rb
Defined Under Namespace
Modules: AggregateAware, Execution, Logging, Progress, StaticAnalysis, TestHelper Classes: AggregateError, Args, CircularDependencyError, Env, Task, TaskAbortException, TaskError, TaskFailure, TaskProxy
Constant Summary collapse
- PROGRESS_MONITOR =
Monitor.new
- PROGRESS_NOT_SET =
Object.new.freeze
- VERSION =
"0.10.0"
Class Method Summary collapse
-
.args ⇒ Args?
Get the current runtime arguments.
-
.args_worker_count ⇒ Integer?
private
Get the worker count from the current args (set via Task.run(workers: n)).
-
.clear_current_registry ⇒ Object
private
Clear the current registry for this thread (internal use only).
-
.current_registry ⇒ Execution::Registry?
private
Get the current registry for this thread (used during dependency resolution).
-
.env ⇒ Env?
Get the current execution environment.
-
.logger ⇒ Logger?
Get the current logger for structured logging.
-
.logger=(logger) ⇒ Object
Set the logger for structured logging.
-
.message(text) ⇒ Object
Output a message to the user without being captured by TaskOutputRouter.
-
.progress ⇒ Progress::Config
Get the progress configuration singleton.
- .progress_display ⇒ Object
- .progress_display=(display) ⇒ Object
-
.reset_args! ⇒ Object
private
Reset the runtime arguments (internal use only).
-
.reset_env! ⇒ Object
private
Reset the execution environment (internal use only).
- .reset_progress_display! ⇒ Object
-
.set_current_registry(registry) ⇒ Object
private
Set the current registry for this thread (internal use only).
-
.start_args(options:) ⇒ Boolean
private
Start new runtime arguments (internal use only).
-
.start_env(root_task:) ⇒ Boolean
private
Start new execution environment (internal use only).
-
.with_args(options:) { ... } ⇒ Object
Execute a block with args lifecycle management.
-
.with_env(root_task:) { ... } ⇒ Object
Execute a block with env lifecycle management.
Class Method Details
.args ⇒ Args?
Get the current runtime arguments
182 183 184 |
# File 'lib/taski.rb', line 182 def self.args @args_monitor.synchronize { @args } end |
.args_worker_count ⇒ Integer?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the worker count from the current args (set via Task.run(workers: n))
320 321 322 |
# File 'lib/taski.rb', line 320 def self.args_worker_count args&.fetch(:_workers, nil) end |
.clear_current_registry ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Clear the current registry for this thread (internal use only)
339 340 341 |
# File 'lib/taski.rb', line 339 def self.clear_current_registry Thread.current[:taski_current_registry] = nil end |
.current_registry ⇒ Execution::Registry?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the current registry for this thread (used during dependency resolution)
327 328 329 |
# File 'lib/taski.rb', line 327 def self.current_registry Thread.current[:taski_current_registry] end |
.env ⇒ Env?
Get the current execution environment
188 189 190 |
# File 'lib/taski.rb', line 188 def self.env @env_monitor.synchronize { @env } end |
.logger ⇒ Logger?
Get the current logger for structured logging
170 171 172 |
# File 'lib/taski.rb', line 170 def self.logger @logger_monitor.synchronize { @logger } end |
.logger=(logger) ⇒ Object
Set the logger for structured logging
176 177 178 |
# File 'lib/taski.rb', line 176 def self.logger=(logger) @logger_monitor.synchronize { @logger = logger } end |
.message(text) ⇒ Object
Output a message to the user without being captured by TaskOutputRouter. During task execution with progress display, messages are queued and displayed after execution completes. Without progress display or outside task execution, messages are output immediately.
198 199 200 201 202 203 204 205 206 207 |
# File 'lib/taski.rb', line 198 def self.(text) @message_monitor.synchronize do progress = progress_display if progress&.respond_to?(:queue_message) progress.(text) else $stdout.puts(text) end end end |
.progress ⇒ Progress::Config
Get the progress configuration singleton.
285 286 287 |
# File 'lib/taski.rb', line 285 def self.progress PROGRESS_MONITOR.synchronize { @progress_config } end |
.progress_display ⇒ Object
289 290 291 292 293 294 295 296 |
# File 'lib/taski.rb', line 289 def self.progress_display PROGRESS_MONITOR.synchronize do if @progress_display.equal?(PROGRESS_NOT_SET) @progress_display = @progress_config.build end @progress_display end end |
.progress_display=(display) ⇒ Object
298 299 300 301 302 303 304 305 |
# File 'lib/taski.rb', line 298 def self.progress_display=(display) PROGRESS_MONITOR.synchronize do unless @progress_display.equal?(PROGRESS_NOT_SET) @progress_display.stop if @progress_display.respond_to?(:stop) end @progress_display = display end end |
.reset_args! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reset the runtime arguments (internal use only)
253 254 255 |
# File 'lib/taski.rb', line 253 def self.reset_args! @args_monitor.synchronize { @args = nil } end |
.reset_env! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reset the execution environment (internal use only)
222 223 224 |
# File 'lib/taski.rb', line 222 def self.reset_env! @env_monitor.synchronize { @env = nil } end |
.reset_progress_display! ⇒ Object
307 308 309 310 311 312 313 314 315 |
# File 'lib/taski.rb', line 307 def self.reset_progress_display! PROGRESS_MONITOR.synchronize do unless @progress_display.equal?(PROGRESS_NOT_SET) @progress_display.stop if @progress_display.respond_to?(:stop) end @progress_display = PROGRESS_NOT_SET @progress_config.reset end end |
.set_current_registry(registry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the current registry for this thread (internal use only)
333 334 335 |
# File 'lib/taski.rb', line 333 def self.set_current_registry(registry) Thread.current[:taski_current_registry] = registry end |
.start_args(options:) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Start new runtime arguments (internal use only)
243 244 245 246 247 248 249 |
# File 'lib/taski.rb', line 243 def self.start_args(options:) @args_monitor.synchronize do return false if @args @args = Args.new(options: ) true end end |
.start_env(root_task:) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Start new execution environment (internal use only)
212 213 214 215 216 217 218 |
# File 'lib/taski.rb', line 212 def self.start_env(root_task:) @env_monitor.synchronize do return false if @env @env = Env.new(root_task: root_task) true end end |
.with_args(options:) { ... } ⇒ Object
Execute a block with args lifecycle management. Creates args if they don't exist, and resets them only if this call created them. This prevents race conditions in concurrent execution.
264 265 266 267 268 269 |
# File 'lib/taski.rb', line 264 def self.with_args(options:) created_args = start_args(options: ) yield ensure reset_args! if created_args end |
.with_env(root_task:) { ... } ⇒ Object
Execute a block with env lifecycle management. Creates env if it doesn't exist, and resets it only if this call created it. This prevents race conditions in concurrent execution.
233 234 235 236 237 238 |
# File 'lib/taski.rb', line 233 def self.with_env(root_task:) created_env = start_env(root_task: root_task) yield ensure reset_env! if created_env end |