salesforce source code migration in terminal
Salesforce Source Code Migration in Terminal (X11, xterm, bash, sh, shell, unix)
You will need to generate a consumer key and a consumer secret from within Salesforce. These tokens allow
xforce to access your Salesforce environment.
New. Fill the mandatory fields with anything, then click
Next, in Terminal:
$ mkdir my-first-project$ cd my-first-project$ xf init$ xf config client_id <your consumer key here>$ xf config client_secret <your consumer secret here>$ xf config username <your username here>$ xf config password <your password here>
Configuration settings are managed with the config command.
Start a new project in the current directory. This should be done first before other commands are run.
Manage configuration parameters.
xf config get [key]prints the value associated with the given key
xf config set [key] [value]sets the given key to the given value
xf config listprints the full config file to the screen
xf get [key]is the same as
xf config get [key]
xf set [key] [value]is the same as
xf config set [key] [value]
# get the version$ xf get versionv27.0# use the sandbox login url$ xf set is_sandbox true
List source code files that currently exist in Salesforce, in alphabetic order.
Expressions have a name and an extension. The name can include any number of wildcard characters ("%"), and the extension can be "cls", "page", "component", "trigger", or "%".
xf listlists all classes, pages, components, and triggers.
xf list %.triggerlists all triggers.
xf list Site%.page Site%Controller.clslists all pages whose names begin with "Site" and all classes whose names begin with "Site" and end with "Controller".
xf list SiteLogin.componentprints SiteLogin.component if there is a component called SiteLogin in Salesforce, otherwise prints nothing.
xf list Code.%prints all classes, pages, components, and triggers with the name "Code".
xf list Codeis the same as
xf list Code.%.
xf list %.%and
xf list %are the same as
Add local files to the project. A file must be added to the project before it can be pushed to the server with
xf push. A file must have a proper extension ("cls", "page", "component", or "trigger") before it can be added to the project. The file must also be beneath the project directory (the directory that
xf init was executed in).
# add a new page that does not exist in Salesforce to the project$ xf add NewPage.pageadded /NewPage.page# add a page that exists in Salesforce to the project$ xf add path/to/ExistingPage.pageadded /path/to/ExistingPage.page
Remove files from the project.
# remove a page from the project$ xf rm path/to/ExistingPage.pageremoved /path/to/ExistingPage.page
Pull a set of files from salesforce into the current directory. If the file already exists in the current directory, it is overwritten.
Files that have been pulled from Salesforce are not automatically added to the project.
# pull a file into the current directory$ xf pull SiteLogin.component# pull several files into the current directory$ xf pull `xf list Site%Controller.cls Site%.page`
Push a set of files to Salesforce. These files must first be added to the project with the add command before they can be pushed to the server. It is possible to push files that do not yet exist on the server.
# push a file to the server$ xf push NewPage.page