Documentation ¶
Overview ¶
Package vending provides the public primitives that are needed for working with the tool.
Index ¶
- Constants
- type DefaultPreset
- func (dp *DefaultPreset) ForceFilters() bool
- func (dp *DefaultPreset) GetCacheDir() string
- func (dp *DefaultPreset) GetFilters() *Filters
- func (dp *DefaultPreset) GetFiltersForDependency(*Dependency) *Filters
- func (dp *DefaultPreset) GetPresetName() string
- func (dp *DefaultPreset) GetSpecFilename() string
- func (dp *DefaultPreset) GetSpecLockFilename() string
- func (dp *DefaultPreset) GetVendorDir() string
- type Dependency
- type DependencyLock
- type Filters
- func (f *Filters) AddExtension(extension ...string) *Filters
- func (f *Filters) AddIgnore(ignore ...string) *Filters
- func (f *Filters) AddTarget(target ...string) *Filters
- func (f *Filters) ApplyFilters(filters *Filters) *Filters
- func (f *Filters) ApplyPreset(preset Preset) *Filters
- func (f *Filters) ApplyPresetForDependency(preset Preset, dep *Dependency) *Filters
- func (f *Filters) Clear() *Filters
- func (f *Filters) Clone() *Filters
- type Preset
- type Spec
- type SpecLock
Constants ¶
const VERSION = "v0.4.9"
VERSION of the current tool
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultPreset ¶
type DefaultPreset struct{}
DefaultPreset provides the default configuration for the vendor library.
func (*DefaultPreset) ForceFilters ¶
func (dp *DefaultPreset) ForceFilters() bool
func (*DefaultPreset) GetCacheDir ¶
func (dp *DefaultPreset) GetCacheDir() string
GetCacheDir default implementation tries to return a path under the user home dir. When this operation fails, it resorts back to a temporary dir..
func (*DefaultPreset) GetFilters ¶
func (dp *DefaultPreset) GetFilters() *Filters
func (*DefaultPreset) GetFiltersForDependency ¶
func (dp *DefaultPreset) GetFiltersForDependency(*Dependency) *Filters
func (*DefaultPreset) GetPresetName ¶
func (dp *DefaultPreset) GetPresetName() string
func (*DefaultPreset) GetSpecFilename ¶
func (dp *DefaultPreset) GetSpecFilename() string
func (*DefaultPreset) GetSpecLockFilename ¶
func (dp *DefaultPreset) GetSpecLockFilename() string
func (*DefaultPreset) GetVendorDir ¶
func (dp *DefaultPreset) GetVendorDir() string
type Dependency ¶
type Dependency struct { URL string `yaml:"url"` Branch string `yaml:"branch"` Filters *Filters `yaml:",inline"` }
Dependency holds relevant information related to a dependency that has to be vendored. This model directly maps to the serialized YAML, for dependencies.
func NewDependency ¶
func NewDependency(url, branch string) *Dependency
NewDependency allocates a Dependency, with a default Filters instance.
func (*Dependency) Update ¶
func (d *Dependency) Update(other *Dependency)
Update changes the URL, Branch and Filters fields of the dependency by the fields of another one. This clones the Filters to ensure there's no shared data with the other Dependency.
type DependencyLock ¶
DependencyLock holds relevant information of a dependency that has been locked to a specific commit. This model directly maps to the serialized YAML for locked dependencies.
func NewDependencyLock ¶
func NewDependencyLock(url, commit string) *DependencyLock
NewDependencyLock allocates a new DependencyLock
type Filters ¶
type Filters struct { Extensions []string `yaml:"extensions,omitempty"` Targets []string `yaml:"targets,omitempty"` Ignores []string `yaml:"ignores,omitempty"` }
Filters is a collection type. When vendoring dependencies we look if the file paths are copied or ignored, or whether the extension is supported. Filters are directly serialized into the output YAML.
Filters supposed to make life easier proving a builder pattern so it's convenient to create, but also merge operations with other Filters or even Presets and Dependencies. This is really handy because this tool supports both global customization, and specific granular configurations for each dependency. For this reason, we often need to combine multiple Filters before we're able to vendor a dependency.
func NewFilters ¶
func NewFilters() *Filters
NewFilters allocates a Filters instance with empty lists initialization.
func (*Filters) AddExtension ¶
AddExtension adds one or several extensions to the collection.
func (*Filters) ApplyFilters ¶
ApplyFilters merges the current Filters instance with another one. Because this method combines instances, it stabilizes the results by doing the intersection, but also sorting the entries.
func (*Filters) ApplyPreset ¶
ApplyPreset applies the Filters of a Preset.
func (*Filters) ApplyPresetForDependency ¶ added in v0.4.4
func (f *Filters) ApplyPresetForDependency(preset Preset, dep *Dependency) *Filters
ApplyPresetForDependency applies the filters of a Preset, and a Dependency.
type Preset ¶
type Preset interface { // GetPresetName returns the name for this preset GetPresetName() string // GetVendorDir returns the name for the vendor folder GetVendorDir() string // GetSpecFilename returns the name of the spec file GetSpecFilename() string // GetSpecLockFilename returns the name of the spec lock file GetSpecLockFilename() string // GetFilters returns the global filters of the preset GetFilters() *Filters // GetFiltersForDependency returns the specific filters for a dependency GetFiltersForDependency(*Dependency) *Filters // ForceFilters flag returns whether the preset will force the overriding of // the spec or dependency filters to the preset ones ForceFilters() bool // GetCacheDir returns the path where the repository cache will be kept GetCacheDir() string }
Preset interface used to customize the behavior of the vendor library. It allows customizing anything you need, like the names of the spec and lock file, also allows customizing the targeted and ignored paths.
type Spec ¶
type Spec struct { Version string `yaml:"version"` PresetName string `yaml:"preset"` VendorDir string `yaml:"vendor_dir,omitempty"` Filters *Filters `yaml:",inline"` Deps []*Dependency `yaml:"deps"` // contains filtered or unexported fields }
Spec holds relevant information related to the specification of what versions need to be fetched when updating dependencies.
This model directly maps to the serialized YAML of the spec lock file.
func (*Spec) AddDependency ¶
func (s *Spec) AddDependency(dependency *Dependency)
AddDependency adds a Dependency to the list of dependencies to vendor.
type SpecLock ¶
type SpecLock struct { Version string `yaml:"version"` Deps []*DependencyLock `yaml:"deps"` // contains filtered or unexported fields }
SpecLock holds relevant information related to the specification of what specific versions need to be pinned when vendoring.
This model directly maps to the serialized YAML of the spec lock file.
func NewSpecLock ¶
NewSpecLock allocates a new SpecLock instance with a default initialization.
func (*SpecLock) AddDependencyLock ¶
func (s *SpecLock) AddDependencyLock(lock *DependencyLock)
AddDependencyLock adds a DependencyLock to the list of locked dependencies.
func (*SpecLock) FindByURL ¶ added in v0.3.6
func (s *SpecLock) FindByURL(url string) (*DependencyLock, bool)
FindByURL finds a DependencyLock by URL.