urls

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloner

type Cloner interface {
	Clone(url *URL, depth int, fs billy.Filesystem) error
}

Cloner defines how classes should clone repositories.

func NewCloner

func NewCloner() Cloner

NewCloner encapsulates the functionality for creating the default cloner. The default cloner maintains a route table that uses the url info to map to the appropriate cloner.

type FileSystemAdapter

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

FileSystemAdapter maintains two caches. One is a cache for the root filesystems. The other was intended to be a cache that was periodically pruned.

func NewFileSystemAdapter

func NewFileSystemAdapter(cfg *config.CloneConfiguration) *FileSystemAdapter

NewFileSystemAdapter create a new FileSystemAdapter from the provided configuration. This method encapsulates creation of some caches.

func (*FileSystemAdapter) Clone

func (fsa *FileSystemAdapter) Clone(url *URL) (billy.Filesystem, error)

Clone accepts a url and clones it to an underlying filesystem.

func (*FileSystemAdapter) Resolve

func (fsa *FileSystemAdapter) Resolve(url string) (string, string, int32, error)

Resolve determines which bucket the url falls into. This function contains business logic around the configuration and is exposed for unit testing purposes.

type URL

type URL struct {
	VCS
	URL *url.URL
}

URL defines the address where a repository is located.

func ParseURL

func ParseURL(urlString string) (*URL, error)

ParseURL accepts a url string and parses it into a well structured url.

git: git@<<HOST>>:<<PATH>>.git https://<<HOST>><<PATH>>.git http://<<HOST>><<PATH>>.git

svn: svn://<<HOST>><<PATH>> svn+ssh://<<HOST>>/<PATH>

hg: local/filesystem/path[#revision] file://local/filesystem/path[#revision] http://[user[:pass]@]host[:port]/path[#revision] https://[user[:pass]@]host[:port]/path[#revision] ssh://[user@]host[:port]/path[#revision]

func (*URL) String

func (u *URL) String() string

type VCS

type VCS = string

VCS defines the version control system used to manage the repo.

const (
	// GIT defines the constant used to represent the `git` version control system.
	GIT VCS = "git"
	// SVN defines the constant used to represent the `svn` version control system.
	SVN VCS = "svn"
	// MERCURIAL defines the constant used to represent the `hg` version control system.
	MERCURIAL VCS = "hg"
)

Jump to

Keyboard shortcuts

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