Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone( url string, userName string, password string, version string, tag string, src string, dst string, ) ( err error, )
Clone clones a git repository in a given folder
- Dst folder is created if not exist. BE CAREFUL: dst folder is removed before git-clone.
- Src folder is optional, and means that we only are interested in that directory from git repository.
- tag is optional, and means that we only are interested in that tag. Tag parameter take precedence over version parameter.
- Version is optional, and is its interpretation depends on the case:
- If exists a tag==version, then that tag (its reference) is used
- If not exists a tag==version, but exists a directory==version, then that directory is used
Parameters src, tag, version (tag type), version (dir type) may overlap, if all of them have value. They should be interpreted as follows:
├── tag<>"" │ ├─ src<>"" ==> use that tag and src directory. ver_dir/ver_ref is ignored │ └─ src!="" ==> use that tag and root directory. ver_dir/ver_ref is ignored │ └── tag==""
├─ ver_ref<>"" │ ├─ src<>"" ==> use that ver_ref commit │ └─ src=="" ==> use that ver_ref commit and src directory └─ ver_ref=="" ├─ src<>"" ==> use master commmit and src directory. └─ src=="" ├─ ver_dir<>"" ==> use master commit and ver_dir directory └─ ver_dir=="" ==> use master commit
Types ¶
type CUEModule ¶
type CUEModule struct { Name string `json:"module"` // Its a versioner name (not mandatory) Dependencies map[string]*Dependency `json:"dependencies,omitempty"` // Key is dependency name Resolved bool }
CUEModule ...
func NewCUEModuleFromFile ¶
NewCUEModuleFromFile reads a module.cue file, and extracts dependencies info.
For example:
module: "mycompany.com/mymodule/v1.0.0" // This line is ignored by cue-dependencies-manager // Comments are allowed (this is a CUE file, not a JSON) credentials: { mycredentials: { token: "mytoken", type: "token", username: "myuser" } } dependencies: { "mydependency.com/things": { // Name of dependency version: "v1.2.3", // Optional. Default: no version repository: "https://gitlab.com/myrepository/things" credentials: "mycredentials" // Optional. Default: no credentials required srcpath: "v1.2.3" // Optional. // Default="v1.2.3", if directory "v1.2.3" exists within the repo // Default="/", if directory "v1.2.3" not exists within the repo tag: "mycommit" // Optional. // Default="master". // Can be setted with the commit/tag of an specific version dstpath: "mydependency.com/things/v1.2.3" // Optional. Default value is <name>/<version> }, "otherdependency.com/thongs": { repository: "https://gitlab.com/otherrepository/thongs" } }
type Context ¶
type Context struct { Src string // Src = main cue module Dst string // Dst = src/cue.mod/pkg CUEModules map[string]*CUEModule // key map is the versioned name of module }
Context keeps track the status of a resolution operation (which dependency are resolved and which are not yet)
func Resolve ¶
Resolve function resolves dependencies detected in src directory. All dependencies are stored (flatted) in src/cue.mod/pkg directory Returns a context keeping track of all resolution operations
func (*Context) AddCUEModule ¶
AddCUEModule adds a new CUE module to the context
func (*Context) DependencyResolved ¶
DependencyResolved checks if a dependency has been resolved previously
type Credentials ¶
type Credentials struct { Type string `json:"type"` // "password" or "token" Username string `json:"username"` Password *string `json:"password,omitempty"` Token *string `json:"token,omitempty"` }
Credentials ...
func (*Credentials) GetPasswordOrToken ¶
func (c *Credentials) GetPasswordOrToken() string
GetPasswordOrToken return token or password, depending on type of credentials
type Dependency ¶
type Dependency struct { Name string Version *string `json:"version,omitempty"` VersionedName string // VersionedName = name/version Repository string `json:"repository"` Credentials *Credentials `json:"credentials,omitempty"` SrcPath *string `json:"srcpath,omitempty"` Tag *string `json:"tag,omitempty"` DstPath *string `json:"dstpath,omitempty"` Resolved bool }
Dependency ...