git

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(url string, filename string) error

DownloadFile download a file from given URL and writes it to the given filename

func GetTopVersions

func GetTopVersions(versions []*semver.Version) ([]*semver.Version, error)

GetTopVersions return all major and minor versions Only the highest patch version is taken

func GetVersions

func GetVersions(tags []Tag) ([]*semver.Version, error)

GetVersions convert Tag into semver Version

func ProjectGitInit

func ProjectGitInit(projectName string) error

ProjectGitInit initialize a git project

func VersionsToStrings

func VersionsToStrings(versions []*semver.Version) []string

VersionsToStrings convert semver Versions into a array of strings

Types

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is an abstraction of the default HTTP client. Mainly used to ease testing.

var (
	// GitClient is the client config for HTTP request
	GitClient HTTPClient = &http.Client{Timeout: 30 * time.Second}
)

type Tag

type Tag struct {
	Name       string `json:"name"`
	ZipballURL string `json:"zipball_url"`
	TarballURL string `json:"tarball_url"`
	Commit     struct {
		SHA string `json:"sha"`
		URL string `json:"url"`
	} `json:"commit"`
	NodeID string `json:"node_id"`
}

Tag represent github api response

func GetAllTags

func GetAllTags() ([]Tag, error)

GetAllTags return all Goyave tags registered inside Github API

func GetTagByName

func GetTagByName(name string, tags []Tag) (*Tag, error)

GetTagByName search a tag from a string version and a list of tags

func (*Tag) String

func (tag *Tag) String() string

Jump to

Keyboard shortcuts

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