Skip to content
This repository
Browse code

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

  • Loading branch information...
commit eb2e998c85ca845324bfcbe1213e55940ffde9de 1 parent 732b7be
Alexey Palazhchenko authored
3  CHANGELOG
... ... @@ -1,9 +1,10 @@
1 1 2013-02-zz: develop
2 2 + Add vendors.
  3 + * `nut install` now installs into <prefix>/<vendor>/<name> (omits version component).
3 4 + `nut get` now downloads and installs all dependencies (recursive).
4 5 + `nut get` now may be used without arguments.
5   - + New API for Nut: FilePath(), ImportPath()
6 6 * `nut pack` now includes files for all OSes.
  7 + + New API for Nut: FilePath(), ImportPath()
7 8 * Fix bug with `nut get` and www.-prefixed hosts.
8 9 * Fix some issues on Windows.
9 10 - Disallow package names ending with "_".
4 integration_test/local_test.go
@@ -106,7 +106,7 @@ func (*L) TestPackInstall(c *C) {
106 106 gitNoDiff(c, TestNut1)
107 107
108 108 _, stderr = runNut(c, TestNut1, "install -v test_nut1-0.0.1.nut")
109   - c.Check(strings.HasSuffix(stderr, "localhost/AlekSi/test_nut1/0.0.1"), Equals, true)
  109 + c.Check(strings.HasSuffix(stderr, "localhost/AlekSi/test_nut1"), Equals, true)
110 110
111 111 stdout, _ = runGo(c, TestNut1, "list all")
112 112 var newPackages []string
@@ -115,5 +115,5 @@ func (*L) TestPackInstall(c *C) {
115 115 newPackages = append(newPackages, p)
116 116 }
117 117 }
118   - c.Check(newPackages, DeepEquals, []string{"localhost/AlekSi/test_nut1/0.0.1"})
  118 + c.Check(newPackages, DeepEquals, []string{"localhost/AlekSi/test_nut1"})
119 119 }
4 nut.go
@@ -65,9 +65,9 @@ func (nut *Nut) FilePath(prefix string) string {
65 65 return filepath.Join(prefix, nut.Vendor, nut.FileName())
66 66 }
67 67
68   -// Returns canonical import path in format <prefix>/<vendor>/<name>/<version>
  68 +// Returns canonical import path in format <prefix>/<vendor>/<name>
69 69 func (nut *Nut) ImportPath(prefix string) string {
70   - return fmt.Sprintf("%s/%s/%s/%s", prefix, nut.Vendor, nut.Name, nut.Version)
  70 + return fmt.Sprintf("%s/%s/%s", prefix, nut.Vendor, nut.Name)
71 71 }
72 72
73 73 // Since Nut embeds Spec, code "Nut.ReadFrom()" will call Nut.Spec.ReadFrom(),
24 nut/get_test.go
@@ -24,24 +24,22 @@ func (g *G) TearDownSuite(*C) {
24 24
25 25 func (*G) TestArgToURL(c *C) {
26 26 // short style
27   - c.Check(ArgToURL("test_nut1").String(), Equals, "http://server/test_nut1")
28   - c.Check(ArgToURL("test_nut1/0.0.1").String(), Equals, "http://server/test_nut1/0.0.1")
  27 + c.Check(ArgToURL("AlekSi/test_nut1").String(), Equals, "http://server/AlekSi/test_nut1")
  28 + c.Check(ArgToURL("AlekSi/test_nut1/0.0.1").String(), Equals, "http://server/AlekSi/test_nut1/0.0.1")
29 29
30 30 // import path style
31   - c.Check(ArgToURL("gonuts.io/test_nut1").String(), Equals, "http://server/test_nut1")
32   - c.Check(ArgToURL("gonuts.io/test_nut1/0.0.1").String(), Equals, "http://server/test_nut1/0.0.1")
33   - c.Check(ArgToURL("express42.com/nuts/test_nut1").String(), Equals, "http://express42.com/nuts/test_nut1")
34   - c.Check(ArgToURL("express42.com/nuts/test_nut1/0.0.1").String(), Equals, "http://express42.com/nuts/test_nut1/0.0.1")
  31 + c.Check(ArgToURL("gonuts.io/AlekSi/test_nut1").String(), Equals, "http://server/AlekSi/test_nut1")
  32 + c.Check(ArgToURL("express42.com/nuts/AlekSi/test_nut1").String(), Equals, "http://express42.com/nuts/AlekSi/test_nut1")
35 33
36 34 // full URL - as is
37   - c.Check(ArgToURL("http://www.gonuts.io/test_nut1").String(), Equals, "http://www.gonuts.io/test_nut1")
38   - c.Check(ArgToURL("http://www.gonuts.io/test_nut1/0.0.1").String(), Equals, "http://www.gonuts.io/test_nut1/0.0.1")
39   - c.Check(ArgToURL("http://localhost:8080/test_nut1-0.0.1.nut").String(), Equals, "http://localhost:8080/test_nut1-0.0.1.nut")
40   - c.Check(ArgToURL("http://example.com/test_nut1-0.0.1.nut").String(), Equals, "http://example.com/test_nut1-0.0.1.nut")
41   - c.Check(ArgToURL("https://example.com/test_nut1-0.0.1.nut").String(), Equals, "https://example.com/test_nut1-0.0.1.nut")
  35 + c.Check(ArgToURL("http://www.gonuts.io/AlekSi/test_nut1").String(), Equals, "http://www.gonuts.io/AlekSi/test_nut1")
  36 + 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")
  37 + 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")
  38 + 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")
  39 + 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")
42 40 }
43 41
44 42 func (*G) TestNutImports(c *C) {
45   - actual := NutImports([]string{"fmt", "log/syslog", "github.com/AlekSi/nut", "gonuts.io/test_nut1"})
46   - c.Check(actual, DeepEquals, []string{"gonuts.io/test_nut1"})
  43 + actual := NutImports([]string{"fmt", "log/syslog", "github.com/AlekSi/nut", "gonuts.io/AlekSi/test_nut1"})
  44 + c.Check(actual, DeepEquals, []string{"gonuts.io/AlekSi/test_nut1"})
47 45 }
2  nut_test.go
@@ -44,7 +44,7 @@ func (f *N) TestNutFile(c *C) {
44 44 c.Check(nf.Name, Equals, "test_nut1")
45 45 c.Check(nf.FileName(), Equals, "test_nut1-0.0.1.nut")
46 46 c.Check(nf.FilePath("prefix"), Equals, filepath.FromSlash("prefix/AlekSi/test_nut1-0.0.1.nut"))
47   - c.Check(nf.ImportPath("prefix"), Equals, "prefix/AlekSi/test_nut1/0.0.1")
  47 + c.Check(nf.ImportPath("prefix"), Equals, "prefix/AlekSi/test_nut1")
48 48 c.Check(nf.Doc, Equals, "Package test_nut1 is used to test nut.")
49 49 c.Check(nf.GoFiles, DeepEquals, []string{"test_nut1.go", fmt.Sprintf("test_nut1_%s.go", runtime.GOOS)})
50 50

0 comments on commit eb2e998

Please sign in to comment.
Something went wrong with that request. Please try again.