update dist

This commit is contained in:
David Dollar
2015-01-01 21:37:06 -05:00
parent a57f863d8d
commit 0746ea7f70
2 changed files with 16 additions and 5 deletions
+2 -2
View File
@@ -13,8 +13,8 @@
},
{
"ImportPath": "github.com/ddollar/dist",
"Comment": "v0.2.0",
"Rev": "95b3220dbc9bb70c4cbda93b4064655a1ff86a06"
"Comment": "v0.2.0-2-gf559761",
"Rev": "f559761fd36c52dc90d7d2c0bc537e6d96b0edc5"
},
{
"ImportPath": "github.com/ddollar/go-update",
+14 -3
View File
@@ -2,7 +2,7 @@
package dist
import (
"github.com/ddollar/forego/Godeps/_workspace/src/bitbucket.org/kardianos/osext"
"bitbucket.org/kardianos/osext"
"bytes"
"crypto/tls"
"crypto/x509"
@@ -10,8 +10,8 @@ import (
"encoding/pem"
"errors"
"fmt"
"github.com/inconshreveable/go-update"
"github.com/ddollar/forego/Godeps/_workspace/src/github.com/kr/binarydist"
"github.com/ddollar/go-update"
"github.com/kr/binarydist"
"io/ioutil"
"net/http"
"os"
@@ -102,6 +102,17 @@ func (d *Dist) UpdateTo(to string) (err error) {
return
}
// Update to a specific version regardless of the starting version
func (d *Dist) FullUpdate(to string) (err error) {
url := fmt.Sprintf("%s/projects/%s/releases/%s/%s-%s/%s", d.Host, d.Project, to, runtime.GOOS, runtime.GOARCH, d.Name)
reader, err := d.httpGet(url)
if err != nil {
return err
}
err, _ = update.FromStream(bytes.NewReader(reader))
return
}
func (d *Dist) fetchReleases() (releases []Release, err error) {
body, err := d.httpGet(fmt.Sprintf("%s/projects/%s/releases/%s-%s", d.Host, d.Project, runtime.GOOS, runtime.GOARCH))
if err != nil {