Documentation
¶
Overview ¶
Example ¶
Example shows how to use GitUp to check and automatically update this repository.
package main
import (
"fmt"
up "github.com/rvflash/gitup"
"os"
)
func main() {
// Defines the strategy to use in case of update.
sup := up.UpdateStrategy{}
sup.AddStrategy(up.MajorVersion, up.Auto)
// Gets the path of the current repository and ignores the errors just for the demo.
pwd, _ := os.Getwd()
// Applies update strategy on current Git repository.
repo, _ := up.NewRepo(pwd)
if repo.InDemand(sup) {
repo.Update(sup)
}
fmt.Println("You are on the last version of GitUp.")
}
Output: You are on the last version of GitUp.
Index ¶
Examples ¶
Constants ¶
View Source
const ( Noop = iota // 0 Manual // 1 Auto // 2 )
Update mode.
View Source
const ( MajorVersion = iota // 0 MinorVersion // 1 PatchVersion // 2 PreReleaseVersion // 3 BuildMetadata // 4 )
Version tags.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitFlow ¶
type GitFlow interface {
LocalTag() (string, error)
LastTag() (string, error)
CheckoutTag(string) error
}
GitFlow returns the current state of the repository.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo represents a Git repository.
func (*Repo) InDemand ¶
func (r *Repo) InDemand(s UpdateStrategy) bool
InDemand returns true if the Git repository needs to be updated because it is not on the latest tag.
func (*Repo) Update ¶
func (r *Repo) Update(s UpdateStrategy) error
Update returns an error if it can not to update Git repository with the latest tag.
type UpdateStrategy ¶
type UpdateStrategy struct {
// contains filtered or unexported fields
}
UpdateStrategy represents the update mode.
func (*UpdateStrategy) AddStrategy ¶
func (s *UpdateStrategy) AddStrategy(version, action uint8) (err error)
AddStrategy starts a new Git repository.
Click to show internal directories.
Click to hide internal directories.