mdata
mdata is a command line tool for interacting with Salesforce metadata XML files. To install, just use gem install mdata.
You can get a list of options by running mdata help. By default, mdata looks in the right directory for the object. The general command format is:
mdata OBJECT PROPERTY:ACTION OPTIONS
For example, running mdata profile fieldPermissions:read --profile Admin would look for a file named ./src/profiles/Admin.profile. If you need to look in another directory, there is a global --dir option that you can set.
Since these commands get long, there are also shortcuts. The two commands below are synonymous:
mdata profile fieldPermissions:read --profile Admin
mdata pr fp:r --profile Admin
A full list of aliases is available by running mdata help.
Currently Supported Actions
- Create a new profile
- Read field permissions from a profile
- Set field permissions for a field on a profile
- Add field permissions to a field on a profile
- Remove field permissions from a field on a profile
- Copy field permissions from one field to another and/or one profile to another
- Delete field permissions from a profile (e.g. field was deleted)
Contribute!
Command you need isn't yet implemented? Add it!
- Top-level metadata object classes go in
lib/mdata/metadata. - Classes that encapsulate field types go in
lib/mdata/types. - Add your commands to the
bin/mdatascript using existing commands as an example. - You may also want to add an alias down at the bottom of the script.
- Create unit tests in the
tests/directory, and runraketo ensure they pass.
Making a release
Making a release is not hard, but there are several steps. Perform these steps from the command line in the project directory.
In this example, we will release version 0.0.0 of mdata. The version number should conform to semver standards.
Note: These are the ONLY changes that should be made in master, all others should be made in topic branches.
- Create an entry in
CHANGELOG.markdownfor v0.0.0 and list the newly added features, fixed bugs, deprecated commands, etc. - Make sure any newly-created files have been added to
mdata.gemspec(if necessary) - Run
rake. DO NOT PROCEED IF THERE ARE ERRORS/FAILURES. - Update the version to 0.0.0 in
bin/mdata. - Update the version to 0.0.0 in
mdata.gemspec. git add bin/mdata mdata.gemspecgit commit -m "Bump version to 0.0.0"git tag -a v0.0.0 -m "Release version 0.0.0 to RubyGems"gem build mdata.gemspecgem push mdata-0.0.0.gem