Skip to content

Commit

Permalink
Renamed 'output' to 'outputs' where it makes sense
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jun 20, 2023
1 parent b62ea61 commit ebfb788
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

* Tasks are mostly YAML serializable (procs can't be serialized)
* Task class uses properties instead of instance variables
* TaskManager is now a struct
* Renamed argument `output` to `outputs` in `Task.initialize` where
it makes sense.

## Version v0.1.8

Expand Down
2 changes: 1 addition & 1 deletion spec/croupier_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def with_scenario(
tasks.as_h.values.each do |t|
Task.new(
name: t["name"].to_s,
output: t["outputs"].as_a.map(&.to_s),
outputs: t["outputs"].as_a.map(&.to_s),
inputs: t["inputs"].as_a.map(&.to_s),
proc: _procs[t["procs"]],
always_run: t["always_run"].as_bool,
Expand Down
7 changes: 3 additions & 4 deletions src/croupier.cr
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,22 @@ module Croupier
# always_run is a boolean that tells croupier that the task is always
# stale regardless of its dependencies' state
# FIXME: the id/name/output thing is confusing
# FIXME: rename output to outputs
def initialize(
name : String,
output : Array(String) = [] of String,
outputs : Array(String) = [] of String,
inputs : Array(String) = [] of String,
proc : TaskProc | Nil = nil,
no_save : Bool = false,
id : String | Nil = nil,
always_run : Bool = false
)
if !(inputs.to_set & output.to_set).empty?
if !(inputs.to_set & outputs.to_set).empty?
raise "Cycle detected"
end
@always_run = always_run
@name = name
@procs << proc unless proc.nil?
@outputs = output.uniq
@outputs = outputs.uniq
@id = id ? id : Digest::SHA1.hexdigest(@outputs.join(","))
@inputs = inputs
@no_save = no_save
Expand Down

0 comments on commit ebfb788

Please sign in to comment.