lib

package
v0.0.0-...-84f2673 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultVersion = "35.0"

Variables

This section is empty.

Functions

func BuildFileExists

func BuildFileExists(name, apexType string) bool

BuildFileExists returns a bool value if it can find a given value in the build files of the current project.

func CheckAsyncDeploy

func CheckAsyncDeploy(id metadata.ID, instance Instance) (done bool)

CheckAsyncDeploy checks the given AsyncProcessId on the given instance, and prints the result to console. This function returns the response.Result.Done value, which will be true once the job has completed.

func CheckAsyncRetrieve

func CheckAsyncRetrieve(id metadata.ID, instance Instance) (done bool, contents []byte)

func CheckSessionID

func CheckSessionID(instance Instance) bool

func CheckValidApexType

func CheckValidApexType(apexType string) bool

CheckValidApexType returns a bool value based on if the type provided is a formal or informal apex type.

func CreateBuildFile

func CreateBuildFile(memberName, apexType string) (err error)

CreateBuildFile creates a build file in ./build/apexType based off the memberName, and the apexType provided.

func CreateMetadataFile

func CreateMetadataFile(memberName, apexType string) (err error)

CreateMetadataFile creates a metadata file in ./project/metadata based off the memberName, and the apexType provided.

func Error

func Error(errorInfo string) error

Error returns an error from a given string

func Errorf

func Errorf(errorInfo string, replace ...string) (err error)

Errorf Used to create errors without needing to add import statements to other files.

func FormalizeApexType

func FormalizeApexType(shorthand string) (formal string)

FormalizeApexType converts a shorthand apex type into a formal apex type.

func GetApexExtension

func GetApexExtension(apexType string) (ext string, err error)

func GetExtensionsForApexType

func GetExtensionsForApexType(apexType string) (apexExt, fileExt string, err error)

func GetFileExtFromApexExt

func GetFileExtFromApexExt(apexExtension string) string

func GetFileExtension

func GetFileExtension(apexType string) (ext string, err error)

func GetFormalApexTypes

func GetFormalApexTypes() []string

GetFormalApexTypes returns a listing of the formal names of apex types.

func GetMetadataDirectory

func GetMetadataDirectory() string

func GetMetadataExtension

func GetMetadataExtension() string

func GetPluralApexType

func GetPluralApexType(apexType string) string

GetPluralApexType returns either a string with the plural name of an apex type, or an empty string.

func GetPluralApexTypes

func GetPluralApexTypes() []string

GetPluralApexTypes returns a list of valid, plural apex types.

func GetProjectDirectory

func GetProjectDirectory() string

func GetShortApexTypes

func GetShortApexTypes() []string

GetShortApexTypes returns a listing of acceptable informal apex types.

func GetSingleApexType

func GetSingleApexType(pluralApexType string) string

func InformalizeApexType

func InformalizeApexType(formal string) string

InformalizeApexType returns either a string with the formal name of an apex type, or an empty string.

func InstanceExists

func InstanceExists(instanceName string) bool

func MetadataFileExists

func MetadataFileExists(name, apexType string) bool

MetadataFileExists returns a bool value if it can find a given value in the metadata files of the current project

func RemoveInstance

func RemoveInstance(instanceName string) (err error)

func SetProjectDirectory

func SetProjectDirectory(newDir string) (err error)

TODO: Remove this func + value, Replace with os.Chdir & os.Getwd

func TryDeploy

func TryDeploy(contents []byte, instance Instance) (id metadata.ID, err error)

func TryLogIn

func TryLogIn(instance *Instance) (err error)

func TryRetrieve

func TryRetrieve(pkg Package, instance Instance) (Id metadata.ID, err error)

Types

type Command

type Command interface {
	Help() string
	Name() string
	Run(args []string) (err error)
}

Command : used to define the commands that can be run through the program. Fairly standard & simple as command interfaces go. A few assumptions are made: Help() Will return useful info determined by consts in command files Name() will return a lowercase only name of the command for input matching Run() will only be given parameters which exclude the first two os.Args Ie, when given "dev add package test" only "package test" will be given to the Run() func to be used. Structs should still check to see if there are 0 arguments, unless the command can be run without any parameters. The internal structure of the structs does not matter- as long as these funcs are working, the command will be accepted

type CommandData

