@cryptotaxi247 / kubo / commits / fa8fc1aef

cmds2: check for updates

Juan Batiz-Benet committed Nov 14, 2014 at 02:38 UTC fa8fc1aefc2e6ad5f8dc3faaee8adfc2709343e0
3 files changed +15 -9
cmd/ipfs2/main.go
+13 -7
@@ -15,9 +15,10 @@ import (
15 cmds "github.com/jbenet/go-ipfs/commands"
16 cmdsCli "github.com/jbenet/go-ipfs/commands/cli"
17 cmdsHttp "github.com/jbenet/go-ipfs/commands/http"
18 - "github.com/jbenet/go-ipfs/config"
19 - "github.com/jbenet/go-ipfs/core"
18 + config "github.com/jbenet/go-ipfs/config"
19 + core "github.com/jbenet/go-ipfs/core"
20 daemon "github.com/jbenet/go-ipfs/daemon2"
21 + updates "github.com/jbenet/go-ipfs/updates"
22 u "github.com/jbenet/go-ipfs/util"
23 )
24
@@ -207,12 +208,12 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) {
208 return nil, err
209 }
210
210 - if useDaemon {
211 + cfg, err := req.Context().GetConfig()
212 + if err != nil {
213 + return nil, err
214 + }
215
212 - cfg, err := req.Context().GetConfig()
213 - if err != nil {
214 - return nil, err
215 - }
216 + if useDaemon {
217
218 addr, err := ma.NewMultiaddr(cfg.Addresses.API)
219 if err != nil {
@@ -235,6 +236,11 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) {
236 } else {
237 log.Info("Executing command locally")
238
239 + // Check for updates and potentially install one.
240 + if err := updates.CliCheckForUpdates(cfg, req.Context().ConfigRoot); err != nil {
241 + return nil, err
242 + }
243 +
244 // this sets up the function that will initialize the node
245 // this is so that we can construct the node lazily.
246 ctx := req.Context()
config/version.go
+1 -1
@@ -8,7 +8,7 @@ import (
8 )
9
10 // CurrentVersionNumber is the current application's version literal
11 -const CurrentVersionNumber = "0.1.6"
11 +const CurrentVersionNumber = "0.1.7"
12
13 // Version regulates checking if the most recent version is run
14 type Version struct {
updates/updates.go
+1 -1
@@ -200,7 +200,7 @@ func CliCheckForUpdates(cfg *config.Config, confFile string) error {
200
201 // if config says not to, don't check for updates
202 if !cfg.Version.ShouldCheckForUpdate() {
203 - log.Info("update checking disabled.")
203 + log.Info("update check skipped.")
204 return nil
205 }
206