Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #157 from amtrack/fix-changeset-create-with-patterns
Browse files Browse the repository at this point in the history
fix: creating changesets with explicit patterns
  • Loading branch information
amtrack authored Jun 30, 2018
2 parents 035fee8 + cb77eda commit 4718002
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Succeeded

1\. By explicitly listing metadata files or metadata components
```console
$ force-dev-tool changeset create vat src/pages/AccountExtensionVAT.page CustomField/Account.VAT__c
$ echo "" | force-dev-tool changeset create vat src/pages/AccountExtensionVAT.page CustomField/Account.VAT__c
```

2\. By providing a unified diff (e.g. `git diff`). Tweak the `git diff` command with `--ignore-space-at-eol` or `--ignore-all-space` to ignore space changes.
Expand Down Expand Up @@ -134,7 +134,7 @@ exported metadata container to config/deployments/vat

1\. By explicitly listing metadata files or metadata components
```console
$ force-dev-tool changeset create undo-vat --destructive src/pages/AccountExtensionVAT.page CustomField/Account.VAT__c
$ echo "" | force-dev-tool changeset create undo-vat --destructive src/pages/AccountExtensionVAT.page CustomField/Account.VAT__c
```

2\. By providing a unified diff (e.g. `git diff`)
Expand Down
2 changes: 1 addition & 1 deletion lib/metadata-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ MetadataContainer.completeMetadataStream = function(opts) {
opts = opts || {};
return miss.through.obj(function(metadataContainer, enc, cb) {

metadataContainer.completeMetadataWith({
metadataContainer = metadataContainer.completeMetadataWith({
path: opts.path || 'src'
}).filter(metadataContainer.manifest);
metadataContainer.manifest.rollup();
Expand Down
57 changes: 57 additions & 0 deletions test-integration/changeset.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,60 @@ describe("git diff | force-dev-tool changeset create", function() {
});
});
});

var explicitTests = [{
gitCloneUrl: "https://github.com/amtrack/sfdx-playground.git",
branch: "explicit-custom-field",
description: "should extract a single CustomField from a CustomObject",
patterns: ["CustomField/Account.VAT_Number__c"],
unpackaged_path: "src",
expected: path.join("config", "deployments", "expected")
}];

describe("force-dev-tool changeset create ...", function() {
var fdt = path.resolve(__dirname, "..", "bin", "cli");
explicitTests.forEach(function(test) {
it(test.description, function() {
if (test.skip) {
this.skip();
}
this.slow(5000);
this.timeout(20000);
var tmpobj = tmp.dirSync();
var gitDir = tmpobj.name;
var gitCloneCmd = child.spawnSync(
"git", ["clone", test.gitCloneUrl, gitDir], {
cwd: gitDir
}
);
assert.deepEqual(gitCloneCmd.status, 0, gitCloneCmd.stderr);
var gitCheckoutCmd = child.spawnSync("git", ["checkout", test.branch], {
cwd: gitDir
});
assert.deepEqual(gitCheckoutCmd.status, 0, gitCheckoutCmd.stderr);
var changesetArgs = [fdt, "changeset", "create", "test"];
[].push.apply(changesetArgs, test.patterns);
var changesetCreateCmd = child.spawnSync(
"node", changesetArgs, {
cwd: gitDir
}
);
assert.deepEqual(
changesetCreateCmd.status,
0,
changesetCreateCmd.stdout
);
var diffDirsCmd = child.spawnSync(
"diff", [
"-u",
"-r",
path.join(gitDir, test.expected),
path.join(gitDir, "config", "deployments", "test")
], {
cwd: gitDir
}
);
assert.deepEqual(diffDirsCmd.status, 0, diffDirsCmd.stdout);
});
});
});

0 comments on commit 4718002

Please sign in to comment.