type CommandData struct {
	NameString, HelpString string
	RunCommand             func(args []string) (err error)
}

CommandData acts as a data wrapper for commands

func (CommandData) Help

func (c CommandData) Help() string

Help : Provides help to inherit Command interface

func (CommandData) Name

func (c CommandData) Name() string

Name : Provides name to inherit Command interface

func (CommandData) Run

func (c CommandData) Run(args []string) (err error)

type Instance

type Instance struct {
	UserInfo UserInfo `"xml:"UserInfo`
	Sandbox  bool     `xml:"Sandbox,attr"`
	Version  string   `xml:"Version,attr"`

	MetadataURL string
	ServerURL   string
	Name        string
}

func GetInstanceByName

func GetInstanceByName(instanceName string) (i Instance, err error)

func (*Instance) SaveInstance

func (i *Instance) SaveInstance() (err error)

type Members

type Members struct {
	Names      []string `xml:"members"`
	MemberType string   `xml:"name"`
}

Members : Members of a given package. Contains a file name, and a file type.

type Package

type Package struct {
	Members []Members `xml:"types"`
	Version string    `xml:"version"`
	Xmlns   string    `xml:"xmlns,attr"`
	// contains filtered or unexported fields
}

Package : Controls files for deployments. A package

has a name, and a collection of files taken from
the json document that is saved to disc

func ImportPackage

func ImportPackage(fileName string) (p Package, err error)

ImportPackage : calls ImportPackageFrom(...) on a file located in the default directory. Important to note: only specify a file for this function.

func ImportPackageFrom

func ImportPackageFrom(fullPath string) (p Package, err error)

ImportPackageFrom : Call on an xml file, that supports the proper schema, and get

a Package struct in return, or an error

func NewPackageFromName

func NewPackageFromName(name string) (p *Package, err error)

NewPackageFromName : Creates a new package using the default version, the given name, and an empty member array. Returns an error if name is nil.

func NewPackageFromVersion

func NewPackageFromVersion(name, version string) (p *Package, err error)

NewPackageFromVersion : Creates a new package using the given version, and name, and an empty member array

func NewPackageWithMembers

func NewPackageWithMembers(name, version string, members []Members) (p *Package, err error)

NewPackageWithMembers : Creates a new pacakge using the given values. Might as well call Package{} at this point, but this is cleaner

func (*Package) AddMemeber

func (p *Package) AddMemeber(name, fileType string) (err error)

AddMember is used to add a new member based on the given name, and filetype. The version of the member is assumed to be the same as the packageDefaultVersion, and the generated metadata will be of that version, with the needed defaults.

func (Package) ExportPackage

func (p Package) ExportPackage() (err error)

ExportPackage : Saves package information to a target file, or, if there is no file, this function defaults to the known save location for packages.

func (Package) ExportPackageTo

func (p Package) ExportPackageTo(targetFile string) (err error)

ExportPackageTo : Saves package information to a target file, or, if there is no file, this function defaults to the known save location for packages.

func (Package) GetMembersOfType

func (p Package) GetMembersOfType(targetType string) (r []string, err error)

GetMembersOfType : Returns a collection of file names of the given type, or an

error if there are none of that type.

func (Package) HasMemberNamed

func (p Package) HasMemberNamed(name string) (b bool)

HasMemberNamed returns a boolean value based on if a member object of any file type exists in the given isntance of package. There can be multiple files named the same, but this function will only return true or false, not a number of files. This function will also not return the type.

func (Package) HasMemeber

func (p Package) HasMemeber(name, fileType string) bool

HasMember checks to see if a given name and type exist in the package instance. Returns either a boolean or an error as needed. Error will probably be very rarely thrown, as a false value will suffice for most situations.

func (*Package) RemoveMember

func (p *Package) RemoveMember(name, fileType string) (err error)

RemoveMember is used to remove a given member of the same name, and fileType from a package instance. This function does not remove any metadata, or build files. The user assumes responsiblity for removing these values.

func (*Package) RemoveMemberByName

func (p *Package) RemoveMemberByName(name string) (err error)

func (*Package) ZipPackageIntoBytes

func (p *Package) ZipPackageIntoBytes() (contents []byte, err error)

type UserInfo

type UserInfo struct {
	Username  string `xml:"Username"`
	Password  string `xml:"Password"`
	Token     string `xml:"Token"`
	SessionID string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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