cmds2: check for updates

This commit is contained in:
Juan Batiz-Benet 2014-11-14 02:38:39 -08:00
parent e4b630289a
commit fa8fc1aefc
3 changed files with 15 additions and 9 deletions

View File

@ -15,9 +15,10 @@ import (
cmds "github.com/jbenet/go-ipfs/commands"
cmdsCli "github.com/jbenet/go-ipfs/commands/cli"
cmdsHttp "github.com/jbenet/go-ipfs/commands/http"
"github.com/jbenet/go-ipfs/config"
"github.com/jbenet/go-ipfs/core"
config "github.com/jbenet/go-ipfs/config"
core "github.com/jbenet/go-ipfs/core"
daemon "github.com/jbenet/go-ipfs/daemon2"
updates "github.com/jbenet/go-ipfs/updates"
u "github.com/jbenet/go-ipfs/util"
)
@ -207,12 +208,12 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) {
return nil, err
}
if useDaemon {
cfg, err := req.Context().GetConfig()
if err != nil {
return nil, err
}
cfg, err := req.Context().GetConfig()
if err != nil {
return nil, err
}
if useDaemon {
addr, err := ma.NewMultiaddr(cfg.Addresses.API)
if err != nil {
@ -235,6 +236,11 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) {
} else {
log.Info("Executing command locally")
// Check for updates and potentially install one.
if err := updates.CliCheckForUpdates(cfg, req.Context().ConfigRoot); err != nil {
return nil, err
}
// this sets up the function that will initialize the node
// this is so that we can construct the node lazily.
ctx := req.Context()

View File

@ -8,7 +8,7 @@ import (
)
// CurrentVersionNumber is the current application's version literal
const CurrentVersionNumber = "0.1.6"
const CurrentVersionNumber = "0.1.7"
// Version regulates checking if the most recent version is run
type Version struct {

View File

@ -200,7 +200,7 @@ func CliCheckForUpdates(cfg *config.Config, confFile string) error {
// if config says not to, don't check for updates
if !cfg.Version.ShouldCheckForUpdate() {
log.Info("update checking disabled.")
log.Info("update check skipped.")
return nil
}