Skip to content

Commit 9cd874b

Browse files
committed
Merge pull request #84 from arduino/allowupdatefordev
Allow update for dev
2 parents d72645e + 82a4b4e commit 9cd874b

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

updater/updater.go

+14-24
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import (
1212
"os"
1313
"path/filepath"
1414
"runtime"
15-
"strings"
1615
"time"
1716

1817
log "github.com/Sirupsen/logrus"
18+
"github.com/inconshreveable/go-update"
1919
"github.com/kr/binarydist"
2020

21-
"github.com/inconshreveable/go-update"
2221
"github.com/kardianos/osext"
2322
)
2423

@@ -90,22 +89,20 @@ type Updater struct {
9089
// BackgroundRun starts the update check and apply cycle.
9190
func (u *Updater) BackgroundRun() error {
9291
os.MkdirAll(u.getExecRelativeDir(u.Dir), 0777)
93-
if u.wantUpdate() {
94-
if err := up.CanUpdate(); err != nil {
95-
log.Println(err)
96-
return err
97-
}
98-
//self, err := osext.Executable()
99-
//if err != nil {
100-
// fail update, couldn't figure out path to self
101-
//return
102-
//}
103-
// TODO(bgentry): logger isn't on Windows. Replace w/ proper error reports.
104-
if err := u.update(); err != nil {
105-
return err
106-
}
92+
if err := up.CanUpdate(); err != nil {
93+
log.Println(err)
94+
return err
95+
}
96+
//self, err := osext.Executable()
97+
//if err != nil {
98+
// fail update, couldn't figure out path to self
99+
//return
100+
//}
101+
// TODO(bgentry): logger isn't on Windows. Replace w/ proper error reports.
102+
if err := u.update(); err != nil {
103+
return err
107104
}
108-
return errors.New("Won't update because it's a development daemon. Change the version in main.go")
105+
return nil
109106
}
110107

111108
func fetch(url string) (io.ReadCloser, error) {
@@ -255,10 +252,3 @@ func (u *Updater) update() error {
255252

256253
return nil
257254
}
258-
259-
func (u *Updater) wantUpdate() bool {
260-
if strings.Contains(u.CurrentVersion, "dev") {
261-
return false
262-
}
263-
return true
264-
}

0 commit comments

Comments
 (0)