ductwork 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/ductwork/models/job.rb +2 -2
- data/lib/ductwork/models/pipeline.rb +2 -2
- data/lib/ductwork/testing/rspec.rb +36 -0
- data/lib/ductwork/version.rb +1 -1
- data/lib/ductwork.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 006fe9321eda6c5c92de6e1f7e1b508cb11d71a1e7cbef346ffa79cc8f2a94ab
|
|
4
|
+
data.tar.gz: 3085cb1ad7002953b7e5808a7186e8faf069c0b509421bf05f2aac8b47d453d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74678bcc5583a767e5bf3edcd5f5dacabe524dd17292de4535da0e94eedef35783648a00ee35fdace4d45ba7a6a3d43da45af362d8a9237d13ab002066cc8082
|
|
7
|
+
data.tar.gz: b93a2df98327ed6a9bb7536cf4f2f07faad27107ccfc63bc5a1d243eb2b8fbc2e513c72512af14f028df698ae790ebf8102e1cca8c12e1b9090ff3f670a62b03
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Ductwork Changelog
|
|
2
2
|
|
|
3
|
+
## [0.16.0]
|
|
4
|
+
|
|
5
|
+
- feat!: allow `Pipeline.trigger` to accept arbitrary positional arguments - this is a BREAKING CHANGE as it changes the structure of how arguments are stored and passed between steps
|
|
6
|
+
- feat: add RSpec testing helper for setting context state
|
|
7
|
+
- feat: add RSpec testing helper for easily creating pipelines
|
|
8
|
+
|
|
3
9
|
## [0.15.1]
|
|
4
10
|
|
|
5
11
|
- fix: pass pipeline ID directly to step builder method instead of passing step object
|
data/lib/ductwork/models/job.rb
CHANGED
|
@@ -67,7 +67,7 @@ module Ductwork
|
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
def self.enqueue(step, args)
|
|
70
|
+
def self.enqueue(step, *args)
|
|
71
71
|
job = step.create_job!(
|
|
72
72
|
klass: step.klass,
|
|
73
73
|
started_at: Time.current,
|
|
@@ -100,7 +100,7 @@ module Ductwork
|
|
|
100
100
|
job_klass: klass
|
|
101
101
|
)
|
|
102
102
|
args = JSON.parse(input_args)["args"]
|
|
103
|
-
instance = Object.const_get(klass).build_for_execution(step.pipeline_id, args)
|
|
103
|
+
instance = Object.const_get(klass).build_for_execution(step.pipeline_id, *args)
|
|
104
104
|
run = execution.create_run!(
|
|
105
105
|
started_at: Time.current
|
|
106
106
|
)
|
|
@@ -52,7 +52,7 @@ module Ductwork
|
|
|
52
52
|
Ductwork.defined_pipelines << name.to_s
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def trigger(args)
|
|
55
|
+
def trigger(*args)
|
|
56
56
|
if pipeline_definition.nil?
|
|
57
57
|
raise DefinitionError, "Pipeline must be defined before triggering"
|
|
58
58
|
end
|
|
@@ -78,7 +78,7 @@ module Ductwork
|
|
|
78
78
|
to_transition: :start,
|
|
79
79
|
started_at: Time.current
|
|
80
80
|
)
|
|
81
|
-
Ductwork::Job.enqueue(step, args)
|
|
81
|
+
Ductwork::Job.enqueue(step, *args)
|
|
82
82
|
|
|
83
83
|
p
|
|
84
84
|
end
|
|
@@ -61,3 +61,39 @@ RSpec::Matchers.define(:have_triggered_pipelines) do |*expected|
|
|
|
61
61
|
"expected to trigger pipelines: #{pipeline_names} but did not"
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
|
+
|
|
65
|
+
module Ductwork
|
|
66
|
+
module Testing
|
|
67
|
+
module RSpec
|
|
68
|
+
def pipeline_for(klass, **attrs)
|
|
69
|
+
definition = klass.pipeline_definition.to_json
|
|
70
|
+
definition_sha1 = OpenSSL::Digest::SHA256.hexdigest(definition)
|
|
71
|
+
status = attrs[:status] || "in_progress"
|
|
72
|
+
triggered_at = attrs[:triggered_at] || Time.current
|
|
73
|
+
started_at = attrs[:started_at] || Time.current
|
|
74
|
+
last_advanced_at = attrs[:last_advanced_at] || Time.current
|
|
75
|
+
|
|
76
|
+
Ductwork::Pipeline.create!(
|
|
77
|
+
klass:,
|
|
78
|
+
definition:,
|
|
79
|
+
definition_sha1:,
|
|
80
|
+
status:,
|
|
81
|
+
triggered_at:,
|
|
82
|
+
started_at:,
|
|
83
|
+
last_advanced_at:
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def set_pipeline_context(pipeline, **key_values)
|
|
88
|
+
ctx = Ductwork::Context.new(pipeline.id)
|
|
89
|
+
key_values.each do |key, value|
|
|
90
|
+
ctx.set(key.to_s, value)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
RSpec.configure do |config|
|
|
98
|
+
config.include Ductwork::Testing::RSpec
|
|
99
|
+
end
|
data/lib/ductwork/version.rb
CHANGED
data/lib/ductwork.rb
CHANGED
|
@@ -95,6 +95,7 @@ end
|
|
|
95
95
|
loader = Zeitwerk::Loader.for_gem
|
|
96
96
|
loader.inflector.inflect("cli" => "CLI")
|
|
97
97
|
loader.inflector.inflect("dsl" => "DSL")
|
|
98
|
+
loader.inflector.inflect("rspec" => "RSpec")
|
|
98
99
|
loader.collapse("#{__dir__}/ductwork/models")
|
|
99
100
|
loader.ignore("#{__dir__}/generators")
|
|
100
101
|
loader.ignore("#{__dir__}/ductwork/testing")
|