add metadata to in command output

[#76848252]

Signed-off-by: Chris Brown <cbrown@pivotal.io>
This commit is contained in:
Alex Suraci
2015-02-18 09:55:42 -08:00
committed by Chris Brown
parent 2878392b08
commit 3dc650adc8
3 changed files with 24 additions and 2 deletions

View File

@@ -94,6 +94,11 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
Version: Version{
Tag: *foundRelease.TagName,
},
Metadata: []MetadataPair{
{Name: "name", Value: *foundRelease.Name, URL: *foundRelease.HTMLURL},
{Name: "url", Value: *foundRelease.HTMLURL},
{Name: "body", Value: *foundRelease.Body, Markdown: true},
},
}, nil
}

View File

@@ -55,9 +55,16 @@ var _ = Describe("In Command", func() {
})
buildRelease := func(id int, tag string) github.RepositoryRelease {
url := "http://google.com"
name := "release-name"
body := "*markdown*"
return github.RepositoryRelease{
ID: &id,
TagName: &tag,
HTMLURL: &url,
Name: &name,
Body: &body,
}
}
@@ -106,6 +113,14 @@ var _ = Describe("In Command", func() {
Ω(inResponse.Version).Should(Equal(resource.Version{Tag: "v0.35.0"}))
})
It("has some sweet metadata", func() {
Ω(inResponse.Metadata).Should(ConsistOf(
resource.MetadataPair{Name: "url", Value: "http://google.com"},
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
))
})
It("downloads only the files that match the globs", func() {
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
Ω(err).ShouldNot(HaveOccurred())

View File

@@ -50,6 +50,8 @@ type Version struct {
}
type MetadataPair struct {
Name string `json:"name"`
Value string `json:"value"`
Name string `json:"name"`
Value string `json:"value"`
URL string `json:"url"`
Markdown bool `json:"markdown"`
}