add metadata to in command output
[#76848252] Signed-off-by: Chris Brown <cbrown@pivotal.io>
This commit is contained in:
@@ -94,6 +94,11 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
|
|||||||
Version: Version{
|
Version: Version{
|
||||||
Tag: *foundRelease.TagName,
|
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
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,9 +55,16 @@ var _ = Describe("In Command", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
buildRelease := func(id int, tag string) github.RepositoryRelease {
|
buildRelease := func(id int, tag string) github.RepositoryRelease {
|
||||||
|
url := "http://google.com"
|
||||||
|
name := "release-name"
|
||||||
|
body := "*markdown*"
|
||||||
|
|
||||||
return github.RepositoryRelease{
|
return github.RepositoryRelease{
|
||||||
ID: &id,
|
ID: &id,
|
||||||
TagName: &tag,
|
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"}))
|
Ω(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() {
|
It("downloads only the files that match the globs", func() {
|
||||||
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
|
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
|
||||||
Ω(err).ShouldNot(HaveOccurred())
|
Ω(err).ShouldNot(HaveOccurred())
|
||||||
|
@@ -50,6 +50,8 @@ type Version struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MetadataPair struct {
|
type MetadataPair struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Markdown bool `json:"markdown"`
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user