salesforce source code migration in terminal


Salesforce Source Code Migration in Terminal (X11, xterm, bash, sh, shell, unix)

xforce features:

  • low-level - this simplifies the use of other Terminal-level software, such as vim and git
  • cross-platform - works on any system leveraging a shell
  1. Install node.js and its package manager, npm.
  2. npm install xforce

You will need to generate a consumer key and a consumer secret. These tokens allow xforce to access your salesforce environment.

  1. Navigate to Your Name > Setup > Develop > Remote Access.
  2. Click New. Fill the mandatory fields with anything, then click Save.
  3. The generated tokens should be accessible on the resulting screen.

In Terminal,

$ cd
$ mkdir my-first-project; cd my-first-project
$ xf init
$ xf config consumer_key <your consumer key here>
$ xf config consumer_secret <your consumer secret here>
$ xf config username <your username here>
$ xf config password <your password here>

The name of the project directory can be anything, my-first-project is just an example.

xf init

start a new project in the current directory.

xf config

set configuration parameters. config data is stored in ./.xf/config.json.

xf add

add local files to the project. content type is currently inferred by extension (.cls = class, .page = page, .trigger = trigger, and .component = component).

xf rm

remove files from the project.

xf pull

pull a set of files from salesforce, creating new files in the current directory if the files have not yet been added to the project or overwriting existing files in their individual directories if they have been added to the project.

xf push

push a set of files to salesforce. these files do not need to exist in salesforce beforehand.