env

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Canary              = `_U_`
	RubyRegistryVersion = `1.0.0`
)
View Source
const (
	AppName    = `uru`
	AppVersion = `0.8.0`
)

Variables

View Source
var (
	RbMajMinRegex, SysRbRegex *regexp.Regexp
	KnownRubies               []string

	CanaryToken = fmt.Sprintf("%s%s%s", string(os.PathListSeparator),
		Canary, string(os.PathListSeparator))
)
View Source
var BatWrapper = `` /* 282-byte string literal not displayed */
View Source
var PSWrapper = `` /* 285-byte string literal not displayed */
View Source
var WinBashWrapper = `` /* 315-byte string literal not displayed */

Functions

func CopyFile

func CopyFile(dst, src string) (written int64, err error)

CopyFile copies a source file to a destination file.

func CreateSwitcherScript

func CreateSwitcherScript(ctx *Context, path *[]string, gemHome string) (scriptName string, err error)

CreateSwitcherScript creates an environment switcher script customized to the type of shell calling the uru runtime.

func NewTag

func NewTag(ctx *Context, rb Ruby) (tag string, err error)

NewTag generates a new tag value used to identify a specific ruby.

func PathListForTag

func PathListForTag(ctx *Context, tag string) (path []string, err error)

PathListForTag returns a PATH list appropriate for a given ruby tag.

func SelectRubyFromList

func SelectRubyFromList(tags RubyMap, label, verb string) (tag string, err error)

SelectRubyFromList presents a list of registered rubies and asks the user to select one. It returns the identifying tag for the selected ruby, or an error if unable to get the users selection.

func SortTagsByTagLabel

func SortTagsByTagLabel(rubyMap *RubyMap) (tags []string, err error)

SortTagsByTagLabel returns a string slice of tags sorted by tag label.

func UIYesConfirm

func UIYesConfirm(prompt string) (resp string, err error)

UIYesConfirm asks the user a question and returns Y or N with Y being the default.

Types

type Context

type Context struct {
	Registry RubyRegistry
	// contains filtered or unexported fields
}

func NewContext

func NewContext() *Context

func (*Context) Cmd

func (c *Context) Cmd() string

func (*Context) CmdArgs

func (c *Context) CmdArgs() []string

func (*Context) Home

func (c *Context) Home() string

func (*Context) SetCmd

func (c *Context) SetCmd(cmd string)

func (*Context) SetCmdAndArgs

func (c *Context) SetCmdAndArgs(cmd string, args []string)

func (*Context) SetCmdArgs

func (c *Context) SetCmdArgs(args []string)

func (*Context) SetHome

func (c *Context) SetHome(h string)

type MarshalFunc

type MarshalFunc func(ctx *Context) error

type Ruby

type Ruby struct {
	ID          string // ruby version including patch number
	TagLabel    string // user friendly ruby tag value
	Exe         string // ruby executable name
	Home        string // full path to ruby executable directory
	GemHome     string // full path to a ruby's gem home directory
	Description string // full ruby description
}

func CurrentRubyInfo

func CurrentRubyInfo(ctx *Context) (tag string, info Ruby, err error)

CurrentRubyInfo returns the identifying tag and metadata information for the ruby currently in use.

func RubyInfo

func RubyInfo(ctx *Context, ruby string) (tag string, info Ruby, err error)

RubyInfo returns an identifying tag and metadata information about a specific ruby. It accepts a string of either the simple name of the ruby executable, or the ruby executables absolute path.

type RubyMap

type RubyMap map[string]Ruby

func TagLabelToTag

func TagLabelToTag(ctx *Context, label string) (tags RubyMap, err error)

TagLabelToTag returns a map of registered ruby tags whose TagLabel's match that of the specified tag label string.

type RubyRegistry

type RubyRegistry struct {
	Version string
	Rubies  RubyMap
	// contains filtered or unexported fields
}

func (*RubyRegistry) Marshal

func (rr *RubyRegistry) Marshal(ctx *Context) (err error)

Jump to

Keyboard shortcuts

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