[in] creates file 'tag' containing git tag for the release being fetched
This commit is contained in:
@@ -28,6 +28,8 @@ Fetches artifacts from the given release version. If the version is not
|
|||||||
specified, the latest version is chosen using [semver](http://semver.org)
|
specified, the latest version is chosen using [semver](http://semver.org)
|
||||||
semantics.
|
semantics.
|
||||||
|
|
||||||
|
Creates a file `tag` containing the tag name/version of the release being fetched.
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
* `globs`: *Optional.* A list of globs for files that will be downloaded from
|
* `globs`: *Optional.* A list of globs for files that will be downloaded from
|
||||||
|
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -58,6 +59,12 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
|
|||||||
return InResponse{}, fmt.Errorf("could not find release with tag: %s", request.Version.Tag)
|
return InResponse{}, fmt.Errorf("could not find release with tag: %s", request.Version.Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tagPath := filepath.Join(destDir, "tag")
|
||||||
|
err = ioutil.WriteFile(tagPath, []byte(*foundRelease.TagName), 0644)
|
||||||
|
if err != nil {
|
||||||
|
return InResponse{}, err
|
||||||
|
}
|
||||||
|
|
||||||
assets, err := c.github.ListReleaseAssets(foundRelease)
|
assets, err := c.github.ListReleaseAssets(foundRelease)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return InResponse{}, err
|
return InResponse{}, err
|
||||||
|
@@ -236,6 +236,16 @@ var _ = Describe("In Command", func() {
|
|||||||
))
|
))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("stores tag in a file", func() {
|
||||||
|
_, err := os.Stat(filepath.Join(destDir, "tag"))
|
||||||
|
Ω(err).ShouldNot(HaveOccurred())
|
||||||
|
|
||||||
|
tag, err := ioutil.ReadFile(filepath.Join(destDir, "tag"))
|
||||||
|
Ω(err).ShouldNot(HaveOccurred())
|
||||||
|
|
||||||
|
Ω(string(tag)).Should(Equal("v0.35.0"))
|
||||||
|
})
|
||||||
|
|
||||||
It("fetches from the latest release", func() {
|
It("fetches from the latest release", func() {
|
||||||
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
|
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
|
||||||
Ω(err).ShouldNot(HaveOccurred())
|
Ω(err).ShouldNot(HaveOccurred())
|
||||||
|
Reference in New Issue
Block a user