Module: Ductwork

Defined in:
lib/ductwork.rb,
lib/ductwork/cli.rb,
lib/ductwork/engine.rb,
lib/ductwork/context.rb,
lib/ductwork/testing.rb,
lib/ductwork/version.rb,
lib/ductwork/migration.rb,
lib/ductwork/models/job.rb,
lib/ductwork/models/run.rb,
lib/ductwork/models/step.rb,
lib/ductwork/branch_claim.rb,
lib/ductwork/models/tuple.rb,
lib/ductwork/configuration.rb,
lib/ductwork/models/branch.rb,
lib/ductwork/models/record.rb,
lib/ductwork/models/result.rb,
lib/ductwork/testing/rspec.rb,
lib/ductwork/database_clock.rb,
lib/ductwork/models/attempt.rb,
lib/ductwork/models/process.rb,
lib/ductwork/execution_claim.rb,
lib/ductwork/fault_injection.rb,
lib/ductwork/models/pipeline.rb,
lib/ductwork/running_context.rb,
lib/ductwork/testing/helpers.rb,
lib/ductwork/migration_helper.rb,
lib/ductwork/models/execution.rb,
lib/ductwork/testing/minitest.rb,
lib/ductwork/models/transition.rb,
lib/ductwork/dsl/branch_builder.rb,
lib/ductwork/machine_identifier.rb,
lib/ductwork/models/advancement.rb,
lib/ductwork/models/branch_link.rb,
lib/ductwork/processes/launcher.rb,
lib/ductwork/models/availability.rb,
lib/ductwork/processes/job_worker.rb,
lib/ductwork/dsl/definition_builder.rb,
lib/ductwork/processes/health_check.rb,
app/helpers/ductwork/application_helper.rb,
lib/ductwork/processes/job_worker_runner.rb,
lib/ductwork/processes/pipeline_advancer.rb,
lib/ductwork/processes/thread_supervisor.rb,
lib/ductwork/row_locking_execution_claim.rb,
lib/ductwork/processes/process_supervisor.rb,
lib/ductwork/processes/worker_health_check.rb,
app/controllers/ductwork/pipelines_controller.rb,
app/controllers/ductwork/dashboards_controller.rb,
app/controllers/ductwork/application_controller.rb,
app/controllers/ductwork/step_errors_controller.rb,
lib/ductwork/optimistic_locking_execution_claim.rb,
lib/ductwork/processes/pipeline_advancer_runner.rb,
lib/ductwork/processes/thread_supervisor_runner.rb,
lib/generators/ductwork/update/update_generator.rb,
lib/ductwork/processes/process_supervisor_runner.rb,
lib/generators/ductwork/install/install_generator.rb

Defined Under Namespace

Modules: ApplicationHelper, DSL, FaultInjection, MigrationHelper, Processes, Testing Classes: Advancement, ApplicationController, Attempt, Availability, Branch, BranchClaim, BranchLink, CLI, Configuration, Context, DashboardsController, DatabaseClock, Engine, Execution, ExecutionClaim, InstallGenerator, Job, MachineIdentifier, Migration, OptimisticLockingExecutionClaim, Pipeline, PipelinesController, Process, Record, Result, RowLockingExecutionClaim, Run, RunningContext, Step, StepErrorsController, Transition, Tuple, UpdateGenerator

Constant Summary collapse

VERSION =
"1.0.0"
Workflow =
Ductwork::Pipeline

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.app_executorObject

Returns the value of attribute app_executor.



14
15
16
# File 'lib/ductwork.rb', line 14

def app_executor
  @app_executor
end

.configurationObject

Returns the value of attribute configuration.



14
15
16
# File 'lib/ductwork.rb', line 14

def configuration
  @configuration
end

.defined_pipelinesObject



61
62
63
# File 'lib/ductwork.rb', line 61

def defined_pipelines
  @defined_pipelines ||= []
end

.hooksObject



29
30
31
32
33
34
35
# File 'lib/ductwork.rb', line 29

def hooks
  @hooks ||= {
    supervisor: { start: [], stop: [] },
    advancer: { start: [], stop: [] },
    worker: { start: [], stop: [] },
  }
end

.loaderObject

Returns the value of attribute loader.



14
15
16
# File 'lib/ductwork.rb', line 14

def loader
  @loader
end

.loggerObject

Returns the value of attribute logger.



14
15
16
# File 'lib/ductwork.rb', line 14

def logger
  @logger
end

Class Method Details

.eager_loadObject



17
18
19
# File 'lib/ductwork.rb', line 17

def eager_load
  loader.eager_load
end

.on_advancer_start(&block) ⇒ Object



45
46
47
# File 'lib/ductwork.rb', line 45

def on_advancer_start(&block)
  add_lifecycle_hook(:advancer, :start, block)
end

.on_advancer_stop(&block) ⇒ Object



49
50
51
# File 'lib/ductwork.rb', line 49

def on_advancer_stop(&block)
  add_lifecycle_hook(:advancer, :stop, block)
end

.on_supervisor_start(&block) ⇒ Object



37
38
39
# File 'lib/ductwork.rb', line 37

def on_supervisor_start(&block)
  add_lifecycle_hook(:supervisor, :start, block)
end

.on_supervisor_stop(&block) ⇒ Object



41
42
43
# File 'lib/ductwork.rb', line 41

def on_supervisor_stop(&block)
  add_lifecycle_hook(:supervisor, :stop, block)
end

.on_worker_start(&block) ⇒ Object



53
54
55
# File 'lib/ductwork.rb', line 53

def on_worker_start(&block)
  add_lifecycle_hook(:worker, :start, block)
end

.on_worker_stop(&block) ⇒ Object



57
58
59
# File 'lib/ductwork.rb', line 57

def on_worker_stop(&block)
  add_lifecycle_hook(:worker, :stop, block)
end

.validate!Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ductwork.rb', line 65

def validate!
  step_directory = Rails.root.join("app/steps")
  pipeline_directory = Rails.root.join("app/pipelines")
  workflow_directory = Rails.root.join("app/workflows")
  loader = if defined?(Rails.autoloaders)
             Rails.autoloaders.main
           else
             Ductwork.loader
           end

  if step_directory.exist?
    loader.eager_load_dir(step_directory)
  end

  if pipeline_directory.exist?
    loader.eager_load_dir(pipeline_directory)
  end

  if workflow_directory.exist?
    loader.eager_load_dir(workflow_directory)
  end

  true
end

.wrap_with_app_executor(&block) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/ductwork.rb', line 21

def wrap_with_app_executor(&block)
  if app_executor.present?
    app_executor.wrap(&block)
  else
    yield
  end
end