Quick start

1 Installation

Step Links Description
1 Java JDK or JRE Install Java JDK or JRE, version 7 or higher
2 Gradle Install Gradle 2.0 version or higher
3 Configure Gradle Configure gradle if you are using a Proxy

2 Register credentials

Enforce requires access to a Salesforce Organization, so you need to provide the credentials and Security Token for an user with System Administrator rights. Enforce provides a task for create credentials, which are stored on your home folder and can be encrypted also.

Step Examples Description
1 Con titulo Create build.gradle file
Create build.gradle file on your folder project.
Below, you have an example.

build.gradle file
2 Con titulo Create a source code folder
Create a folder in which to store your source code, preferably give a src name.
3 $ gradle addCredential
-Pid=default
-Pusername=USER NAME
-Ppassword=PASSWORD
-Ptoken=SECURITY TOKEN
Add SalesForce credential
Open a terminal and run the following command with the next parameters

id: is necessary to management your credential.
username: is a SalesForce account.
password: is your SalesForce password
token: is your SalesForce token.

id: should be saved with ‘default’ value

For more information about managing credentials see the following link
Credentials management

For more information about generate your security token see the following link
Generate token security
4 Con titulo View SalesForce credential
A file is created in the ./home folder with yours credentials .

3 Retrive your code

This task downloads files from your organization is based on your .xml package. If this file is missing, the system downloads files by default.

Step Examples Description
1 Con titulo Open a terminal
Open a terminal in the same folder as your project
2 Con titulo Execute retrieve task
Execute the following command
> gradle retrieve
This task downloaded the salesforce components contained in your organization.

For more information about the retrieve task see the following link
Retrieve code
3 Con titulo Results
This task downloads files from your organization is based on your .xml package. If this file is missing, the system downloads files by default.
- objects
- staticresources
- classes
- pages
- triggers
- components

For more information about the package.xml file see the following link
package.xml information

4 Deploy your code

This task deploys all code from your local code to Salesforce organization, for this as a first step It truncates your local code and deploys those files truncated to Salesforce organization, as second step It deploys your local code to SatesForce organization.

Step Examples Description
1 Con titulo Open a terminal
Open a terminal in the same folder as your project

Execute deploy task
Execute the following command
> gradle deploy
This task deployed all code from your local code to Salesforce organization.

For more information about the deploy task see the following link
Deployed code
2 Con titulo Results
All code will be deployed to organization using a smart deploy. That means that when you execute the task deploy:

a) First step is truncate the next elements and deploy it.
- classes
- objects
- triggers
- components
- pages
- workFlows

b) Second step is deploy all local code to your organization

5 Update your code

This task just deploys changed code as: deleted code, added code and updated code, for example if you changed a class called MyClass.cls and you deleted a trigger called MyTrigger.trigger This deletes MyTrigger.trigger and it updates MyClass.cls according file tracker in your organization.

Step Examples Description
1 Con titulo Open a terminal
Open a terminal in the same folder as your project

Execute update task
Execute the following command
> gradle update
This task just deploys changed code as: deleted code, added code and updated code.

For more information about the update task see the following link
Update code

Other features

Credentials management

Task Description
addCredential This task adds a new credential into credentials.dat located in user home directory by default
updateCredential This task updates a credential from credentials.dat file located in user home directory and project directory by default is home.

Monitoring local changes

Task Description
status Status task lets the user see what files have been changed as (new file, deleted file and updated file
reset File monitor tracker will be reset.

Deployment tasks

Task Description
deploy This task deploys all code from your local code to Salesforce organization, for this as a first step It truncates your local code and deploys those files truncated to Salesforce organization, as second step It deploys your local code to SatesForce organization.
upload This task uploads your code from your local repository to SalesForce organization directly as it is.
undeploy This task is able to undeploy code from Salesforce organization. To avoid dependency problems It truncates code and it deploys code truncated as first step and then It will try to delete all code from Salesforce organization according to local code.
truncate This task just truncates your code from local repository to Salesforce organization.
delete This task removes the components that we have in our SalesForce organization, the components that will be removed should have no dependences.
It is suggested to use the truncate task previously

Retrieve tasks

Task Description
retrieve This task downloads files from your organization is based on your .xml package. If this file is missing, the system downloads files by default.

Unit-test tasks

Task Description
runTest This task executes all unit test classes in your organization but it is also possible execute some unit tests using wildcards or using an engine to infer what tests run.

Package Management tasks

Task Description
installPackage Installs a package to an organization.
uninstallPackage Uninstalls a package from an organization.

Utils tasks

Task Description
execute This task is able to execute code apex.

Development

Here you can find required information that is enough to have a Gradle project with Enforce running. If you are interested in developing new features or just compile and pack the source code, you will have helpful information at Development page