Documentation ¶
Index ¶
- Constants
- func AbsJoin(baseDir, suffixPath string) (string, error)
- func AskYesNo(question string) bool
- func CaptureCommand(cmd *exec.Cmd) (string, int, error)
- func CheckForRigUpdate(curRigVersion string) string
- func ContainerRunning(name string) bool
- func EscalatePrivilege() error
- func FileExists(pathToFile, workingDir string) bool
- func ForceStreamCommand(path string, arg ...string) error
- func GetBridgeIP() (string, error)
- func GetCurrentDockerVersion() *version.Version
- func GetDockerClientAPIVersion() *version.Version
- func GetDockerServerAPIVersion() (*version.Version, error)
- func GetDockerServerMinAPIVersion() (*version.Version, error)
- func GetExecutableDir() (string, error)
- func GetRawCurrentDockerVersion() string
- func GetUnisonMinorVersion() string
- func ImageOlderThan(image string, elapsedSeconds float64) (bool, float64, error)
- func IndexOfString(slice []string, search string) (int, bool)
- func IndexOfSubstring(slice []string, search string) (int, bool)
- func IsLinux() bool
- func IsMac() bool
- func IsWindows() bool
- func LoggerInit(verbose bool)
- func NotifyError(ctx *cli.Context, message string) error
- func NotifyInit(label string) error
- func NotifySuccess(ctx *cli.Context, message string)
- func PassthruCommand(cmd *exec.Cmd) (exitCode int)
- func PrintDebugHelp(message, errorName string, exitCode int)
- func RemoveFile(pathToFile, workingDir string) error
- func RemoveFileGlob(glob, targetDirectory string, logger *RigLogger) error
- func StreamCommand(path string, arg ...string) error
- func StringPad(s string, pad string, size int) string
- func SupportsNativeDocker() bool
- func TouchFile(pathToFile string, workingDir string) error
- type Executor
- func (x Executor) CombinedOutput() ([]byte, error)
- func (x Executor) Execute(forceOutput bool) error
- func (x Executor) IsPrivileged() bool
- func (x Executor) Log(tag string)
- func (x Executor) Output() ([]byte, error)
- func (x Executor) Run() error
- func (x Executor) Start() error
- func (x Executor) String() string
- type NotifyConfig
- type RigLogger
- func (log *RigLogger) Error(format string, a ...interface{})
- func (log *RigLogger) Info(format string, a ...interface{})
- func (log *RigLogger) NoSpin()
- func (log *RigLogger) Note(format string, a ...interface{})
- func (log *RigLogger) PrivilegeEscalationPrompt()
- func (log *RigLogger) SetVerbose(verbose bool)
- func (log *RigLogger) Spin(message string)
- func (log *RigLogger) SpinWithVerbose(message string, a ...interface{})
- func (log *RigLogger) Verbose(format string, a ...interface{})
- func (log *RigLogger) Warn(format string, a ...interface{})
- func (log *RigLogger) Warning(format string, a ...interface{})
- type RigSpinner
Constants ¶
const ( Xhyve = "xhyve" VMWare = "vmwarefusion" VirtualBox = "virtualbox" )
Constants for virtualization drivers
Variables ¶
This section is empty.
Functions ¶
func AskYesNo ¶
AskYesNo asks the user a yes/no question Return true if they answered yes, false otherwise
func CaptureCommand ¶
CaptureCommand is similar to PassthruCommand except it intercepts all output. It is primarily used to evaluate shell commands for success/failure states.
Derived from: http://stackoverflow.com/a/40770011/38408
func CheckForRigUpdate ¶
CheckForRigUpdate checks to see if an upgrdate to rig is available, if so, return a message
func ContainerRunning ¶
ContainerRunning determines if the named container is live.
func EscalatePrivilege ¶
func EscalatePrivilege() error
EscalatePrivilege attempts to gain administrative privilege @todo identify administrative escalation on Windows. E.g., "runas", "/noprofile", "/user:Administrator
func FileExists ¶
FileExists reports whether a file exists.
func ForceStreamCommand ¶
ForceStreamCommand sets up the output streams (and colors) to stream command output regardless of verbosity
func GetBridgeIP ¶
GetBridgeIP returns the IP address of the Docker bridge network gateway
func GetCurrentDockerVersion ¶
func GetCurrentDockerVersion() *version.Version
GetCurrentDockerVersion returns a Version based in the Docker semver
func GetDockerClientAPIVersion ¶
func GetDockerClientAPIVersion() *version.Version
GetDockerClientAPIVersion returns a Version for the docker client API version
func GetDockerServerAPIVersion ¶
func GetDockerServerAPIVersion() (*version.Version, error)
GetDockerServerAPIVersion returns a Version for the docker server API version
func GetDockerServerMinAPIVersion ¶
func GetDockerServerMinAPIVersion() (*version.Version, error)
GetDockerServerMinAPIVersion returns the minimum compatability version for the docker server
func GetExecutableDir ¶
GetExecutableDir returns the directory of this binary
func GetRawCurrentDockerVersion ¶
func GetRawCurrentDockerVersion() string
GetRawCurrentDockerVersion returns the entire semver string from the docker version cli
func GetUnisonMinorVersion ¶
func GetUnisonMinorVersion() string
GetUnisonMinorVersion will return the local Unison version to try to load a compatible unison image This function discovers a semver like 2.48.4 and return 2.48
func ImageOlderThan ¶
ImageOlderThan determines the age of the Docker Image and whether the image is older than the designated timestamp.
func IndexOfString ¶
IndexOfString is a general utility function that can find the index of a value present in a string slice. The second value is true if the item is found.
func IndexOfSubstring ¶
IndexOfSubstring is a variation on IndexOfString which checks to see if a given slice value matches our search string, or if that search string is a substring of the element. The second value is true if the item is found.
func IsWindows ¶
func IsWindows() bool
IsWindows detects if we are running on the microsoft windows platform
func NotifyError ¶
NotifyError send a notification for a failed command run
func NotifySuccess ¶
NotifySuccess send a notification for a successful command run
func PassthruCommand ¶
PassthruCommand is similar to ForceStreamCommand in that it will issue all output regardless of verbose mode. Further, this version of the command captures the exit status of any executed command. This function is intended to simulate native execution of the command passed to it.
Derived from: http://stackoverflow.com/a/40770011/38408
func PrintDebugHelp ¶
PrintDebugHelp provides expanded troubleshooting help content for an error. It is primarily called by command.go:Failure(). @todo consider switching this to a template.
func RemoveFile ¶
RemoveFile removes the designated file relative to the Working Directory.
func RemoveFileGlob ¶
RemoveFileGlob removes all files under the working directory that match the glob. This recursively traverses all sub-directories. If a logger is passed the action will be verbosely logged, otherwise pass nil to skip all output.
func StreamCommand ¶
StreamCommand sets up the output streams (and colors) to stream command output if verbose is configured
func StringPad ¶
StringPad takes your string and returns it with the pad value repeatedly appended until it is the intended length. Note that if the delta between the initial string length and the intended size is not evenly divisible by the pad length, your final string could be slightly short -- partial padding is not applied. For guaranteed results, use a pad string of length 1.
func SupportsNativeDocker ¶
func SupportsNativeDocker() bool
SupportsNativeDocker determines if the runtime OS support docker natively, versus needing to run docker in a virtual machine
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor wraps exec.Cmd to allow consistent manipulation of executed commands.
func (Executor) CombinedOutput ¶
CombinedOutput runs a command via exec.CombinedOutput() without modification or output of the underlying command.
func (Executor) Execute ¶
Execute executes the provided command, it also can specify if the output should be forced to print to the console
func (Executor) IsPrivileged ¶
IsPrivileged evaluates the command to determine if administrative privilege is required. @todo identify administrative escalation on Windows. E.g., "runas", "/noprofile", "/user:Administrator
func (Executor) Output ¶
Output runs a command via exec.Output() without modification or output of the underlying command.
func (Executor) Run ¶
Run runs a command via exec.Run() without modification or output of the underlying command.
type NotifyConfig ¶
type NotifyConfig struct { // The label for the app to be displayed in notifications. Label string // Relative path to notification logo. Icon string }
NotifyConfig holds configuration for notification support
type RigLogger ¶
type RigLogger struct { Channel logChannels Progress *RigSpinner IsVerbose bool Spinning bool Privileged bool }
RigLogger is the global logger object
func (*RigLogger) PrivilegeEscalationPrompt ¶
func (log *RigLogger) PrivilegeEscalationPrompt()
PrivilegeEscalationPrompt interrupts a running spinner to ensure clear prompting to the user for sudo password entry. It is up to the caller to know that privilege is needed. This prompt is only displayed on the first privilege escalation of a given rig process.
func (*RigLogger) SetVerbose ¶
SetVerbose allows toggling verbose mode mid-execution of the program.
func (*RigLogger) SpinWithVerbose ¶
SpinWithVerbose operates the spinner but also writes to the verbose log. This is used in cases where the spinner's initial context is needed for detailed verbose logging purposes.
func (*RigLogger) Verbose ¶
Verbose allows Verbose logging of more advanced activities/information. In practice, if the spinner can be in use verbose is a no-op.
type RigSpinner ¶
RigSpinner object wrapper to facilitate our spinner service as a different