pm

package module
v0.1.1-0...-27168bd Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2015 License: MIT Imports: 13 Imported by: 1

README

pm

A brutally-simple package manager, in the spirit of Kelsey Hightower's pm.

Installation

The latest release of pm is 0.1.0 (codename "Ariel").

Release link

There are .tar.gz files with pre-built binaries at the release link above.

Once you have the package for your operating system and architecture, you can extract the files using tar(1):

$ tar zxvf pm-0.1.0-linux-amd64.tar.gz

After you have extracted the contents from the archive, run:

$ pm/0.1.0/bin/pm install https://github.com/nesv/pm/releases/download/v0.1.0/pm-0.1.0-linux-amd64.tar.gz

If you are installing pm on OS X, replace linux with darwin in the URL, above.

At this point, you can remove the pm directory that was created when you ran tar zxvf ..., because we used the pre-packaged version of pm to install pm. 😄

Installing with go get

While you can install pm using go get gopkg.in/nesv/pm.v0/cmd/pm, I have not yet decided whether or not I like this approach. The benefit of installing pm this way, is that since pm will not be managed by itself, it cannot be uninstalled by running pm remove pm-x.y.z. The only detriment to this approach, that I can currently think of, is that it prevents you from being able to use pm to upgrade itself.

Ultimately, the choice is yours.

Upgrading from a previous release

Downloads for pm will be hosted on GitHub, at the pm releases page. Since pm is packaged with pm for distribution, you can run:

$ pm install https://github.com/nesv/pm/releases/download/VERSION/pm-VERSION-PLATFORM-ARCH.tar.gz

Documentation

Index

Constants

View Source
const PackageFieldSeparator = "-"

Variables

View Source
var FetchSupportedSchemes = []string{"http", "https", "file"}

Functions

func Build

func Build(m *Metadata, outputDir string) error

func CleanUnlinkedPackages

func CleanUnlinkedPackages(baseDir, binDir string) ([]string, error)

CleanUnlinkedPackages removes all of the unpacked archives that do not currently have a symbolic link in binDir targeting a binary within them.

This function will return a list of the names and vesrions of unpacked archives, that were removed, in the format:

name/version

func Fetch

func Fetch(urlStr string) (io.ReadCloser, error)

func Install

func Install(baseDir, pth string) error

Install unpacks the archive at the specified path, to the directory specified by baseDir.

func Link(baseDir, pkg, binDir string) (map[string]string, error)

func ListCachedPackagesSlice

func ListCachedPackagesSlice(cacheDir string) ([]string, error)

func ListLinkedPackages

func ListLinkedPackages(baseDir, binDir string) (map[string]string, error)

ListLinkedPackages returns a map of unpacked archives that currently have symbolic links in binDir targeting the binaries within them.

The returned map holds the format:

map["package_name"] = "package_version"

func ListLinkedPackagesSlice

func ListLinkedPackagesSlice(baseDir, binDir string) ([]string, error)

ListLinkedPackagesSlice is a convenience function that creates a string slice from the map produced by ListLinkedPackages.

func ListUnpackedPackagesSlice

func ListUnpackedPackagesSlice(baseDir string) ([]string, error)
func Unlink(baseDir, binDir, name, version string) ([]string, error)

Unlink removes all of the symbolic links for a package, and returns a string slice of all of the symlinks that were removed.

func Unpack

func Unpack(baseDir string, pkg io.Reader) ([]string, error)

Types

type DirtyLinkError

type DirtyLinkError struct {
	LinkPath, PackageName, Version, WantVersion string
}

func (*DirtyLinkError) Error

func (e *DirtyLinkError) Error() string

type FetchFunc

type FetchFunc func(*url.URL) (io.ReadCloser, error)

type Metadata

type Metadata struct {
	Architecture string              `json:"architecture"`
	Platform     string              `json:"platform"`
	Description  string              `json:"description"`
	Name         string              `json:"name"`
	Maintainer   string              `json:"maintainer"`
	SourceURL    string              `json:"source_url"`
	Resources    map[string][]string `json:"resources"`
	Binaries     []string            `json:"binaries"`
	Version      string              `json:"version"`
	Checksums    []string            `json:"checksums"`
}

func LoadMetadata

func LoadMetadata(pth string) (*Metadata, error)

func (*Metadata) PackageName

func (m *Metadata) PackageName() string

Directories

Path Synopsis
cmd
pm

Jump to

Keyboard shortcuts

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