-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathergo.go
More file actions
88 lines (75 loc) · 2.41 KB
/
ergo.go
File metadata and controls
88 lines (75 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package ergo
import (
"context"
"time"
)
// MessageLevel defines the level of output message.
type MessageLevel string
// Host interface describes the host's actions.
type Host interface {
CreateDraftRelease(ctx context.Context, name, tagName, releaseBody, targetBranch string) error
LastRelease(ctx context.Context) (*Release, error)
EditRelease(ctx context.Context, release *Release) (*Release, error)
PublishRelease(ctx context.Context, releaseID int64) error
CompareBranch(ctx context.Context, baseBranch, branch string) (*StatusReport, error)
DiffCommits(ctx context.Context, releaseBranches []string, baseBranch string) ([]*StatusReport, error)
CreateTag(ctx context.Context, versionName, sha, m string) (*Tag, error)
UpdateBranchFromTag(ctx context.Context, tag, toBranch string, force bool) error
GetRef(ctx context.Context, branch string) (*Reference, error)
GetRefFromTag(ctx context.Context, tag string) (*Reference, error)
GetRepoName() string
}
// CLI describes the command line interface actions.
type CLI interface {
PrintTable(header []string, values [][]string)
PrintColorizedLine(title, content string, level MessageLevel)
PrintLine(content ...interface{})
Confirmation(actionText, cancellationMessage, successMessage string) (bool, error)
Input() (string, error)
}
// Time describes actions around time and waiting.
type Time interface {
Sleep(duration time.Duration)
Now() time.Time
}
// Deploy describes the deploy process.
type Deploy interface {
Do(ctx context.Context, releaseIntervalInput, releaseOffsetInput string, allowForcePush bool) error
}
// Draft describes the draft process.
type Draft interface {
Create(ctx context.Context, releaseName, tagName string, skipConfirm bool) error
}
// Release struct contains all the fields which describe the release entity.
type Release struct {
ID int64
Body string
TagName string
ReleaseURL string
Draft bool
}
// StatusReport struct is responsible to keep the information about current status.
type StatusReport struct {
Branch string
BaseBranch string
Ahead []*Commit
Behind []*Commit
}
// Commit describes the commit entity.
type Commit struct {
Message string
}
// Tag describes the tag entity.
type Tag struct {
Name string
}
// Reference describes the reference entity.
type Reference struct {
SHA string
Ref string
}
// Version describe the version entity.
type Version struct {
Name string
SHA string
}