summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/GeertJohan/go.rice/config.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-02-18 23:00:46 +0100
committerWim <wim@42.be>2017-02-18 23:11:48 +0100
commit930b639cc9cd2d2873302f30303378c0e53816a8 (patch)
tree8cd3f1d464fb5d4e5607fe16255c35a31a9d8b62 /vendor/github.com/GeertJohan/go.rice/config.go
parent58483ea70c2c99a352592c5e50686fb03985650e (diff)
downloadmatterbridge-msglm-930b639cc9cd2d2873302f30303378c0e53816a8.tar.gz
matterbridge-msglm-930b639cc9cd2d2873302f30303378c0e53816a8.tar.bz2
matterbridge-msglm-930b639cc9cd2d2873302f30303378c0e53816a8.zip
Update vendor
Diffstat (limited to 'vendor/github.com/GeertJohan/go.rice/config.go')
-rw-r--r--vendor/github.com/GeertJohan/go.rice/config.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/GeertJohan/go.rice/config.go b/vendor/github.com/GeertJohan/go.rice/config.go
new file mode 100644
index 00000000..45eb398f
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/config.go
@@ -0,0 +1,39 @@
+package rice
+
+// LocateMethod defines how a box is located.
+type LocateMethod int
+
+const (
+ LocateFS = LocateMethod(iota) // Locate on the filesystem according to package path.
+ LocateAppended // Locate boxes appended to the executable.
+ LocateEmbedded // Locate embedded boxes.
+ LocateWorkingDirectory // Locate on the binary working directory
+)
+
+// Config allows customizing the box lookup behavior.
+type Config struct {
+ // LocateOrder defines the priority order that boxes are searched for. By
+ // default, the package global FindBox searches for embedded boxes first,
+ // then appended boxes, and then finally boxes on the filesystem. That
+ // search order may be customized by provided the ordered list here. Leaving
+ // out a particular method will omit that from the search space. For
+ // example, []LocateMethod{LocateEmbedded, LocateAppended} will never search
+ // the filesystem for boxes.
+ LocateOrder []LocateMethod
+}
+
+// FindBox searches for boxes using the LocateOrder of the config.
+func (c *Config) FindBox(boxName string) (*Box, error) {
+ return findBox(boxName, c.LocateOrder)
+}
+
+// MustFindBox searches for boxes using the LocateOrder of the config, like
+// FindBox does. It does not return an error, instead it panics when an error
+// occurs.
+func (c *Config) MustFindBox(boxName string) *Box {
+ box, err := findBox(boxName, c.LocateOrder)
+ if err != nil {
+ panic(err)
+ }
+ return box
+}