Documentation
¶
Index ¶
- Constants
- Variables
- func GetUrlToDir(u string, targetDir string, bearer string, ctx context.Context) (string, error)
- func GetUrltoTempFile(u string, bearer string, ctx context.Context) (string, error)
- type Hash
- type Hasher
- type Lock
- func (l *Lock) AddResource(paths []string, algo string, tags []string, filename string, cacheURL string) error
- func (l *Lock) Contains(url string) bool
- func (l *Lock) DeleteResource(path string) error
- func (l *Lock) Download(dir string, tags []string, notags []string, perm string, status bool) error
- func (l *Lock) Save() error
- type Resource
- type StatusLine
Constants ¶
const GRABIT_ARTIFACTORY_TOKEN_ENV_VAR = "GRABIT_ARTIFACTORY_TOKEN"
const NoFileMode = os.FileMode(0)
Variables ¶
var ( Version = "dev" Commit = "none" Date = "unknown" )
var COMMENT_PREFIX = "//"
var RecommendedAlgo = "sha256"
Functions ¶
func GetUrlToDir ¶ added in v0.1.2
GetUrlToDir downloads the given resource to the given directory and returns the path to it.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock represents a grabit lockfile.
func (*Lock) AddResource ¶
func (*Lock) DeleteResource ¶
type Resource ¶
type Resource struct { Urls []string Integrity string Tags []string `toml:",omitempty"` Filename string `toml:",omitempty"` ArtifactoryCacheURL string `toml:",omitempty"` }
Resource represents an external resource to be downloaded.
func NewResourceFromUrl ¶
func (*Resource) AddToCache ¶ added in v1.1.0
type StatusLine ¶ added in v1.1.0
type StatusLine struct {
// contains filtered or unexported fields
}
func NewStatusLine ¶ added in v1.1.0
func NewStatusLine(ctx context.Context, resources *[]Resource) *StatusLine
NewStatusLine creates and initializes a new StatusLine.
func (*StatusLine) GetStatusString ¶ added in v1.1.0
func (st *StatusLine) GetStatusString() string
GetStatusString composes and returns the status line string for printing.
func (*StatusLine) Increment ¶ added in v1.1.0
func (st *StatusLine) Increment(i int)
Increment informs the StatusLine that a resource (at index i in resource list) has finished downloading. The SL is printed and Stopped if all resources are downloaded.
func (*StatusLine) InitResourcesSizes ¶ added in v1.1.0
func (st *StatusLine) InitResourcesSizes() error
initResourceSizes fetches the size, in bytes, of each resource.
func (*StatusLine) Start ¶ added in v1.1.0
func (st *StatusLine) Start(doTick bool)
Start begins the goroutine and loop that will update/print the status line. Pass true to force SL to update (spinner and second counter) every 50ms.
func (*StatusLine) Stop ¶ added in v1.1.0
func (st *StatusLine) Stop()