fgutil

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: BSD-3-Clause Imports: 15 Imported by: 7

Documentation

Index

Constants

View Source
const FileURIPrefix = "file://"

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(s string) string

Capitalize will return a copy of the provided string with the first letter capitalized

func CopyDir

func CopyDir(source string, dest string) (err error)

CopyDir copies the specified directory and its contents to the specified destination

func CopyFile

func CopyFile(source string, dest string) (err error)

CopyFile copies the file from the source to the destination file

func CopyRemoteFile

func CopyRemoteFile(sourceURL string, dest string) (err error)

func CreateFileFromString

func CreateFileFromString(filePath string, data string) error

func CreateFileFromTemplate

func CreateFileFromTemplate(basePath string, fileName string, template string, data interface{}) error

func DeleteFilesWithPrefix

func DeleteFilesWithPrefix(dir string, filePrefix string) int

func ExecutableExists

func ExecutableExists(execName string) bool

ExecutableExists checks if the specified executable exists in the users PATH

func FileExists

func FileExists(filePath string) bool

FileExists determines if the named file exists

func IsGbProject

func IsGbProject(basePath string) bool

func IsRemote

func IsRemote(path string) bool

func IsStringInList

func IsStringInList(str string, list []string) bool

IsStringInList determines if the specified value is in the provided string list

func LoadLocalFile

func LoadLocalFile(path string) (string, error)

func LoadRemoteFile

func LoadRemoteFile(sourceURL string) (string, error)

func MoveFiles

func MoveFiles(source string, dest string) (err error)

func PathToFileURL

func PathToFileURL(filePath string) (string, error)

func RenderTemplate

func RenderTemplate(w io.Writer, text string, data interface{})

RenderTemplate renders the specified template

func ReplaceEnvValue added in v0.5.6

func ReplaceEnvValue(env []string, envKey string, newValue string) []string

func ToAbsOsPath

func ToAbsOsPath(filePath string) (string, error)

func URLToFilePath

func URLToFilePath(fileURL *url.URL) (string, bool)

ToFilePath convert fileURL to file path

func WriteJSONtoFile

func WriteJSONtoFile(filePath string, data interface{}) error

WriteJSONtoFile encodes the data to json and saves it to a file

Types

type Gb

type Gb struct {
	BinPath        string
	SourcePath     string
	VendorPath     string
	CodeSourcePath string
}

Gb structure that contains gb project paths

func NewGb

func NewGb(codePath string) *Gb

NewGb creates a new Gb struct

func (*Gb) Build

func (e *Gb) Build() error

Build performs a 'gb build'

func (*Gb) Init

func (e *Gb) Init(createBin bool)

Init creates directories for the gb project

func (*Gb) Installed

func (e *Gb) Installed() bool

Installed indicates if gb is installed

func (*Gb) NewBinFilePath

func (e *Gb) NewBinFilePath(fileName string) string

NewBinFilePath creates a new file Path in the bin directory

func (*Gb) VendorDelete

func (e *Gb) VendorDelete(path string) error

VendorDelete performs a 'gb vendor delete'

func (*Gb) VendorDeleteSilent

func (e *Gb) VendorDeleteSilent(path string) error

VendorDeleteSilent performs a 'gb vendor delete' silently

func (*Gb) VendorFetch

func (e *Gb) VendorFetch(path string, version string) error

VendorFetch performs a 'gb vendor fetch'

func (*Gb) VendorFetchWithBranch

func (e *Gb) VendorFetchWithBranch(path string, version string, branch string) error

VendorFetch performs a 'gb vendor fetch'

type PathInfo

type PathInfo struct {
	IsLocal  bool
	IsURL    bool
	IsFile   bool
	FileURL  *url.URL
	FilePath string
	FileName string
}

func GetPathInfo

func GetPathInfo(pathStr string) (*PathInfo, error)

Jump to

Keyboard shortcuts

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