mod

package
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Copyright © 2021 Loft Orbital

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var CuePrivatePattern string = os.Getenv("CUEPRIVATE")

CuePrivatePattern extracts the pattern to find private module from CUEPRIVATE environment variable.

Functions

func BillyCopy

func BillyCopy(dstFS, srcFS billy.Filesystem) error

BillyCopy copy srcFS into dstFS billy filesystems.

func CacheDir

func CacheDir() (billy.Filesystem, error)

CacheDir returns the cuebe cache directory (~/.cache/cuebe).

func CacheLoad

func CacheLoad(m module.Version) (billy.Filesystem, error)

CacheLoad retrieve the module's filesystem from the cache. This filesystem can be empty (os.ErrNotExist).

func CacheStore

func CacheStore(m module.Version, fs billy.Filesystem) (billy.Filesystem, error)

CacheStore store a module filesystem to the global cache. It returns the cached filesystem.

func CredentialsFor

func CredentialsFor(host string) (usr, pwd string)

CredentialsFor gets the user and password credentials for host. First looking at <HOST_DOMAIN>_TOKEN and <HOST_DOMAIN>_USER env var and fallbacking to netrc if they are not set.

func Download

func Download(mod module.Version, fs billy.Filesystem) error

Download clone and store repository worktree into fs.

func GetFS

func GetFS(mod module.Version) (billy.Filesystem, error)

GetFS returns the cached filesystem for mod. If the module is not yet cached, it will be first downloaded and then cached.

func GetReqs

func GetReqs(fs billy.Filesystem) ([]module.Version, error)

GetReqs returns the dependencies of a CUE module located in fs.

func IsPrivate

func IsPrivate(mod string) bool

IsPrivate returns true if mod is a private module.

func MatchPrefixPatterns

func MatchPrefixPatterns(globs, target string) bool

MatchPrefixPatterns reports whether any path prefix of target matches one of the glob patterns (as defined by path.Match) in the comma-separated globs list. This implements the algorithm used when matching a module path to the GOPRIVATE environment variable, as described by 'go help module-private'.

It ignores any empty or malformed patterns in the list.

func NetrcMachines

func NetrcMachines() map[string]NetrcMachine

Types

type Credentials

type Credentials struct {
	User  string
	Token string
}

Credentials represents the credentials required to get a module.

type Meta

type Meta struct {
	// VCS represents the VCS type of a module (git, svn, etc..)
	VCS string
	// RepoURL represents the clone url of a module.
	RepoURL     string
	RootPath    string
	Credentials *Credentials
}

Meta represents a module meta

func GetMeta

func GetMeta(mod module.Version) (*Meta, error)

GetMeta retrieves the metadata of a module. It follows go way of resolving repo from module Path described [here](https://go.dev/ref/mod#vcs-find).

type ModReqs

type ModReqs struct {
	// Root module path
	Root string
	// Root module requirements
	RootReqs []module.Version
}

ModReqs implements the Reqs interface. The Compare function uses semver.Compare.

func (ModReqs) Compare

func (mr ModReqs) Compare(v, w string) int

func (ModReqs) Required

func (mr ModReqs) Required(m module.Version) ([]module.Version, error)

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module represents a CUE module

func New

func New(dir string) (*Module, error)

New creates a new Module from dir. dir has to contain the cue.mod/module.cue file.

func (*Module) Vendor

func (m *Module) Vendor() error

Vendor uses MVS algorithm to compute all requirements and vendor them in the cue.mod/pkg directory.

type NetrcMachine

type NetrcMachine struct {
	Login    string
	Password string
}

func NetrcCredentials

func NetrcCredentials(machine string) (NetrcMachine, error)

Jump to

Keyboard shortcuts

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