I am setting up our Saleforce GIT repo and trying to plan out a solid workflow, but I'm unsure how to make it work with the Sublime Text 3: Salesforce IDE plugin (Refactored to HaoIDE) because it creates a separate (uniquely named) project folder (based on a package.xml file).
My first thought was to have to branches, one for production and one for development/sandbox, and then I would create bug and feature branches from the development branch (which represents my sandbox environment). For example:
production o-------o---------------------------------------------------o----------
\ /
development o-------o----------------o------------o---------o
\ \ / /
new-feature \ o--------------o----------o
\ /
hotfix o-------------o
The plugin has a settings file setup like this:
"projects":
{
"Production":
{
"allowed_packages":
[
],
"default": false,
"login_url": "https://login.salesforce.com",
"password": "********",
"production": "https://login.salesforce.com",
"sandbox": "https://test.salesforce.com",
"security_token": "Ucv1d984sdfbbg64py",
"username": "email@company.com"
},
"Sandbox": <<---- These cannot be the same, i.e. "Project-Name"
{
"allowed_packages":
[
],
"default": true,
"login_url": "https://test.salesforce.com",
"password": "********",
"security_token": "h94jhjhyn98bvtre7wg4ewtrh",
"username": "email@company.com.dev"
}
},
"workspace": "C:/projects/salesforce"
So with this setup my repo would have two separate folders. With 2 folders I can never actually merge one into the other. One additional thought I had was to make orphan branches so that each branch only has 1 folder but I'm not sure how this would look long term considering I still can't merge one branch into the other.
Note: Once the package.xml
is loaded and the packaged is downloaded both the Production and Sandbox folders will have a .config
folder with settings specific to the environment they're connected to which I forsee causing more issues so I plan to add .config
folder to the .gitignore
file
Best Answer
Setting up
SublimeApexHaoIDETo start, once you install
SublimeApexHaoIDE from Package Control and restart Sublime Text, you first need to setup your user settings as mentioned in the question above (this will establish your authentication to for any environment you wish to connect to)If you switch to any of these projects then a folder with a
.config
folder will appear in your workspace for authentication purposesSetting up your PROJECT package
Next, simply add a new project for your sandbox environment which will fetch the environment from your active project (in this case, Sandbox)
This will build a default
package.xml
that will package your active environment into a.zip
and then unpack them into the projects workspace or default workspace if there is not one declared for that project. In Sublime you should see the new folder like this.Setting up your CUSTOM/REPO package
Here's the trick. If the package you pulled down is complete for your purposes then you will skip this step. For me, I want to include things like sObjects and Custom Fields so that they can be used for deployment to other environments as well. So I need to make a separate custom package for this environment, do so by either of the following:
right-clicking on the sandbox folder,
SublimeApex > Create Package.xml
copy the current
package.xml
and move to the root of your project directory (preferred)Setup your custom package.xml
Since, for this example, we want sObjects and custom Fields we need to include the following:
Then save right-click anywhere in the file (make sure the correct environment/project is still active), and select SublimeApex > Retrieve Package.xml
Once your package has been fetched you should see a new folder
project-name-timestamp], for this example I got
Sandbox-201412171532and within it is the
src` file containing all the package components I want to version control in my repoNOW, that I have the
src
folder containing everything I want to be part of my repo I will move that folder into my Company Name folder like so:Setup GIT Repository
With this src file you can now setup
git init
and structure your branches however you need. Most likely something as described in the question above. The repository is one thing, the environments are another. What exist in your git repository is what actually exist because it is version controlled.You can deploy anything from within this repository using SublimeApex context menu. While in a file or by clicking any folder within the sidebar, select
SublimeApex > Deploy to Server
Hopefully this tutorial can help you get started with managing your Salesforce repository