common

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotReleasable = errors.New("release cannot be released")

ErrNotReleasable shall be returned from EnsureReleasable() when the given release cannot be released yet.

View Source
var ErrNotStageable = errors.New("release cannot be staged")

ErrNotStageable shall be returned from EnsureStageable() when the given release cannot be staged yet.

Functions

This section is empty.

Types

type CodeReviewTool

type CodeReviewTool interface {
	// InitialiseRelease is called during `release start`
	// when a new version string is committed into trunk.
	InitialiseRelease(v *version.Version) (rollback action.Action, err error)

	// FinaliseRelease is called during `release stage`
	// when the release is being closed. In can abort the process
	// by returning an error.
	FinaliseRelease(v *version.Version) (rollback action.Action, err error)

	PostReviewRequests(ctxs []*ReviewContext, opts map[string]interface{}) error
	PostReviewFollowupMessage() string
}

type CodeReviewToolFactory added in v0.14.0

type CodeReviewToolFactory interface {
	// LocalConfigTemplate returns the string that is inserted into the local config
	// file during `repo bootstrap`. It is basically the local config section skeleton
	// that the user has to fill in manually.
	LocalConfigTemplate() string

	// NewCodeReviewTool returns a new instance of the given code review tool module.
	NewCodeReviewTool() (CodeReviewTool, error)
}

type Config

type Config interface {
	IssueTrackerId() string
	CodeReviewToolId() string
	ReleaseNotesManagerId() string
}

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig returns the config that is useful for modules in general.

Even when an error is returned, Config can be partially filled in in case the error being returned is a validation error.

type ErrReleaseNotFound

type ErrReleaseNotFound struct {
	Version *version.Version
}

ErrReleaseNotFound shall be returned from GenerateReleaseNotes or perhaps any other function when the given release was not found.

func (*ErrReleaseNotFound) Error added in v0.10.0

func (err *ErrReleaseNotFound) Error() string

type IssueTracker

type IssueTracker interface {

	// ServiceName returns the name of the service this interface represents.
	ServiceName() string

	// CurrentUser returns the issue tracker account details of the current user.
	// The account ID is taken from the global SalsaFlow configuration file.
	CurrentUser() (User, error)

	// StartableStories returns the list of stories that can be started.
	StartableStories() ([]Story, error)

	// ReviewableStories returns the list of stories that can be assigned
	// a commit to be reviewed, i.e. they are being actively developed and
	// the review phase is not over yet.
	ReviewableStories() ([]Story, error)

	// ReviewedStories returns the list of stories that have been reviewed already.
	ReviewedStories() ([]Story, error)

	// ListStoriesByTag returns the stories for the given list of Story-Id tags.
	ListStoriesByTag(tags []string) ([]Story, error)

	// ListStoriesByRelease returns the stories associated with the given release.
	// An empty slice should be returned in case there are no such stories.
	ListStoriesByRelease(v *version.Version) ([]Story, error)

	// NextRelease is a factory method for creating release objects
	// representing the releases that have not been started yet.
	//
	// The current version is the version on the trunk branch,
	// the next version is the next trunk version, i.e. the version that is bumped
	// to the trunk branch once the release branch is created.
	NextRelease(current *version.Version, next *version.Version) (NextRelease, error)

	// RunningRelease is a factory method for creating release objects
	// representing the releases that have been started.
	RunningRelease(*version.Version) (RunningRelease, error)

	// OpenStory opens the given story in the web browser.
	OpenStory(storyId string) error

	// StoryTagToReadableStoryId parses the Story-Id tag and returns the relevant readable ID.
	StoryTagToReadableStoryId(tag string) (storyId string, err error)
}

type IssueTrackerFactory added in v0.14.0

type IssueTrackerFactory interface {
	LocalConfigTemplate() string
	NewIssueTracker() (IssueTracker, error)
}

type LocalConfig

type LocalConfig struct {
	IssueTrackerId        string `yaml:"issue_tracker"`
	CodeReviewToolId      string `yaml:"code_review_tool"`
	ReleaseNotesManagerId string `yaml:"release_notes"`
}

type NextRelease

type NextRelease interface {
	PromptUserToConfirmStart() (bool, error)
	Start() (action.Action, error)
}

type ReleaseNotes added in v0.10.0

type ReleaseNotes struct {
	Version  *version.Version
	Sections []*ReleaseNotesSection
}

