Save ipfs version used to initialize config
Peter Borzov committed
Oct 6, 2014 at 16:37 UTC
c8678666e3409216c4afc8c25bf1a0589efe7d0f
4 files changed
+11
-3
.gitignore
+2
-1
@@ -1,4 +1,5 @@
1
-cpu.prof # ipfs can generate profiling dump files
1
+# ipfs can generate profiling dump files
2
+cpu.prof
3
4
*.swp
5
.ipfsconfig
cmd/ipfs/init.go
+3
-1
@@ -135,8 +135,10 @@ func initCmd(c *commander.Command, inp []string) error {
135
},
136
}
137
138
+ // tracking ipfs version used to generate the init folder and adding update checker default setting.
139
cfg.Updates = config.Updates{
139
- Check: "error",
140
+ Check: "error",
141
+ Version: currentVersion.String(),
142
}
143
144
err = config.WriteConfigFile(filename, cfg)
cmd/ipfs/version.go
+4
@@ -1,6 +1,7 @@
1
package main
2
3
import (
4
+ semver "github.com/coreos/go-semver/semver"
5
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
6
u "github.com/jbenet/go-ipfs/util"
7
)
@@ -18,7 +19,10 @@ var cmdIpfsVersion = &commander.Command{
19
Run: versionCmd,
20
}
21
22
+var currentVersion *semver.Version
23
+
24
func init() {
25
+ currentVersion, _ = semver.NewVersion(Version)
26
cmdIpfsVersion.Flag.Bool("number", false, "show only the number")
27
}
28
config/config.go
+2
-1
@@ -47,7 +47,8 @@ func (bp *BootstrapPeer) String() string {
47
48
// Updates regulates checking and downloading for application's most recent version
49
type Updates struct {
50
- Check string `json:"check"` // "ignore" for do not check, "warn" and "error" for reacting when obsolete
50
+ Check string `json:"check"` // "ignore" for do not check, "warn" and "error" for reacting when obsolete
51
+ Version string `json: "version"` // ipfs version for which config was generated
52
}
53
54
// Config is used to load IPFS config files.