Fixes #107 adds --insecure flag to glide get to retrieve a package over
http:// rather than the default https://.
diff --git a/cmd/get_imports.go b/cmd/get_imports.go
index 9e17393..d988cdf 100644
--- a/cmd/get_imports.go
+++ b/cmd/get_imports.go
@@ -39,6 +39,7 @@
func GetAll(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {
names := p.Get("packages", []string{}).([]string)
cfg := p.Get("conf", nil).(*Config)
+ insecure := p.Get("insecure", false).(bool)
Info("Preparing to install %d package.", len(names))
@@ -60,7 +61,13 @@
}
dest := path.Join(cwd, root)
- repoURL := "https://" + root
+
+ var repoURL string
+ if insecure {
+ repoURL = "http://" + root
+ } else {
+ repoURL = "https://" + root
+ }
repo, err := v.NewRepo(repoURL, dest)
if err != nil {
Error("Could not construct repo for %q: %s", name, err)
@@ -70,6 +77,13 @@
dep := &Dependency{
Name: root,
}
+
+ // When retriving from an insecure location set the repo to the
+ // insecure location.
+ if insecure {
+ dep.Repository = "http://" + root
+ }
+
subpkg := strings.TrimPrefix(name, root)
if len(subpkg) > 0 && subpkg != "/" {
dep.Subpackages = []string{subpkg}
diff --git a/glide.go b/glide.go
index a71c5b5..82a16b5 100644
--- a/glide.go
+++ b/glide.go
@@ -160,6 +160,10 @@
Name: "import",
Usage: "When fetching dependencies, convert Godeps (GPM, Godep) to glide.yaml and pull dependencies",
},
+ cli.BoolFlag{
+ Name: "insecure",
+ Usage: "Use http:// rather than https:// to retrieve pacakges.",
+ },
},
Action: func(c *cli.Context) {
if len(c.Args()) < 1 {
@@ -168,6 +172,7 @@
}
cxt.Put("packages", []string(c.Args()))
cxt.Put("recursiveDependencies", !c.Bool("no-recursive"))
+ cxt.Put("insecure", c.Bool("insecure"))
if c.Bool("import") {
cxt.Put("importGodeps", true)
cxt.Put("importGPM", true)
@@ -415,6 +420,7 @@
Using("filename").From("cxt:yaml").
Using("packages").From("cxt:packages").
Using("conf").From("cxt:cfg").
+ Using("insecure").From("cxt:insecure").
Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
Does(cmd.Recurse, "recurse").Using("conf").From("cxt:cfg").
Using("enable").From("cxt:recursiveDependencies").