util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddImport

func AddImport(fset *token.FileSet, f *ast.File, ipath string) (added bool)

AddImport adds the import path to the file f, if absent.

func Copy

func Copy(src, dst string, copyMode bool) error

func CopyFile

func CopyFile(srcFile, destFile string) error

func CreateVersionFile

func CreateVersionFile(cmdPath, currentVersion string) error

func DeleteFile

func DeleteFile(path string) error

func DeleteImport

func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool)

DeleteImport deletes the import path from the file f, if present.

func DirExists

func DirExists(path string) bool

func ExecCmd

func ExecCmd(cmd *exec.Cmd, workingDir string) error

func FileExists

func FileExists(path string) bool

func FindGoModPackageSrc

func FindGoModPackageSrc(pkg string, version string, latest bool) (srcPath, srcVer string, err error)

func FindOldPackageSrc

func FindOldPackageSrc(pkg string) (srcPath, srcVer string, err error)

func GetCLIInfo

func GetCLIInfo() (string, string, error)

func GetContribType

func GetContribType(depManager DepManager, ref string) (string, error)

func GetGoPath

func GetGoPath() string

func GetPackageVersionFromGit

func GetPackageVersionFromGit(dir string) string

retrieve the package version from source in a directory using "git describe" command

func GetPackageVersionFromSource

func GetPackageVersionFromSource(pkg string) string

retrieve the package version from source in GOPATH using "git describe" command

func IsPkgNotFoundError

func IsPkgNotFoundError(err error) bool

func IsRemote

func IsRemote(path string) bool

func LoadLocalFile

func LoadLocalFile(path string) (string, error)

func LoadRemoteFile

func LoadRemoteFile(sourceURL string) (string, error)

func Rename

func Rename(srcPath string) error

func ReplaceEnvValue

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

func SetVerbose

func SetVerbose(enable bool)

func Verbose

func Verbose() bool

Types

type AppImportDetails

type AppImportDetails struct {
	Imp          Import
	ContribDesc  *FlogoContribDescriptor
	TopLevel     bool // a toplevel import i.e. from imports section
	HasAliasRef  bool // imports alias is used by a contrib reference
	HasDirectRef bool // a direct reference exists for this import
}

func (*AppImportDetails) IsCoreContrib

func (d *AppImportDetails) IsCoreContrib() bool

func (*AppImportDetails) Referenced

func (d *AppImportDetails) Referenced() bool

type AppImports

type AppImports struct {
	// contains filtered or unexported fields
}

func GetAppImports

func GetAppImports(appJsonFile string, depManager DepManager, resolveContribs bool) (*AppImports, error)

func (*AppImports) GetAllImportDetails

func (ai *AppImports) GetAllImportDetails() []*AppImportDetails

func (*AppImports) GetAllImports

func (ai *AppImports) GetAllImports() []Import

func (*AppImports) GetOrphanedReferences

func (ai *AppImports) GetOrphanedReferences() []string

type DepManager

type DepManager interface {
	Init() error
	AddDependency(flogoImport Import) error
	GetPath(flogoImport Import) (string, error)
	AddReplacedContribForBuild() error
	InstallReplacedPkg(string, string) error
	GetAllImports() (map[string]Import, error)
}

func NewDepManager

func NewDepManager(sourceDir string) DepManager

type EngineImportDetails

type EngineImportDetails struct {
	Imp        Import
	TopLevel   bool // a toplevel import i.e. from imports section
	ServiceRef bool // imports is used by a service

	HasAliasRef  bool // imports alias is used by a contrib reference
	HasDirectRef bool // a direct reference exists for this import
}

type EngineImports

type EngineImports struct {
	// contains filtered or unexported fields
}

func GetEngineImports

func GetEngineImports(engJsonFile string, depManager DepManager) (*EngineImports, error)

func (*EngineImports) GetAllImportDetails

func (ai *EngineImports) GetAllImportDetails() []*EngineImportDetails

func (*EngineImports) GetAllImports

func (ai *EngineImports) GetAllImports() []Import

func (*EngineImports) GetOrphanedReferences

func (ai *EngineImports) GetOrphanedReferences() []string

type EngineServiceDetails

type EngineServiceDetails struct {
	Ref string
}

type FlogoAppDescriptor

type FlogoAppDescriptor struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Version     string   `json:"version"`
	Description string   `json:"description"`
	AppModel    string   `json:"appModel,omitempty"`
	Imports     []string `json:"imports"`

	Triggers []*FlogoTriggerConfig `json:"triggers"`
}

FlogoAppDescriptor is the descriptor for a Flogo application

func ParseAppDescriptor

func ParseAppDescriptor(appJson string) (*FlogoAppDescriptor, error)

ParseAppDescriptor parse the application descriptor

type FlogoContribBundleDescriptor

type FlogoContribBundleDescriptor struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Contribs    []string `json:"contributions"`
}

