Skip to content

Commit

Permalink
Merge pull request #261 from cwarden/fix-deploy-by-type
Browse files Browse the repository at this point in the history
Don't Add meta.xml Files to package.xml When Deploying
  • Loading branch information
dcarroll committed Feb 25, 2016
2 parents a9b1f36 + a983a12 commit d714450
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packagebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (pb *PackageBuilder) AddFile(fpath string) (fname string, err error) {
}

metaName, fname := getMetaTypeFromPath(fpath)
if !isDestructiveChanges && !strings.HasSuffix(fname, "-meta.xml") {
if !isDestructiveChanges && !strings.HasSuffix(fpath, "-meta.xml") {
pb.AddMetaToPackage(metaName, fname)
}

Expand Down
21 changes: 21 additions & 0 deletions packagebuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ var _ = Describe("Packagebuilder", func() {
})
})

Context("when adding a meta.xml file", func() {
var apexClassMetadataPath string

BeforeEach(func() {
os.MkdirAll(tempDir+"/src/classes", 0755)
apexClassMetadataPath = tempDir + "/src/classes/Test.cls-meta.xml"
apexClassMetadataContents := `<?xml version="1.0" encoding="UTF-8"?>`
ioutil.WriteFile(apexClassMetadataPath, []byte(apexClassMetadataContents), 0644)
})

It("should add the file to package", func() {
_, err := pb.AddFile(apexClassMetadataPath)
Expect(err).ToNot(HaveOccurred())
Expect(pb.Files).To(HaveKey("classes/Test.cls-meta.xml"))
})
It("should not add the file to the package.xml", func() {
pb.AddFile(apexClassMetadataPath)
Expect(pb.Metadata).ToNot(HaveKey("ApexClass"))
})
})

Context("when adding a CustomMetadata file", func() {
var customMetadataPath string

Expand Down

0 comments on commit d714450

Please sign in to comment.