Documentation
¶
Index ¶
- Constants
- Variables
- func CheckCacheFile(name string) (string, bool, error)
- func CheckForHelperTools(lang string)
- func FindPackageInDir(pkg interface{}, dir string) error
- func InstallPath(env, relpath string, global bool) (string, error)
- func IsErrAlreadyInstalled(err error) bool
- func IsHash(s string) bool
- func LoadPackage(out interface{}, env, hash string) error
- func LoadPackageFile(pkg interface{}, fname string) error
- func LocalPackageByName(dir, name string, out interface{}) error
- func NewShell() *sh.Shell
- func PackageNameInDir(dir string) (string, error)
- func SavePackageFile(pkg interface{}, fname string) error
- func TryRunHook(hook, env string, args ...string) error
- func WriteConfig(cfg *Config, file string) error
- type Config
- type Dependency
- type ErrAlreadyInstalled
- type PM
- func (pm *PM) EnumerateDependencies(pkg *Package) (map[string]struct{}, error)
- func (pm *PM) FetchRepo(rpath string, usecache bool) (map[string]string, error)
- func (pm *PM) GetPackageTo(hash, out string) (*Package, error)
- func (pm *PM) ImportPackage(dir, dephash string) (*Dependency, error)
- func (pm *PM) InitPkg(dir, name, lang string, setup func(*Package)) error
- func (pm *PM) InstallDeps(pkg *Package, location string) error
- func (pm *PM) InstallPackage(hash, location string) (*Package, error)
- func (pm *PM) PublishPackage(dir string, pkg *PackageBase) (string, error)
- func (pm *PM) QueryRepos(query string) (map[string]string, error)
- func (pm *PM) ResolveDepName(name string) (string, error)
- func (pm *PM) ResolveName(name string, usecache bool) (string, error)
- func (pm *PM) Shell() *sh.Shell
- type Package
- type PackageBase
- type User
Constants ¶
View Source
const CfgFileName = ".gxrc"
View Source
const PkgFileName = "package.json"
Variables ¶
View Source
var ErrNotFound = errors.New("cache miss")
View Source
var ErrUnrecognizedName = fmt.Errorf("unrecognized package name")
Functions ¶
func CheckCacheFile ¶
func CheckCacheFile(name string) (string, bool, error)
func CheckForHelperTools ¶
func CheckForHelperTools(lang string)
func FindPackageInDir ¶
func FindPackageInDir(pkg interface{}, dir string) error
func InstallPath ¶
func InstallPath(env, relpath string, global bool) (string, error)
func IsErrAlreadyInstalled ¶
func IsErrAlreadyInstalled(err error) bool
func LoadPackage ¶
func LoadPackage(out interface{}, env, hash string) error
func LoadPackageFile ¶
func LoadPackageFile(pkg interface{}, fname string) error
func LocalPackageByName ¶
func LocalPackageByName(dir, name string, out interface{}) error
func PackageNameInDir ¶
func PackageNameInDir(dir string) (string, error)
func SavePackageFile ¶
func SavePackageFile(pkg interface{}, fname string) error
func TryRunHook ¶
func TryRunHook(hook, env string, args ...string) error
func WriteConfig ¶
func WriteConfig(cfg *Config, file string) error
Types ¶
type Config ¶
type Config struct {
Repos map[string]string `json:"repos,omitempty"`
ExtraRepos map[string]string `json:"extra_repos,omitempty"`
User User `json:"user,omitempty"`
}
func LoadConfig ¶
func LoadConfig() (*Config, error)
func LoadConfigFrom ¶
func LoadConfigFrom(paths ...string) (*Config, error)
type Dependency ¶
type Dependency struct {
Author string `json:"author,omitempty"`
Name string `json:"name,omitempty"`
Hash string `json:"hash"`
Version string `json:"version,omitempty"`
}
Dependency represents a dependency of a package
type ErrAlreadyInstalled ¶
type ErrAlreadyInstalled struct {
// contains filtered or unexported fields
}
type PM ¶
type PM struct {
// contains filtered or unexported fields
}
func (*PM) EnumerateDependencies ¶
func (pm *PM) EnumerateDependencies(pkg *Package) (map[string]struct{}, error)
func (*PM) FetchRepo ¶
func (pm *PM) FetchRepo(rpath string, usecache bool) (map[string]string, error)
func (*PM) GetPackageTo ¶
func (pm *PM) GetPackageTo(hash, out string) (*Package, error)
func (*PM) ImportPackage ¶
func (pm *PM) ImportPackage(dir, dephash string) (*Dependency, error)
ImportPackage downloads the package specified by dephash into the package in the directory 'dir'
func (*PM) InstallDeps ¶
func (pm *PM) InstallDeps(pkg *Package, location string) error
InstallDeps recursively installs all dependencies for the given package
func (*PM) InstallPackage ¶
func (pm *PM) InstallPackage(hash, location string) (*Package, error)
func (*PM) PublishPackage ¶
func (pm *PM) PublishPackage(dir string, pkg *PackageBase) (string, error)
func (*PM) QueryRepos ¶
func (pm *PM) QueryRepos(query string) (map[string]string, error)
func (*PM) ResolveDepName ¶
func (pm *PM) ResolveDepName(name string) (string, error)
ResolveDepName resolves a given package name to a hash using configured repos as a mapping.
func (*PM) ResolveName ¶
func (pm *PM) ResolveName(name string, usecache bool) (string, error)
TODO: once on ipfs 0.4.0, use the files api
type PackageBase ¶
type PackageBase struct {
Name string `json:"name,omitempty"`
Author string `json:"author,omitempty"`
Description string `json:"description,omitempty"`
Keywords string `json:"keywords,omitempty"`
Version string `json:"version,omitempty"`
Dependencies []*Dependency `json:"gxDependencies,omitempty"`
Bin string `json:"bin,omitempty"`
Build string `json:"build,omitempty"`
Test string `json:"test,omitempty"`
Language string `json:"language,omitempty"`
Copyright string `json:"copyright,omitempty"`
Issues string `json:"issues_url"`
}
func (*PackageBase) ForEachDep ¶
func (pkg *PackageBase) ForEachDep(cb func(dep *Dependency, pkg *Package) error) error
Click to show internal directories.
Click to hide internal directories.