type FlogoContribDescriptor

type FlogoContribDescriptor struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Version     string `json:"version"`
	Description string `json:"description"`
	Homepage    string `json:"homepage"`
	Shim        string `json:"shim"`
	Ref         string `json:"ref"` //legacy

	IsLegacy bool `json:"-"`
}

FlogoAppDescriptor is the descriptor for a Flogo application

func GetContribDescriptor

func GetContribDescriptor(contribPath string) (*FlogoContribDescriptor, error)

func GetContribDescriptorFromImport

func GetContribDescriptorFromImport(depManager DepManager, contribImport Import) (*FlogoContribDescriptor, error)

func ReadContribDescriptor

func ReadContribDescriptor(descriptorFile string) (*FlogoContribDescriptor, error)

func (*FlogoContribDescriptor) GetContribType

func (d *FlogoContribDescriptor) GetContribType() string

type FlogoImport

type FlogoImport struct {
	// contains filtered or unexported fields
}

func (*FlogoImport) Alias

func (flogoImport *FlogoImport) Alias() string

func (*FlogoImport) CanonicalAlias

func (flogoImport *FlogoImport) CanonicalAlias() string

func (*FlogoImport) CanonicalImport

func (flogoImport *FlogoImport) CanonicalImport() string

func (*FlogoImport) GoGetImportPath

func (flogoImport *FlogoImport) GoGetImportPath() string

func (*FlogoImport) GoImportPath

func (flogoImport *FlogoImport) GoImportPath() string

func (*FlogoImport) GoModImportPath

func (flogoImport *FlogoImport) GoModImportPath() string

func (*FlogoImport) IsClassic

func (flogoImport *FlogoImport) IsClassic() bool

func (*FlogoImport) ModulePath

func (flogoImport *FlogoImport) ModulePath() string

func (*FlogoImport) RelativeImportPath

func (flogoImport *FlogoImport) RelativeImportPath() string

func (*FlogoImport) String

func (flogoImport *FlogoImport) String() string

func (*FlogoImport) Version

func (flogoImport *FlogoImport) Version() string

type FlogoTriggerConfig

type FlogoTriggerConfig struct {
	Id   string `json:"id"`
	Ref  string `json:"ref"`
	Type string `json:"type"`
}

type Import

type Import interface {
	fmt.Stringer

	ModulePath() string
	RelativeImportPath() string
	Version() string
	Alias() string

	CanonicalImport() string // canonical import is used in flogo.json imports array and to check for equality of imports
	GoImportPath() string    // the import path used in .go files
	GoGetImportPath() string // the import path used by "go get" command
	GoModImportPath() string // the import path used by "go mod edit" command
	IsClassic() bool         // an import is "classic" if it has no : character separator, hence no relative import path
	CanonicalAlias() string  // canonical alias is the alias used in the flogo.json
}

func NewFlogoImport

func NewFlogoImport(modulePath, relativeImportPath, version, alias string) Import

func NewFlogoImportFromPath

func NewFlogoImportFromPath(flogoImportPath string) (Import, error)

func NewFlogoImportWithVersion

func NewFlogoImportWithVersion(imp Import, version string) Import

func ParseImport

func ParseImport(flogoImport string) (Import, error)

type Imports

type Imports []Import

func ParseImports

func ParseImports(flogoImports []string) (Imports, error)

type ModDepManager

type ModDepManager struct {
	// contains filtered or unexported fields
}

func (*ModDepManager) AddDependency

func (m *ModDepManager) AddDependency(flogoImport Import) error

func (*ModDepManager) AddReplacedContribForBuild

func (m *ModDepManager) AddReplacedContribForBuild() error

func (*ModDepManager) GetAllImports

func (m *ModDepManager) GetAllImports() (map[string]Import, error)

func (*ModDepManager) GetPath

func (m *ModDepManager) GetPath(flogoImport Import) (string, error)

GetPath gets the path of where the

func (*ModDepManager) Init

func (m *ModDepManager) Init() error

func (*ModDepManager) InstallReplacedPkg

func (m *ModDepManager) InstallReplacedPkg(pkg1 string, pkg2 string) error

func (*ModDepManager) RemoveImport

func (m *ModDepManager) RemoveImport(flogoImport Import) error

type PartialAppDescriptor

type PartialAppDescriptor struct {
	AppModel  string        `json:"appModel"`
	Imports   []string      `json:"imports"`
	Triggers  []interface{} `json:"triggers"`
	Resources []interface{} `json:"resources"`
	Actions   []interface{} `json:"actions"`
}

PartialAppDescriptor is the descriptor for a Flogo application

type PartialEngineDescriptor

type PartialEngineDescriptor struct {
	Imports  []string                `json:"imports"`
	Services []*EngineServiceDetails `json:"services"`
}

PartialEngineDescriptor is the descriptor for a Flogo application

type Resp

type Resp struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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