index

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2016 License: MIT Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type EmptyLibraryError

type EmptyLibraryError struct {
	Name string
}

func (EmptyLibraryError) Error

func (e EmptyLibraryError) Error() string

type GroupedIndex added in v0.8.0

type GroupedIndex struct {
	Libraries map[string]LibList
}

func (GroupedIndex) Selected added in v0.8.0

func (g GroupedIndex) Selected() *Index

Return and index that has no "extra" libraries in it, only the ones that can possibly be chosen.

func (GroupedIndex) SortByRating added in v0.8.0

func (g GroupedIndex) SortByRating() GroupedIndex

This sorts **all but the first** match by rating. This is because the first match is the one that is first in the install path so it should always be listed first. Among those not in the search path, this rearranges them by rating.

type Index

type Index struct {
	Version   string     `json:"version"`
	Libraries []*Library `json:"libraries"`
}

func LoadIndex

func LoadIndex(verbose bool) (*Index, error)

func NewIndex

func NewIndex() *Index

func (*Index) BuildGraph

func (ind *Index) BuildGraph(verbose bool) (graph.Resolver, error)

func (Index) Find

func (i Index) Find(name string, version semver.Version) (VersionDetails, error)

func (*Index) GetLibrary

func (i *Index) GetLibrary(name string, uri string, owner_uri string) recorder.LibraryRecorder

func (Index) Group added in v0.8.0

func (i Index) Group(disamb map[string]string) GroupedIndex

func (Index) JSON

func (i Index) JSON() (string, error)

func (*Index) Merge

func (i1 *Index) Merge(i2 Index) error

This function merges two indices. The libraries from i2 will be appended to the list from i1.

func (*Index) ParseIndex

func (index *Index) ParseIndex(index_url string) error

The ParseIndex function reads index information from a given URL and then merges it into the associated index.

TODO: This will eventually need to be able to handle different index versions (by parsing the Version field in the index first and then determining how, or if, to parse it).

func (Index) Reduce added in v0.8.0

func (i Index) Reduce(disamb map[string]string) *Index

type LibList added in v0.8.0

type LibList []*Library

func (LibList) Len added in v0.8.0

func (l LibList) Len() int

func (LibList) Less added in v0.8.0

func (l LibList) Less(i int, j int) bool

func (LibList) Swap added in v0.8.0

func (l LibList) Swap(i int, j int)

type Library

type Library struct {
	// Library name
	Name string `json:"name"`
	// Canonical URI for this library (used for disambiguation)
	URI string `json:"uri"`

	// Versions of this library that are available
	Versions map[string]*VersionDetails `json:"versions"`

	// Owner of library
	OwnerURI string `json:"owner_uri"`
	// Email for library contact
	Email string `json:"email"`
	// Web site
	Homepage string `json:"homepage"`
	// Repository
	Repository string `json:"repository_uri"`
	// Repository format
	Format string `json:"repository_format"`
	// Textual description
	Description string `json:"description"`
	// Stars (if applicable, otherwise -1)
	Stars int `json:"stars"`
}

func NewLibrary

func NewLibrary(name string, uri string, owner_uri string) *Library

func (*Library) AddVersion

func (lib *Library) AddVersion(v semver.Version) recorder.VersionRecorder

func (Library) Matches

func (lib Library) Matches(term string) bool

func (*Library) SetDescription

func (lib *Library) SetDescription(desc string)

func (*Library) SetEmail

func (lib *Library) SetEmail(email string)

func (*Library) SetHomepage

func (lib *Library) SetHomepage(url string)

func (*Library) SetRepository

func (lib *Library) SetRepository(url string, format string)

func (*Library) SetStars

func (lib *Library) SetStars(stars int)

type MissingLibraryError

type MissingLibraryError struct {
	Name string
}

func (MissingLibraryError) Error

func (e MissingLibraryError) Error() string

type MissingVersionError

type MissingVersionError struct {
	Name    string
	Version string
}

func (MissingVersionError) Error

func (e MissingVersionError) Error() string

type VersionConflictError

type VersionConflictError struct {
	Name       string
	Existing   VersionDetails
	Additional VersionDetails
}

func (VersionConflictError) Error

func (e VersionConflictError) Error() string

type VersionDetails

type VersionDetails struct {
	Version semver.Version `json:"version"`
	Tarball string         `json:"tarball_url"`
	Zipball string         `json:"zipball_url"`

	// This indicates where (within an archive) the library can be found:
	Path string `json:"path"`
	// This indicates whether the specified path is to a file or directory:
	IsFile bool `json:"isfile"`

	Dependencies []Dependency `json:"dependencies"`
	Sha          string       `json:"sha"`
}

func NewVersionDetails

func NewVersionDetails(v semver.Version) *VersionDetails

func (*VersionDetails) AddDependency

func (v *VersionDetails) AddDependency(library string, version semver.Version)

func (*VersionDetails) SetHash

func (v *VersionDetails) SetHash(hash string)

func (*VersionDetails) SetPath

func (v *VersionDetails) SetPath(path string, file bool)

func (*VersionDetails) SetTarballURL

func (v *VersionDetails) SetTarballURL(url string)

func (*VersionDetails) SetZipballURL

func (v *VersionDetails) SetZipballURL(url string)

Jump to

Keyboard shortcuts

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