Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(dst, src string) (written int64, err error)
- func CreateSwitcherScript(ctx *Context, path *[]string, gemHome string) (scriptName string, err error)
- func DelUruChunk(uruChunk, basePath string) (cleanPath []string)
- func GetUruChunk(path string) (string, bool)
- func NewTag(ctx *Context, rb Ruby) (tagHash string, err error)
- func PathListForTagHash(ctx *Context, tagHash string) (newPath []string, err error)
- func SelectRubyFromList(tags RubyMap, label, verb string) (tagHash string, err error)
- func SortTagsByTagLabel(rubyMap *RubyMap) (sortedTagHashes []string, err error)
- func UIYesConfirm(prompt string) (resp string, err error)
- type Context
- type MarshalFunc
- type Ruby
- type RubyMap
- type RubyRegistry
Constants ¶
const ( AppName = `uru` AppVersion = `0.8.5` )
const (
RubyRegistryVersion = `1.0.0`
)
Variables ¶
var (
RbMajMinRegex, SysRbRegex *regexp.Regexp
KnownRubies []string
)
var BashWrapper = `` /* 301-byte string literal not displayed */
var FishWrapper = `` /* 317-byte string literal not displayed */
Functions ¶
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 DelUruChunk ¶ added in v0.8.1
DelUruChunk returns a PATH string list purged of the uru chunk described in GetUruChunk. This func assumes the provided base PATH string contains a valid uru chunk.
func GetUruChunk ¶ added in v0.8.1
GetUruChunk analyzes a PATH string and returns everything between uru's two canaries, inclusive, and a success/failure indicator. The uru chunk string is returned upon success, and an empty string is returned upon failure to find a valid uru chunk.
A uru enhanced PATH containing the uru chunk looks like
[USER_PREFIX];canary[0];[GEM_HOME_BIN_DIR];RUBY_BIN_DIR;canary[1];... (Windows) -or- [USER_PREFIX]:canary[0]:[GEM_HOME_BIN_DIR]:RUBY_BIN_DIR:canary[1]:... (Linux, OSX)
where the GEM_HOME_BIN_DIR and USER_PREFIX elements are optional. USER_PREFIX can be zero or more PATH components added by the user after the user activates a registered ruby with uru.
The uru chunk attempts to sandbox uru's PATH infection tactics. It has the following format
canary[0]:[GEM_HOME_BIN_DIR]:RUBY_BIN_DIR:canary[1]
For example
_U1_:/home/foo/.gem/ruby/2.2.0/bin:/home/foo/.rubies/ruby-2.2/bin:_U2_
The uru chunk enables uru to modify the PATH in a more controllable way while minimizing the number of scenarios where uru clobbers user PATH mods made after using uru to activate a registered ruby.
func PathListForTagHash ¶ added in v0.8.1
PathListForTagHash returns a PATH list appropriate for a given registered ruby's tag hash. A tag hash is an uru internal indentifier used for indexing a user's registered rubies.
func SelectRubyFromList ¶
SelectRubyFromList presents a list of registered rubies and asks the user to select one. It returns the internal identifying tag hash for the selected ruby, or an error if unable to get the users selection.
func SortTagsByTagLabel ¶
SortTagsByTagLabel returns a string slice of tag hashes sorted by tag label.
func UIYesConfirm ¶
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) SetCmdAndArgs ¶
func (*Context) SetCmdArgs ¶
type MarshalFunc ¶
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 ¶
CurrentRubyInfo returns the internal identifying tag hash and metadata info for the currently activated, registered ruby.
type RubyMap ¶
The string uru uses to identify a particular Ruby is known as the ruby's "tag hash". The tag hash is a non-user, internal token generated when the user registers a ruby with uru.
func TagLabelToTag ¶
TagLabelToTag returns a map of registered ruby tags whose TagLabel's match that of the specified tag label string.
TODO review for refactoring with VersionFragmentToTag
func VersionFragmentToTag ¶ added in v0.8.5
VersionFragmentToTag returns a map of registered ruby tag's whose TagLabel or Description fields fuzzy that match the given version fragment string.
VersionFragmentToTag is less strict than its related TagLabelToTag function in that it fuzzy matches first against TagLabel and then against Description.
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)