vendor

package module
v0.0.0-...-5020509 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "0.2.0"

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

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"`
}

func NewDependency

func NewDependency(url, branch string) *Dependency

func (*Dependency) ID

func (d *Dependency) ID() string

func (*Dependency) Update

func (d *Dependency) Update(other *Dependency)

type DependencyLock

type DependencyLock struct {
	URL    string `yaml:"url"`
	Commit string `yaml:"commit"`
}

func NewDependencyLock

func NewDependencyLock(url, commit string) *DependencyLock

type Filters

type Filters struct {
	Extensions []string `yaml:"extensions,omitempty"`
	Targets    []string `yaml:"targets,omitempty"`
	Ignores    []string `yaml:"ignores,omitempty"`
}

func NewFilters

func NewFilters() *Filters

func (*Filters) AddExtension

func (f *Filters) AddExtension(extension ...string) *Filters

func (*Filters) AddIgnore

func (f *Filters) AddIgnore(ignore ...string) *Filters

func (*Filters) AddTarget

func (f *Filters) AddTarget(target ...string) *Filters

func (*Filters) ApplyDep

func (f *Filters) ApplyDep(preset Preset, dep *Dependency) *Filters

func (*Filters) ApplyFilters

func (f *Filters) ApplyFilters(filters *Filters) *Filters

func (*Filters) ApplyPreset

func (f *Filters) ApplyPreset(preset Preset) *Filters

func (*Filters) Clone

func (f *Filters) Clone() *Filters

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 wether 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 behaviour 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
}

func LoadSpec

func LoadSpec(preset Preset) (*Spec, error)

func NewSpec

func NewSpec(preset Preset) *Spec

func (*Spec) AddDependency

func (s *Spec) AddDependency(dependency *Dependency)

func (*Spec) Save

func (s *Spec) Save() error

type SpecLock

type SpecLock struct {
	Version string            `yaml:"version"`
	Deps    []*DependencyLock `yaml:"deps"`
	// contains filtered or unexported fields
}

func LoadSpecLock

func LoadSpecLock(preset Preset) (*SpecLock, error)

func NewSpecLock

func NewSpecLock(preset Preset) *SpecLock

func (*SpecLock) AddDependencyLock

func (s *SpecLock) AddDependencyLock(lock *DependencyLock)

func (*SpecLock) Find

func (s *SpecLock) Find(url string) (*DependencyLock, bool)

func (*SpecLock) Save

func (s *SpecLock) Save() error

Jump to

Keyboard shortcuts

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