Salesforce Package Manager
For Linux and macOS user
$ curl -sL http://install.freedom-man.com/spm | bash
If you want to install zsh completion, add --zsh-completion option
$ curl -sL http://install.freedom-man.com/spm | bash -s -- --zsh-completion
If you use macOS, home brew is available for installation.
$ brew tap tzmfreedom/spm
$ brew install spm
You can use docker to use spm command.
$ docker run --rm tzmfree/spm install {REPO} -u {USERNAME] -p {PASSWORD}
If you want to use latest version, execute following command.
$ go get -u github.com/tzmfreedom/spm
For Windows user, use Linux virtual machine, such as docker or vagrant.
$ spm [global options] command [command options] [arguments...]
COMMANDS:
install, i Install salesforce metadata on public remote repository(i.g. github) or salesforce org
clone, c Download metadata from salesforce organization
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
$ spm install [command options] [arguments...]
OPTIONS:
--username value, -u value [$SF_USERNAME]
--password value, -p value [$SF_PASSWORD]
--endpoint value, -e value (default: "login.salesforce.com") [$SF_ENDPOINT]
--apiversion value (default: "38.0") [$SF_APIVERSION]
--pollSeconds value (default: 5) [$SF_POLLSECONDS]
--timeoutSeconds value (default: 0) [$SF_TIMEOUTSECONDS]
--packages value, -P value
- Install from remote repository
$ spm install https://github.com/{USER}/{REPOSITORY} -u {USERNAME} -p {PASSWORD}
example:
$ spm install https://github.com/tzmfreedom/apex_tdclient -u hoge -p fuga
You can specify repository with following format.
{REMOTE_REPOSITORY_BASE}/{USER}/{REPOSITORY} # i.g. https://github.com/tzmfreedom/apex_tdclient
{REMOTE_REPOSITORY_BASE}/{USER}/{REPOSITORY}/{SUB_DIRECTORY} # i.g. https://github.com/tzmfreedom/apex_tdclient/sample/repositories/dependencies
{USER}/{REPOSITORY} # i.g. tzmfreedom/apex_tdclient
{USER}/{REPOSITORY}/{SUB_DIRECTORY} # i.g. tzmfreedom/spm/sample/repositories/dependencies
- Install from salesforce
$ spm install sf://{username}:{password}@{salesforce endpoint}?path={package file path}&version={version}
example:
$ spm install sf://hoge:[email protected]?path=./package.toml&version=38.0
- Install from package.yml
$ spm install -u {USERNAME} -p {PASSWORD} -P package.yml
Dependency package yaml format
packages:
- tzmfreedom/apex-util1
- tzmfreedom/apex-util2
- tzmfreedom/apex-util3
Sandbox
$ spm install https://github.com/{USER}/{REPOSITORY} -u {USERNAME} -p {PASSWORD} -e test.salesforce.com
$ spm clone sf://{username}:{password}@{salesforce endpoint}?path={package file path}&version={version}
example:
$ spm clone sf://hoge:[email protected]
The package file format for downloading from salesforce is toml.
- example
version = 37.0
[[types]]
name = "ApexClass"
members = ["Hoge", "Fuga"]
[[types]]
name = "CustomObject"
members = ["Account", "Contact"]
[[types]]
name = "ApexPage"
members = ["HogePage"]
[[types]]
name = "ApexTrigger"
members = ["HogeTrigger"]
[[types]]
name = "Layout"
members = ["Task-Task Layout"]
[[types]]
name = "Profile"
members = ["Admin"]
Just send pull request if needed or fill an issue!
The MIT License See LICENSE file.