Include ability to add tag_prefix

Signed-off-by: Zachary Gershman <zgershman@pivotal.io>
This commit is contained in:
Angela Chin
2015-11-18 12:42:41 -08:00
committed by Zachary Gershman
parent 8291efc7a7
commit 560637e9fd
4 changed files with 32 additions and 0 deletions

View File

@@ -91,6 +91,9 @@ matching the patterns in `globs` to the release.
* `tag`: *Required.* A path to a file containing the name of the Git tag to use
for the release.
* `tag_prefix`: *Optional.* If specified, the tag read from the file will be
prepended with this string. This is useful for adding v in front of version numbers.
* `commitish`: *Optional.* A path to a file containing the commitish (SHA, tag,
branch name) that the release should be associated with.

View File

@@ -36,6 +36,8 @@ func (c *OutCommand) Run(sourceDir string, request OutRequest) (OutResponse, err
return OutResponse{}, err
}
tag = request.Params.TagPrefix + tag
var body string
bodySpecified := false
if request.Params.BodyPath != "" {

View File

@@ -347,5 +347,31 @@ var _ = Describe("Out Command", func() {
Ω(err).Should(MatchError("could not find file that matches glob '*.gif'"))
})
})
Context("when the tag_prefix is set", func() {
BeforeEach(func() {
namePath := filepath.Join(sourcesDir, "name")
tagPath := filepath.Join(sourcesDir, "tag")
file(namePath, "v0.3.12")
file(tagPath, "0.3.12")
request = resource.OutRequest{
Params: resource.OutParams{
NamePath: "name",
TagPath: "tag",
TagPrefix: "version-",
},
}
})
It("appends the TagPrefix onto the TagName", func() {
Ω(githubClient.CreateReleaseCallCount()).Should(Equal(1))
release := githubClient.CreateReleaseArgsForCall(0)
Ω(*release.Name).Should(Equal("v0.3.12"))
Ω(*release.TagName).Should(Equal("version-0.3.12"))
})
})
})
})

View File

@@ -41,6 +41,7 @@ type OutParams struct {
BodyPath string `json:"body"`
TagPath string `json:"tag"`
CommitishPath string `json:"commitish"`
TagPrefix string `json:"tag_prefix"`
Globs []string `json:"globs"`
}