Skip to content

Commit

Permalink
TaskAction public API (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
pior committed Jan 12, 2019
1 parent 35941fa commit 6973f00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/tasks/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type Task struct {
*TaskDefinition
header string
actions []taskAction
actions []TaskAction
feature features.FeatureInfo
}

Expand All @@ -22,7 +22,7 @@ func (t *Task) SetFeature(name, param string) {
t.feature = features.NewFeatureInfo(name, param)
}

func (t *Task) AddAction(action taskAction) {
func (t *Task) AddAction(action TaskAction) {
t.actions = append(t.actions, action)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/tasks/task_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tasks

import "fmt"

type taskAction interface {
type TaskAction interface {
Description() string
Needed(*Context) *ActionResult
Run(*Context) error
Expand All @@ -26,7 +26,7 @@ func actionNotNeeded() *ActionResult {
return &ActionResult{Needed: false}
}

func runAction(ctx *Context, action taskAction) error {
func runAction(ctx *Context, action TaskAction) error {
desc := action.Description()

result := action.Needed(ctx)
Expand Down
4 changes: 2 additions & 2 deletions pkg/tasks/task_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestTaskRunner(t *testing.T) {

task := &Task{
TaskDefinition: &TaskDefinition{Name: "testtask"},
actions: []taskAction{action1, action2},
actions: []TaskAction{action1, action2},
}

taskRunner := &TaskRunnerImpl{}
Expand All @@ -158,7 +158,7 @@ func TestTaskRunnerWithError(t *testing.T) {

task := &Task{
TaskDefinition: &TaskDefinition{Name: "testtask"},
actions: []taskAction{action1, action2},
actions: []TaskAction{action1, action2},
}

taskRunner := &TaskRunnerImpl{}
Expand Down

0 comments on commit 6973f00

Please sign in to comment.