README ¶
#env/dev
Command line developer tool used for Salesforce development. Deploys to instances based on a package of build files, from local files.
In this document, the keyword dev
is used instead of the program name. This will be remedied in a later update.
You can go get
this project from your local machine using:
go get github.com/massmep/env/dev
This documentation is slightly out of date, and lists features from a different design.
Any directory used as a project will be required to have the same structure as here. This can be done using the init
command.
ProjectName
build
classes
triggers
...
config
project
metadata
packages
Command List
- dev push
- dev add
- dev remove
- dev pull
- dev help
- dev instance
- dev package
- dev instances
- dev packages
dev build- dev init
If in directory of project, project name is not needed before commands, but if the command is being run from outside of that directory, then the name must be added in order for the go scripts to know where to target.
Example:
G:/projects/project_name> dev add ...
G:/projects> dev project_name add ...
##add
add < class | trigger | resource | page | component > <name> [-v=version] [-p=package] [exists]
Creates a file, a metadata file, and adds the file to .../project/package.xml.
File is added under build/type, and the metadata file goes into project/metadata.
Version is defaulted to current possible maximum value (35.0)
If there is a target package, the file will still be added to the build, and the metadata, but will only be
added to the package under .../project/packages/<package name>.xml.
If the file is pre-existing, specify the exists tag at the end of the command to be able to add only
to the package, and the rest will be pulled by the code into the build and metadata.
Example: dev add ProductManager class 32.0
.../build/classes/ProductManager.cls
.../project/metadata/ProductManager.cls-meta.xml
.../project/package.xml -> modified to include value added (<members>ProductManager</members>)
add <instance> <name> <url> <username> <password> <token>
Adds the given instances and all values to the instances file in .../project/instances.json.
Either the add or remove value is required, and determines the action to take on the file. If remove
is specified, than only the name of the instance is required.
The name acts as the user friendly handle for the instance, and should be used for all commands which
require an instance.
The url is the direct, full url for the given instance (regardless of sandbox/production)
The username, password, and token, will likely be replaced with something easier to use from the
command line, and will be encoded with some utility in order to keep user info secret.
add <package> <name>
Adds a package with the given name under .../project/packages/<package name>.xml.
##remove
remove <name> [type]
Removes a given file from the project. Removes metadata, the file, and the package entry.
If there is not a type specified, and there are multiple files with the same name, the user will be prompted
to pick one of the files to remove.
##pull
pull [instance] [package] [target | -overwrite ]
Selects metadata and files from the given instance and package, and moves them to a specific directory.
Instance defaults to the default instance specified in .../project/instances.json.
Package defaults to .../project/package.xml
Target is the file location to move the new build files to. By default this is .../project/pull/<instance>/build,
but this can be changed to any directory via this command (including the active build files,
overwriting them, by using the -overwrite flag).
##push
push [instance] [package | -all ]
Deploys build files to given instance based on the package.
Instance defaults to the default instance specified in .../project/instances.json.
Package defaults to .../project/package.xml. This can be replaced with the -all flag, which moves
all build files in the project to the given instance.
##help
help [command]
Requests help on a given command, or displays generic help, and help options.
##package
package <name> < add | remove > <file> <type> [exists]
Type is assumed to be required at the given time. It will be required for add, unless the file does not exist.
Adds or removes a file from the named package. The file is assumed to exist in the build files for the
current project, as well as have metadata.
Name refers to the page, and either add or remove must be specified after the package name, before the file name.
The file name may be followed by either the extension (.cls), or the type (class), to avoid file name conflicts.
If a conflict is found (ProductManager.page, ProductManager.cls), the user is prompted to resolve the conflict.
This command should not be confused with the command to create a new package (All commands to create are fed into add)
If the file does not exist, metadata for it will be created, as well as a build file. No content
will be pulled from any instance, until the user pulls this package from a given instance.
##packages
packages [name]
Provides information about a package or all packages to the command line.
In form of:
Package Name: Default
Classes:
ProductManager
ProductManagerTest
Pages:
ProductManager
This command will display this data for all packages if no name is specified, or a
single package if a name is specified.
##instances
instances [name]
Provides information about an instance or all instances to the command line.
In form of:
Instance Name:
Url: www.cs23.salesforce.com
Last Deploy: 05-11-2016
Last Pull: 03-23-2016
Last Package Deployed: Default
Last Package Pulled: Default
This command will display this data for all instances if no name is specified, or a single
instance if a name is specified.
##instance
instance < add | remove > <name> <url>
Adds an instance based on the given information. Requests login information after calling this
command (will use either an oauth method, or will encrypt user info for use when deploying).
## init
init <name>
Creates a project directory in the current working directory with the given name.