repositories

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RegistryFileName  = "kableconfig.json"
	RepoIndexFileName = "kable.json"
	KableDirName      = ".kable"
	CacheDirName      = "cache"

	RepositoryIdentifierRegex = "^([a-z\\-]+)$"
)
View Source
const (
	StoreKey                       = "store"
	StoreTypeKey                   = "type"
	StoreConfigKey                 = "config"
	LocalStoreType StoreConfigType = "local"
	EtcdStoreType  StoreConfigType = "etcd"
	MockStoreType  StoreConfigType = "_mock"
)
View Source
const EtcdRegistryKey = "/kable/registry"

Variables

View Source
var Authstring = `{
	username: "testuser",
	password: "testpass",
}`
View Source
var DemoAuths = Auths{
	trimUrl(DemoHttpsUrl): Auth{
		Basic: base64.StdEncoding.EncodeToString([]byte(Authstring)),
	},
}
View Source
var DemoHttpsRepository = Repository{
	GitRepository: GitRepository{
		URL:    trimUrl(DemoHttpsUrl),
		GitRef: masterGitRef,
	},
	Name: "demo-https",
}
View Source
var DemoHttpsUrl = "https://github.com/redradrat/kable.git"
View Source
var DemoRegistry = RepoRegistry{
	Repositories: DemoRepositories,
	Auths:        DemoAuths,
}
View Source
var DemoSshRepository = Repository{
	GitRepository: GitRepository{
		URL:    trimUrl(DemoSshUrl),
		GitRef: masterGitRef,
	},
	Name: "demo-ssh",
}
View Source
var DemoSshUrl = "git@github.com:redradrat/kable.git"
View Source
var IsValidRepositoryName = regexp.MustCompile(RepositoryIdentifierRegex).MatchString
View Source
var KableDir = filepath.Join(homeDir(), KableDirName)

Functions

func RepoAuthExists added in v0.5.0

func RepoAuthExists(url string) (bool, error)

func TidyCache added in v0.4.0

func TidyCache() error

func UpdateRegistry added in v0.4.0

func UpdateRegistry(updates ...RegistryModification) error

func UpdateRepositories

func UpdateRepositories() error

Types

type Auth added in v0.5.0

type Auth struct {
	Basic string `json:"basic,omitempty"`
}

type AuthPair added in v0.4.0

type AuthPair struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Auths added in v0.5.0

type Auths map[string]Auth

type EtcdStore added in v0.6.0

type EtcdStore struct {
	clientv3.Config
	Timeout time.Duration
}

func (EtcdStore) ReadRegistry added in v0.6.0

func (e EtcdStore) ReadRegistry() (*RepoRegistry, error)

func (EtcdStore) WriteRegistry added in v0.6.0

func (e EtcdStore) WriteRegistry(registry RepoRegistry) error

type GitRepository added in v0.4.0

type GitRepository struct {
	URL    string `json:"url"`
	GitRef string `json:"gitRef"`
}

type LocalStore added in v0.6.0

type LocalStore struct{}

func (LocalStore) ReadRegistry added in v0.6.0

func (l LocalStore) ReadRegistry() (*RepoRegistry, error)

func (LocalStore) WriteRegistry added in v0.6.0

func (l LocalStore) WriteRegistry(registry RepoRegistry) error

type MockStore added in v0.6.1

type MockStore struct{}

func (MockStore) ReadRegistry added in v0.6.1

func (m MockStore) ReadRegistry() (*RepoRegistry, error)

func (MockStore) WriteRegistry added in v0.6.1

func (m MockStore) WriteRegistry(registry RepoRegistry) error

type RegistryModification added in v0.4.0

type RegistryModification func(RepoRegistry) RepoRegistry

func AddRepository

func AddRepository(repo Repository) (RegistryModification, error)

func RemoveRepository

func RemoveRepository(name string) (RegistryModification, error)

func StoreRepoAuth added in v0.4.0

func StoreRepoAuth(url string, pair AuthPair) (RegistryModification, error)

type RepoIndex

type RepoIndex struct {
	Version        int      `json:"version"`
	ConceptEntries []string `json:"concepts"`
}

type RepoRegistry added in v0.4.0

type RepoRegistry struct {
	Repositories Repositories `json:"repositories"`
	Auths        Auths        `json:"auths,omitempty"`
}

func Registry added in v0.4.0

func Registry() (*RepoRegistry, error)

func (RepoRegistry) String added in v0.6.0

func (registry RepoRegistry) String() string

type Repositories added in v0.4.0

type Repositories map[string]Repository

func (Repositories) List added in v0.4.0

func (repos Repositories) List() []Repository

type Repository added in v0.4.0

type Repository struct {
	GitRepository
	Name string `json:"name"`
}

func GetRepository added in v0.4.0

func GetRepository(name string) (Repository, error)

func ListRepositories

func ListRepositories() ([]Repository, error)

func (Repository) AbsolutePath added in v0.4.0

func (r Repository) AbsolutePath() (string, error)

func (Repository) RepoIndex added in v0.4.0

func (r Repository) RepoIndex() (*RepoIndex, error)

type Store added in v0.6.0

type Store interface {
	WriteRegistry(registry RepoRegistry) error
	ReadRegistry() (*RepoRegistry, error)
}

func GetStoreFromConfig added in v0.6.0

func GetStoreFromConfig() (Store, error)

type StoreConfigMap added in v0.6.0

type StoreConfigMap map[string]interface{}

func EtcdStoreConfigMap added in v0.6.0

func EtcdStoreConfigMap(endpoints []string, timeout time.Duration) StoreConfigMap

EtcdStoreConfigMap returns a config for Etcd with given endpoints and timeout in milliseconds

func LocalStoreConfigMap added in v0.6.0

func LocalStoreConfigMap() StoreConfigMap

func MockStoreConfigMap added in v0.6.1

func MockStoreConfigMap() StoreConfigMap

func (StoreConfigMap) GetStore added in v0.6.0

func (cm StoreConfigMap) GetStore() (Store, error)

func (StoreConfigMap) Map added in v0.6.0

func (cm StoreConfigMap) Map() map[string]interface{}

type StoreConfigType added in v0.6.0

type StoreConfigType string

func (StoreConfigType) String added in v0.6.0

func (t StoreConfigType) String() string

Jump to

Keyboard shortcuts

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