common

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MsgReset string = ansi.ColorCode("reset")

	PrintTitle, PrintlnTitle     = printers(" ", ansi.ColorCode("green+h"))
	PrintL0, PrintlnL0           = printers(" ", ansi.ColorCode("magenta"))
	PrintL1, PrintlnL1           = printers(" ", ansi.ColorCode("white"))
	PrintL2, PrintlnL2           = printers(" ----> ", ansi.ColorCode("black+h"))
	PrintError, PrintlnError     = printers(" ", ansi.ColorCode("red"))
	PrintWarning, PrintlnWarning = printers(" ", ansi.ColorCode("yellow"))
)

Functions

func AddFile

func AddFile(dir string, file string) error

func AskMultipleChoices

func AskMultipleChoices(message string, choices []string) string

func AskUser

func AskUser(message string) string

func AskUserWithDefault

func AskUserWithDefault(message string, defaultValue string, shouldPrompt bool) string

func AskYesOrNo

func AskYesOrNo(message string, defaultValue bool, shouldPrompt bool) bool

func Commit

func Commit(dir string, message string) error

func CompareVersions

func CompareVersions(desired string, actual string) (bool, error)

func ContainsString

func ContainsString(slice []string, desired string) bool

func DownloadSingleFile

func DownloadSingleFile(tempDir string, temp DownloadFile, flagBranch string) error

func DownloadTemplates

func DownloadTemplates(tempDir string, td TemplateDefinition, templatePath string, flagBranch string) error

func Fetch

func Fetch(url string, mod *time.Time) (io.ReadCloser, error)

func FetchJSON

func FetchJSON(url string, mod *time.Time, v interface{}) error

func FileExists

func FileExists(filename string) bool

func GetAllowedNodeVersions

func GetAllowedNodeVersions() []string

func GetClosedAllowedNodeVersion

func GetClosedAllowedNodeVersion(major uint64, minor uint64, patch uint64) string

func GetDefaultNodeVersion

func GetDefaultNodeVersion() string

func GetDependencyVersion

func GetDependencyVersion(packageJsonFile string, dependencyNames ...string) (bool, string)

func GetFramework

func GetFramework(composerJSONfile string, framework string) (bool, string)

func GetGemVersion

func GetGemVersion(gemFile string, gemNames ...string) (bool, string)

returns bool = found any of the gems or not and string = the version of the first found

func GetMeteorVersion

func GetMeteorVersion(meteorReleaseFile string) (bool, string)

func GetNodeDatabase

func GetNodeDatabase(packageJsonFile string, databaseNames ...string) (bool, string)

func GetNodeVersion

func GetNodeVersion(packageJsonFile string) (bool, []string)

Looks for node version in the package.json. If found returns true, version if not false, ""

func GetPHPDatabase

func GetPHPDatabase(composerJSONfile string, databaseName string) (bool, string)

func GetPHPVersion

func GetPHPVersion(composerJSONfile string) (bool, string)

Looks for node version in the package.json. If found returns true, version if not false, ""

func GetPythonVersion

func GetPythonVersion() (hasFound bool, version string)

func GetRubyVersion

func GetRubyVersion(gemFile string) (bool, string)

Looks for ruby version in the gemfile. If found returns true, version if not false, ""

func GetScriptsStart

func GetScriptsStart(packageJsonFile string) (bool, string)

func GetSupportedNodeFrameworks

func GetSupportedNodeFrameworks() []string

func GitRootDir

func GitRootDir(dir string) (string, error)

func HasGit

func HasGit(dir string) bool

func IsDjangoProject

func IsDjangoProject(rootDir string) bool

func LocalGitBranch

func LocalGitBranch(dir string) string

func PadVersionNumber

func PadVersionNumber(version string) string

func ParseEnvironmentVariables

func ParseEnvironmentVariables(line string) (string, error)

func ParseLineForGem

func ParseLineForGem(gemName string, line string) (bool, string)

Checks a line to see if it contains the given gem. returns true, version or false, ""

func ParsePort

func ParsePort(command string) (hasFound bool, port string)

func ParseUniqueInt

func ParseUniqueInt(line string) (string, error)

func PathRelativeToGitRoot

func PathRelativeToGitRoot(dirPath string) (string, error)

func PythonPackages

func PythonPackages(requirementsTxt string) ([]string, error)

func RemoteGitUrl

func RemoteGitUrl(dir string) string

func RemovePortIfEnvVar

func RemovePortIfEnvVar(command string) string

func SetAllowedNodeVersions

func SetAllowedNodeVersions(versions []string)

func Tar

func Tar(source, target string) error

Types

type Database

type Database struct {
	Name        string
	DockerImage string
}

type DownloadFile

type DownloadFile struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

type EnvVar

type EnvVar struct {
	Key   string
	Value string
}

func NewEnvMapping

func NewEnvMapping(key string, value string) *EnvVar

type Lister

type Lister struct {
	Items []string
}

func NewLister

func NewLister(seed ...string) *Lister

func (*Lister) Add

func (l *Lister) Add(items ...string)

func (*Lister) Contains

func (l *Lister) Contains(item string) bool

func (*Lister) ToList

func (l *Lister) ToList(sep string) string

type PortMapping

type PortMapping struct {
	Container string
	HTTP      string
	HTTPS     string
	TCP       string
	UDP       string
}

func NewInternalPortMapping

func NewInternalPortMapping(container string) *PortMapping

func NewPortMapping

func NewPortMapping() *PortMapping

type Process

type Process struct {
	Name    string
	Command string
}

func ParseProcfile

func ParseProcfile(procfile string) ([]*Process, error)

type Service

type Service struct {
	Name          string
	GitRepo       string
	GitBranch     string
	Command       string
	BuildCommand  string
	DeployCommand string
	Ports         []*PortMapping
	EnvVars       []*EnvVar
	BuildRoot     string
	Databases     []Database
}

type TemplateDefinition

type TemplateDefinition struct {
	Version           string         `json:"version"`
	Dockerfiles       []DownloadFile `json:"dockerfiles"`
	ServiceYmls       []DownloadFile `json:"service-ymls"`
	DockerComposeYmls []DownloadFile `json:"docker-compose-ymls"`
	BundleManifest    []DownloadFile `json:"bundle-manifest-jsons"`
}

Jump to

Keyboard shortcuts

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