gitos

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	// Run starts the specified command and waits for it to complete.
	Run() error

	// Start starts the specified command but does not wait for it to complete.
	Start() error

	// Wait waits for the command to exit. It must have been started by Start.
	Wait() error

	// Output runs the command and returns its standard output.
	Output() ([]byte, error)

	// Dir sets the working directory of the command.
	Dir(string)

	// Stdin sets the process's standard input.
	Stdin(io.Reader)

	// Stdout sets the process's standard output.
	Stdout(io.Writer)

	// Stderr sets the process's standard output.
	Stderr(io.Writer)
}

Cmd is an abstraction for external commands (os.Cmd).

type File

type File interface {
	// Name returns the name of the file
	Name() string

	// Stat returns the FileInfo structure describing file.
	Stat() (os.FileInfo, error)

	// Close closes the File, rendering it unusable for I/O.
	Close() error

	// Chmod changes the mode of the file.
	Chmod(os.FileMode) error

	// Read reads up to len(b) bytes from the File. It returns the number of
	// bytes read and an error, if any.
	Read([]byte) (int, error)

	// Write writes len(b) bytes to the File. It returns the number of bytes
	// written and an error, if any.
	Write([]byte) (int, error)
}

File is an abstraction for file (os.File).

type GitOS

type GitOS struct{}

GitOS is the implementation of OS for git.

func (GitOS) Command

func (g GitOS) Command(name string, args ...string) Cmd

Command calls exec.Command.

func (GitOS) LookPath

func (g GitOS) LookPath(file string) (string, error)

LookPath calls exec.LookPath.

func (GitOS) Mkdir

func (g GitOS) Mkdir(name string, perm os.FileMode) error

Mkdir calls os.Mkdir.

func (GitOS) MkdirAll

func (g GitOS) MkdirAll(path string, perm os.FileMode) error

MkdirAll calls os.MkdirAll.

func (GitOS) NewTicker added in v0.7.1

func (g GitOS) NewTicker(d time.Duration) Ticker

New Ticker calls time.NewTicker.

func (GitOS) ReadDir

func (g GitOS) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir calls ioutil.ReadDir.

func (GitOS) Remove

func (g GitOS) Remove(name string) error

Remove calls os.Remove.

func (GitOS) Sleep added in v0.7.1

func (g GitOS) Sleep(d time.Duration)

Sleep calls time.Sleep.

func (GitOS) Stat

func (g GitOS) Stat(name string) (os.FileInfo, error)

Stat calls os.Stat.

func (GitOS) TempFile

func (g GitOS) TempFile(dir, prefix string) (File, error)

TempFile calls ioutil.TempFile.

func (GitOS) TimeSince added in v0.7.1

func (g GitOS) TimeSince(t time.Time) time.Duration

TimeSince calls time.Since

type GitTicker added in v0.7.1

type GitTicker struct {
	*time.Ticker
}

GitTicker is the implementation of Ticker for git.

func (*GitTicker) C added in v0.7.1

func (g *GitTicker) C() <-chan time.Time

C returns the channel on which the ticks are delivered.s

type OS

type OS interface {
	// Command returns the Cmd to execute the named program with the
	// given arguments.
	Command(string, ...string) Cmd

	// Mkdir creates a new directory with the specified name and permission
	// bits.
	Mkdir(string, os.FileMode) error

	// MkdirAll creates a directory named path, along with any necessary
	// parents.
	MkdirAll(string, os.FileMode) error

	// Stat returns a FileInfo describing the named file.
	Stat(string) (os.FileInfo, error)

	// Remove removes the named file or directory.
	Remove(string) error

	// ReadDir reads the directory named by dirname and returns a list of
	// directory entries.
	ReadDir(string) ([]os.FileInfo, error)

	// LookPath searches for an executable binary named file in the directories
	// named by the PATH environment variable.
	LookPath(string) (string, error)

	// TempFile creates a new temporary file in the directory dir with a name
	// beginning with prefix, opens the file for reading and writing, and
	// returns the resulting File.
	TempFile(string, string) (File, error)

	// Sleep pauses the current goroutine for at least the duration d. A
	// negative or zero duration causes Sleep to return immediately.
	Sleep(time.Duration)

	// NewTicker returns a new Ticker containing a channel that will send the
	// time with a period specified by the argument.
	NewTicker(time.Duration) Ticker

	// TimeSince returns the time elapsed since the argument.
	TimeSince(time.Time) time.Duration
}

OS is an abstraction for required OS level functions.

type Ticker added in v0.7.1

type Ticker interface {
	C() <-chan time.Time
	Stop()
}

Ticker is an abstraction for Ticker (time.Ticker)

Jump to

Keyboard shortcuts

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