Closes #99: glide get can now have a version specified
- previous pinning by default was implemented
- glide get github.com/Masterminds/convert#^1.0.0 is the pattern
- # is the separator between the location and version
diff --git a/cmd/flatten.go b/cmd/flatten.go
index 1df75ec..3866df2 100644
--- a/cmd/flatten.go
+++ b/cmd/flatten.go
@@ -37,6 +37,14 @@
return conf, nil
}
packages := p.Get("packages", []string{}).([]string)
+
+ // When packages are passed around with a #version on the end it needs
+ // to be stripped.
+ for k, v := range packages {
+ parts := strings.Split(v, "#")
+ packages[k] = parts[0]
+ }
+
force := p.Get("force", true).(bool)
vend, _ := VendorPath(c)
diff --git a/cmd/get_imports.go b/cmd/get_imports.go
index 4815175..8831acc 100644
--- a/cmd/get_imports.go
+++ b/cmd/get_imports.go
@@ -55,11 +55,18 @@
Info("Preparing to install %d package.", len(names))
+ cwd, err := VendorPath(c)
+ if err != nil {
+ return nil, err
+ }
+
deps := []*cfg.Dependency{}
for _, name := range names {
- cwd, err := VendorPath(c)
- if err != nil {
- return nil, err
+ var version string
+ parts := strings.Split(name, "#")
+ if len(parts) > 1 {
+ name = parts[0]
+ version = parts[1]
}
root := util.GetRootFromPackage(name)
@@ -88,6 +95,10 @@
Name: root,
}
+ if version != "" {
+ dep.Reference = version
+ }
+
// When retriving from an insecure location set the repo to the
// insecure location.
if insecure {
diff --git a/glide.lock b/glide.lock
index 7bd39fd..2494ed3 100644
--- a/glide.lock
+++ b/glide.lock
@@ -1,8 +1,10 @@
hash: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
-updated: 2015-12-09T10:30:35.945332257-05:00
+updated: 2015-12-09T10:37:37.177792534-05:00
imports:
- name: github.com/codegangsta/cli
version: 0302d3914d2a6ad61404584cdae6e6dbc9c03599
+- name: github.com/Masterminds/convert
+ version: a9949121a2e2192ca92fa6dddfeaaa4a4412d955
- name: github.com/Masterminds/cookoo
version: 78aa11ce75e257c51be7ea945edb84cf19c4a6de
repo: git@github.com:Masterminds/cookoo.git
diff --git a/glide.yaml b/glide.yaml
index caa6878..59b541f 100644
--- a/glide.yaml
+++ b/glide.yaml
@@ -1,14 +1,14 @@
package: github.com/Masterminds/glide
import:
- - package: gopkg.in/yaml.v2
- - package: github.com/Masterminds/cookoo
- version: ^1.2.0
- repo: git@github.com:Masterminds/cookoo.git
- vcs: git
- subpackages:
- - .
- - package: github.com/Masterminds/vcs
- version: ^1.2.0
- - package: github.com/codegangsta/cli
- - package: github.com/Masterminds/semver
- version: ^1.0.0
+- package: gopkg.in/yaml.v2
+- package: github.com/Masterminds/cookoo
+ version: ^1.2.0
+ repo: git@github.com:Masterminds/cookoo.git
+ vcs: git
+ subpackages:
+ - .
+- package: github.com/Masterminds/vcs
+ version: ^1.2.0
+- package: github.com/codegangsta/cli
+- package: github.com/Masterminds/semver
+ version: ^1.0.0