Permalink
Browse files

Install nut into <prefix>/<vendor>/<name>.

  • Loading branch information...
1 parent 732b7be commit eb2e998c85ca845324bfcbe1213e55940ffde9de @AlekSi committed Feb 17, 2013
Showing with 18 additions and 19 deletions.
  1. +2 −1 CHANGELOG
  2. +2 −2 integration_test/local_test.go
  3. +2 −2 nut.go
  4. +11 −13 nut/get_test.go
  5. +1 −1 nut_test.go
View
@@ -1,9 +1,10 @@
2013-02-zz: develop
+ Add vendors.
+ * `nut install` now installs into <prefix>/<vendor>/<name> (omits version component).
+ `nut get` now downloads and installs all dependencies (recursive).
+ `nut get` now may be used without arguments.
- + New API for Nut: FilePath(), ImportPath()
* `nut pack` now includes files for all OSes.
+ + New API for Nut: FilePath(), ImportPath()
* Fix bug with `nut get` and www.-prefixed hosts.
* Fix some issues on Windows.
- Disallow package names ending with "_".
@@ -106,7 +106,7 @@ func (*L) TestPackInstall(c *C) {
gitNoDiff(c, TestNut1)
_, stderr = runNut(c, TestNut1, "install -v test_nut1-0.0.1.nut")
- c.Check(strings.HasSuffix(stderr, "localhost/AlekSi/test_nut1/0.0.1"), Equals, true)
+ c.Check(strings.HasSuffix(stderr, "localhost/AlekSi/test_nut1"), Equals, true)
stdout, _ = runGo(c, TestNut1, "list all")
var newPackages []string
@@ -115,5 +115,5 @@ func (*L) TestPackInstall(c *C) {
newPackages = append(newPackages, p)
}
}
- c.Check(newPackages, DeepEquals, []string{"localhost/AlekSi/test_nut1/0.0.1"})
+ c.Check(newPackages, DeepEquals, []string{"localhost/AlekSi/test_nut1"})
}
View
4 nut.go
@@ -65,9 +65,9 @@ func (nut *Nut) FilePath(prefix string) string {
return filepath.Join(prefix, nut.Vendor, nut.FileName())
}
-// Returns canonical import path in format <prefix>/<vendor>/<name>/<version>
+// Returns canonical import path in format <prefix>/<vendor>/<name>
func (nut *Nut) ImportPath(prefix string) string {
- return fmt.Sprintf("%s/%s/%s/%s", prefix, nut.Vendor, nut.Name, nut.Version)
+ return fmt.Sprintf("%s/%s/%s", prefix, nut.Vendor, nut.Name)
}
// Since Nut embeds Spec, code "Nut.ReadFrom()" will call Nut.Spec.ReadFrom(),
View
@@ -24,24 +24,22 @@ func (g *G) TearDownSuite(*C) {
func (*G) TestArgToURL(c *C) {
// short style
- c.Check(ArgToURL("test_nut1").String(), Equals, "http://server/test_nut1")
- c.Check(ArgToURL("test_nut1/0.0.1").String(), Equals, "http://server/test_nut1/0.0.1")
+ c.Check(ArgToURL("AlekSi/test_nut1").String(), Equals, "http://server/AlekSi/test_nut1")
+ c.Check(ArgToURL("AlekSi/test_nut1/0.0.1").String(), Equals, "http://server/AlekSi/test_nut1/0.0.1")
// import path style
- c.Check(ArgToURL("gonuts.io/test_nut1").String(), Equals, "http://server/test_nut1")
- c.Check(ArgToURL("gonuts.io/test_nut1/0.0.1").String(), Equals, "http://server/test_nut1/0.0.1")
- c.Check(ArgToURL("express42.com/nuts/test_nut1").String(), Equals, "http://express42.com/nuts/test_nut1")
- c.Check(ArgToURL("express42.com/nuts/test_nut1/0.0.1").String(), Equals, "http://express42.com/nuts/test_nut1/0.0.1")
+ c.Check(ArgToURL("gonuts.io/AlekSi/test_nut1").String(), Equals, "http://server/AlekSi/test_nut1")
+ c.Check(ArgToURL("express42.com/nuts/AlekSi/test_nut1").String(), Equals, "http://express42.com/nuts/AlekSi/test_nut1")
// full URL - as is
- c.Check(ArgToURL("http://www.gonuts.io/test_nut1").String(), Equals, "http://www.gonuts.io/test_nut1")
- c.Check(ArgToURL("http://www.gonuts.io/test_nut1/0.0.1").String(), Equals, "http://www.gonuts.io/test_nut1/0.0.1")
- c.Check(ArgToURL("http://localhost:8080/test_nut1-0.0.1.nut").String(), Equals, "http://localhost:8080/test_nut1-0.0.1.nut")
- c.Check(ArgToURL("http://example.com/test_nut1-0.0.1.nut").String(), Equals, "http://example.com/test_nut1-0.0.1.nut")
- c.Check(ArgToURL("https://example.com/test_nut1-0.0.1.nut").String(), Equals, "https://example.com/test_nut1-0.0.1.nut")
+ c.Check(ArgToURL("http://www.gonuts.io/AlekSi/test_nut1").String(), Equals, "http://www.gonuts.io/AlekSi/test_nut1")
+ c.Check(ArgToURL("http://www.gonuts.io/AlekSi/test_nut1/0.0.1").String(), Equals, "http://www.gonuts.io/AlekSi/test_nut1/0.0.1")
+ c.Check(ArgToURL("http://localhost:8080/AlekSi/test_nut1-0.0.1.nut").String(), Equals, "http://localhost:8080/AlekSi/test_nut1-0.0.1.nut")
+ c.Check(ArgToURL("http://express42.com/nuts/AlekSi/test_nut1-0.0.1.nut").String(), Equals, "http://express42.com/nuts/AlekSi/test_nut1-0.0.1.nut")
+ c.Check(ArgToURL("https://express42.com/nuts/AlekSi/test_nut1-0.0.1.nut").String(), Equals, "https://express42.com/nuts/AlekSi/test_nut1-0.0.1.nut")
}
func (*G) TestNutImports(c *C) {
- actual := NutImports([]string{"fmt", "log/syslog", "github.com/AlekSi/nut", "gonuts.io/test_nut1"})
- c.Check(actual, DeepEquals, []string{"gonuts.io/test_nut1"})
+ actual := NutImports([]string{"fmt", "log/syslog", "github.com/AlekSi/nut", "gonuts.io/AlekSi/test_nut1"})
+ c.Check(actual, DeepEquals, []string{"gonuts.io/AlekSi/test_nut1"})
}
View
@@ -44,7 +44,7 @@ func (f *N) TestNutFile(c *C) {
c.Check(nf.Name, Equals, "test_nut1")
c.Check(nf.FileName(), Equals, "test_nut1-0.0.1.nut")
c.Check(nf.FilePath("prefix"), Equals, filepath.FromSlash("prefix/AlekSi/test_nut1-0.0.1.nut"))
- c.Check(nf.ImportPath("prefix"), Equals, "prefix/AlekSi/test_nut1/0.0.1")
+ c.Check(nf.ImportPath("prefix"), Equals, "prefix/AlekSi/test_nut1")
c.Check(nf.Doc, Equals, "Package test_nut1 is used to test nut.")
c.Check(nf.GoFiles, DeepEquals, []string{"test_nut1.go", fmt.Sprintf("test_nut1_%s.go", runtime.GOOS)})

0 comments on commit eb2e998

Please sign in to comment.