-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from LMaxence/feat/step-arguments
feat: add support for MATCHED_FILES and PACKAGE_FILES step argument
- Loading branch information
Showing
26 changed files
with
1,259 additions
and
901 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package configuration | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
type StepFixture struct { | ||
id string | ||
name string | ||
onlyOn *string | ||
files []string | ||
} | ||
|
||
func (sf *StepFixture) ToStep() *Step { | ||
return &Step{ | ||
Name: sf.name, | ||
OnlyOn: sf.onlyOn, | ||
Command: "echo Hello world", | ||
ID: sf.id, | ||
Files: sf.files, | ||
} | ||
} | ||
|
||
func (sf *StepFixture) Copy() *StepFixture { | ||
return &StepFixture{ | ||
id: uuid.NewString(), | ||
name: sf.name, | ||
onlyOn: sf.onlyOn, | ||
files: append([]string{}, sf.files...), | ||
} | ||
} | ||
|
||
func NewStepFixture() *StepFixture { | ||
return &StepFixture{ | ||
id: uuid.NewString(), | ||
name: uuid.NewString(), | ||
onlyOn: nil, | ||
files: make([]string, 0), | ||
} | ||
} | ||
|
||
func (sf *StepFixture) WithOnlyOn(onlyOn string) *StepFixture { | ||
sf.onlyOn = &onlyOn | ||
return sf | ||
} | ||
|
||
func (sf *StepFixture) WithFiles(files ...string) *StepFixture { | ||
sf.files = files | ||
return sf | ||
} | ||
|
||
type HookFixture struct { | ||
path string | ||
files []string | ||
steps []*StepFixture | ||
} | ||
|
||
func NewHookFixture(path string) *HookFixture { | ||
return &HookFixture{ | ||
path: path, | ||
steps: make([]*StepFixture, 0), | ||
files: make([]string, 0), | ||
} | ||
} | ||
|
||
func (hf *HookFixture) Copy() *HookFixture { | ||
steps := make([]*StepFixture, 0) | ||
for _, step := range hf.steps { | ||
steps = append(steps, step.Copy()) | ||
} | ||
|
||
return &HookFixture{ | ||
path: hf.path, | ||
steps: steps, | ||
files: append([]string{}, hf.files...), | ||
} | ||
} | ||
|
||
func (hf *HookFixture) ToHook() Hook { | ||
hook := Hook{ | ||
Path: hf.path, | ||
Steps: []Step{}, | ||
Files: hf.files, | ||
} | ||
|
||
for i, step := range hf.steps { | ||
hook.Steps = append(hook.Steps, Step{ | ||
OnlyOn: step.onlyOn, | ||
Command: "echo Hello world", | ||
ID: fmt.Sprintf("step%d", i), | ||
Files: step.files, | ||
}) | ||
} | ||
|
||
return hook | ||
} | ||
|
||
func (hf *HookFixture) WithFiles(files ...string) *HookFixture { | ||
hf.files = append(hf.files, files...) | ||
return hf | ||
} | ||
|
||
func (hf *HookFixture) WithStep(step ...*StepFixture) *HookFixture { | ||
hf.steps = append(hf.steps, step...) | ||
return hf | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,5 @@ type Step struct { | |
Serial bool | ||
From *string | ||
PackageRelativePath string | ||
Files []string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.