ReleaseNotes represent, well, the release notes for the given version.

type ReleaseNotesManager added in v0.10.0

type ReleaseNotesManager interface {

	// PostReleaseNotes post the given release notes.
	PostReleaseNotes(*ReleaseNotes) (action.Action, error)
}

ReleaseNotesManager is used to post release notes once a release is closed.

type ReleaseNotesManagerFactory added in v0.14.0

type ReleaseNotesManagerFactory interface {
	LocalConfigTemplate() string
	NewReleaseNotesManager() (ReleaseNotesManager, error)
}

type ReleaseNotesSection added in v0.10.0

type ReleaseNotesSection struct {
	StoryType string
	Stories   []Story
}

ReleaseNotesSection represents a section of release notes that is associated with certain story type.

type ReleaseNotesSections added in v0.10.0

type ReleaseNotesSections []*ReleaseNotesSection

Implement sort.Interface to sort story sections alphabetically.

func (ReleaseNotesSections) Len added in v0.10.0

func (sections ReleaseNotesSections) Len() int

func (ReleaseNotesSections) Less added in v0.10.0

func (sections ReleaseNotesSections) Less(i, j int) bool

func (ReleaseNotesSections) Swap added in v0.10.0

func (sections ReleaseNotesSections) Swap(i, j int)

type ReviewContext added in v0.7.0

type ReviewContext struct {
	Commit *git.Commit
	Story  Story
}

type RunningRelease

type RunningRelease interface {
	Version() *version.Version
	Stories() ([]Story, error)

	// EnsureStageable shall return *ErrNotStageable in case
	// it is not possible to stage the given release.
	EnsureStageable() error
	Stage() (action.Action, error)

	// EnsureReleasable shall return *ErrNotReleasable in case
	// it is not possible to release the given release.
	EnsureReleasable() error
	Release() error
}

type Stories added in v0.10.0

type Stories []Story

Stories implement sort.Interface

func (Stories) Len added in v0.10.0

func (ss Stories) Len() int

func (Stories) Less added in v0.10.0

func (ss Stories) Less(i, j int) bool

func (Stories) Swap added in v0.10.0

func (ss Stories) Swap(i, j int)

type Story

type Story interface {
	// Id returns the ID of the story.
	Id() string

	// ReadableId returns the human-friendly ID of the story.
	// This ID is used when listing stories to the user.
	ReadableId() string

	// Type returns a string representing the type of the given issue.
	// The values returned depend on the issue tracker.
	Type() string

	// State returns the abstract state the story is in at the moment.
	State() StoryState

	// URL return the URL that can be used to access the story.
	URL() string

	// Tag returns a string that is then used for the Story-Id tag.
	// The tag is supposed to identify the story, but it might be
	// more complicated than just the story ID.
	Tag() string

	// Title returns a short description of the story.
	// It is used to describe stories when listing them to the user.
	Title() string

	// Assignees returns the list of users that are assigned to the story.
	Assignees() []User

	// AddAssignee can be used to add an additional user to the list of assignees.
	AddAssignee(User) error

	// SetAssigness can be used to set the list of assignees,
	// effectively replacing the current list.
	SetAssignees([]User) error

	// Start can be used to start the story in the issue tracker.
	Start() error

	// MarkAsImplemented marks the story as implemented.
	MarkAsImplemented() (action.Action, error)

	// LessThan is being used for sorting stories for output.
	// Stories are printed in the order they are sorted by this function.
	LessThan(Story) bool

	// IssueTracker can be used to get the issue tracker instance
	// that this story is associated with.
	IssueTracker() IssueTracker
}

type StoryState added in v0.9.0

type StoryState string
const (
	StoryStateNew              StoryState = "new"
	StoryStateApproved         StoryState = "approved"
	StoryStateBeingImplemented StoryState = "being implemented"
	StoryStateImplemented      StoryState = "implemented"
	StoryStateReviewed         StoryState = "reviewed"
	StoryStateBeingTested      StoryState = "being tested"
	StoryStateTested           StoryState = "tested"
	StoryStateStaged           StoryState = "staged"
	StoryStateAccepted         StoryState = "accepted"
	StoryStateRejected         StoryState = "rejected"
	StoryStateClosed           StoryState = "closed"
	StoryStateInvalid          StoryState = "invalid"
)

type User

type User interface {
	Id() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL