mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
vendor updated godep
This commit is contained in:
68
vendor/github.com/hashicorp/go-getter/README.md
generated
vendored
68
vendor/github.com/hashicorp/go-getter/README.md
generated
vendored
@@ -1,10 +1,12 @@
|
||||
# go-getter
|
||||
|
||||
[][travis]
|
||||
[][appveyor]
|
||||
[][godocs]
|
||||
|
||||
[travis]: http://travis-ci.org/hashicorp/go-getter
|
||||
[godocs]: http://godoc.org/github.com/hashicorp/go-getter
|
||||
[appveyor]: https://ci.appveyor.com/project/hashicorp/go-getter/branch/master
|
||||
|
||||
go-getter is a library for Go (golang) for downloading files or directories
|
||||
from various sources using a URL as the primary form of input.
|
||||
@@ -48,7 +50,7 @@ The command is useful for verifying URL structures.
|
||||
|
||||
## URL Format
|
||||
|
||||
go-getter uses a single string URL as input to downlaod from a variety of
|
||||
go-getter uses a single string URL as input to download from a variety of
|
||||
protocols. go-getter has various "tricks" with this URL to do certain things.
|
||||
This section documents the URL format.
|
||||
|
||||
@@ -100,6 +102,23 @@ In the absense of a forced protocol, detectors may be run on the URL, transformi
|
||||
the protocol anyways. The above example would've used the Git protocol either
|
||||
way since the Git detector would've detected it was a GitHub URL.
|
||||
|
||||
### Protocol-Specific Options
|
||||
|
||||
Each protocol can support protocol-specific options to configure that
|
||||
protocol. For example, the `git` protocol supports specifying a `ref`
|
||||
query parameter that tells it what ref to checkout for that Git
|
||||
repository.
|
||||
|
||||
The options are specified as query parameters on the URL (or URL-like string)
|
||||
given to go-getter. Using the Git example above, the URL below is a valid
|
||||
input to go-getter:
|
||||
|
||||
github.com/hashicorp/go-getter?ref=abcd1234
|
||||
|
||||
The protocol-specific options are documented below the URL format
|
||||
section. But because they are part of the URL, we point it out here so
|
||||
you know they exist.
|
||||
|
||||
### Checksumming
|
||||
|
||||
For file downloads of any protocol, go-getter can automatically verify
|
||||
@@ -161,3 +180,50 @@ And finally, you can disable archiving completely:
|
||||
You can combine unarchiving with the other features of go-getter such
|
||||
as checksumming. The special `archive` query parameter will be removed
|
||||
from the URL before going to the final protocol downloader.
|
||||
|
||||
## Protocol-Specific Options
|
||||
|
||||
This section documents the protocol-specific options that can be specified
|
||||
for go-getter. These options should be appended to the input as normal query
|
||||
parameters. Depending on the usage of go-getter, applications may provide
|
||||
alternate ways of inputting options. For example, [Nomad](https://www.nomadproject.io)
|
||||
provides a nice options block for specifying options rather than in the URL.
|
||||
|
||||
## General (All Protocols)
|
||||
|
||||
The options below are available to all protocols:
|
||||
|
||||
* `archive` - The archive format to use to unarchive this file, or "" (empty
|
||||
string) to disable unarchiving. For more details, see the complete section
|
||||
on archive support above.
|
||||
|
||||
* `checksum` - Checksum to verify the downloaded file or archive. See
|
||||
the entire section on checksumming above for format and more details.
|
||||
|
||||
### Local Files (`file`)
|
||||
|
||||
None
|
||||
|
||||
### Git (`git`)
|
||||
|
||||
* `ref` - The Git ref to checkout. This is a ref, so it can point to
|
||||
a commit SHA, a branch name, etc. If it is a named ref such as a branch
|
||||
name, go-getter will update it to the latest on each get.
|
||||
|
||||
### Mercurial (`hg`)
|
||||
|
||||
* `rev` - The Mercurial revision to checkout.
|
||||
|
||||
### HTTP (`http`)
|
||||
|
||||
None
|
||||
|
||||
### S3 (`s3`)
|
||||
|
||||
S3 takes various access configurations in the URL. Note that it will also
|
||||
read these from standard AWS environment variables if they're set. If
|
||||
the query parameters are present, these take priority.
|
||||
|
||||
* `aws_access_key_id` - AWS access key.
|
||||
* `aws_access_key_secret` - AWS access key secret.
|
||||
* `aws_access_token` - AWS access token if this is being used.
|
||||
|
||||
10
vendor/github.com/hashicorp/go-getter/decompress_testing.go
generated
vendored
10
vendor/github.com/hashicorp/go-getter/decompress_testing.go
generated
vendored
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -69,9 +70,16 @@ func TestDecompressor(t *testing.T, d Decompressor, cases []TestDecompressCase)
|
||||
return
|
||||
}
|
||||
|
||||
// Convert expected for windows
|
||||
expected := tc.DirList
|
||||
if runtime.GOOS == "windows" {
|
||||
for i, v := range expected {
|
||||
expected[i] = strings.Replace(v, "/", "\\", -1)
|
||||
}
|
||||
}
|
||||
|
||||
// Directory, check for the correct contents
|
||||
actual := testListDir(t, dst)
|
||||
expected := tc.DirList
|
||||
if !reflect.DeepEqual(actual, expected) {
|
||||
t.Fatalf("bad %s\n\n%#v\n\n%#v", tc.Input, actual, expected)
|
||||
}
|
||||
|
||||
11
vendor/github.com/hashicorp/go-getter/decompress_zip.go
generated
vendored
11
vendor/github.com/hashicorp/go-getter/decompress_zip.go
generated
vendored
@@ -46,7 +46,7 @@ func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error {
|
||||
}
|
||||
|
||||
if f.FileInfo().IsDir() {
|
||||
if dir {
|
||||
if !dir {
|
||||
return fmt.Errorf("expected a single file: %s", src)
|
||||
}
|
||||
|
||||
@@ -58,6 +58,15 @@ func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error {
|
||||
continue
|
||||
}
|
||||
|
||||
// Create the enclosing directories if we must. ZIP files aren't
|
||||
// required to contain entries for just the directories so this
|
||||
// can happen.
|
||||
if dir {
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Open the file for reading
|
||||
srcF, err := f.Open()
|
||||
if err != nil {
|
||||
|
||||
90
vendor/github.com/hashicorp/go-getter/get_file.go
generated
vendored
90
vendor/github.com/hashicorp/go-getter/get_file.go
generated
vendored
@@ -1,98 +1,8 @@
|
||||
package getter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// FileGetter is a Getter implementation that will download a module from
|
||||
// a file scheme.
|
||||
type FileGetter struct {
|
||||
// Copy, if set to true, will copy data instead of using a symlink
|
||||
Copy bool
|
||||
}
|
||||
|
||||
func (g *FileGetter) Get(dst string, u *url.URL) error {
|
||||
// The source path must exist and be a directory to be usable.
|
||||
if fi, err := os.Stat(u.Path); err != nil {
|
||||
return fmt.Errorf("source path error: %s", err)
|
||||
} else if !fi.IsDir() {
|
||||
return fmt.Errorf("source path must be a directory")
|
||||
}
|
||||
|
||||
fi, err := os.Lstat(dst)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
// If the destination already exists, it must be a symlink
|
||||
if err == nil {
|
||||
mode := fi.Mode()
|
||||
if mode&os.ModeSymlink == 0 {
|
||||
return fmt.Errorf("destination exists and is not a symlink")
|
||||
}
|
||||
|
||||
// Remove the destination
|
||||
if err := os.Remove(dst); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Create all the parent directories
|
||||
if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return os.Symlink(u.Path, dst)
|
||||
}
|
||||
|
||||
func (g *FileGetter) GetFile(dst string, u *url.URL) error {
|
||||
// The source path must exist and be a directory to be usable.
|
||||
if fi, err := os.Stat(u.Path); err != nil {
|
||||
return fmt.Errorf("source path error: %s", err)
|
||||
} else if fi.IsDir() {
|
||||
return fmt.Errorf("source path must be a file")
|
||||
}
|
||||
|
||||
_, err := os.Lstat(dst)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
// If the destination already exists, it must be a symlink
|
||||
if err == nil {
|
||||
// Remove the destination
|
||||
if err := os.Remove(dst); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Create all the parent directories
|
||||
if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If we're not copying, just symlink and we're done
|
||||
if !g.Copy {
|
||||
return os.Symlink(u.Path, dst)
|
||||
}
|
||||
|
||||
// Copy
|
||||
srcF, err := os.Open(u.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer srcF.Close()
|
||||
|
||||
dstF, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dstF.Close()
|
||||
|
||||
_, err = io.Copy(dstF, srcF)
|
||||
return err
|
||||
}
|
||||
|
||||
7
vendor/github.com/hashicorp/go-getter/get_hg.go
generated
vendored
7
vendor/github.com/hashicorp/go-getter/get_hg.go
generated
vendored
@@ -71,7 +71,12 @@ func (g *HgGetter) GetFile(dst string, u *url.URL) error {
|
||||
// Get the filename, and strip the filename from the URL so we can
|
||||
// just get the repository directly.
|
||||
filename := filepath.Base(u.Path)
|
||||
u.Path = filepath.Dir(u.Path)
|
||||
u.Path = filepath.ToSlash(filepath.Dir(u.Path))
|
||||
|
||||
// If we're on Windows, we need to set the host to "localhost" for hg
|
||||
if runtime.GOOS == "windows" {
|
||||
u.Host = "localhost"
|
||||
}
|
||||
|
||||
// Get the full repository
|
||||
if err := g.Get(td, u); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user