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!

  1. Top-level metadata object classes go in lib/mdata/metadata.
  2. Classes that encapsulate field types go in lib/mdata/types.
  3. Add your commands to the bin/mdata script using existing commands as an example.
  4. You may also want to add an alias down at the bottom of the script.
  5. Create unit tests in the tests/ directory, and run rake to ensure they pass.

Making a release

Release tags starting with v1.4.1 are signed by Ben Burwell [email protected] with GPG key 0x711D3727 and can be verified by running:

$ git tag --verify v0.0.0

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.

  1. Create an entry in CHANGELOG.markdown for v0.0.0 and list the newly added features, fixed bugs, deprecated commands, etc.
  2. Make sure any newly-created files have been added to mdata.gemspec (if necessary)
  3. Run rake. DO NOT PROCEED IF THERE ARE ERRORS/FAILURES.
  4. Run ./release.sh 0.0.0 to update the internal version info, push a signed release tag, and build and push the RubyGem