Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ bin/*
gin-bin
.idea/
.vscode
cover.out
20 changes: 17 additions & 3 deletions env/env.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package env

import (
"github.com/gobuffalo/envy"
"fmt"
"os"

"github.com/gobuffalo/helpers/hctx"
)

Expand All @@ -22,9 +24,21 @@ func New() hctx.Map {
// Env will return the specified environment variable,
// or an error if it can not be found
// <%= env("GOPATH") %>
var Env = envy.MustGet
func Env(key string) (string, error) {
s := os.Getenv(key)
if len(s) == 0 {
return "", fmt.Errorf("could not find ENV %q", key)
}
return s, nil
}

// Env will return the specified environment variable,
// or the second argument, if not found
// <%= envOr("GOPATH", "~/go) %>
var EnvOr = envy.Get
func EnvOr(key string, def string) string {
s := os.Getenv(key)
if len(s) == 0 {
return def
}
return s
}
2 changes: 1 addition & 1 deletion forms/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"html/template"

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

// Keys to be used in templates for the functions in this package.
Expand Down
4 changes: 2 additions & 2 deletions forms/bootstrap/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"html/template"

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/form/bootstrap"
"github.com/gobuffalo/tags/v3"
"github.com/gobuffalo/tags/v3/form/bootstrap"
)

// Form implements a `github.com/gobuffalo/plush` helper around the
Expand Down
4 changes: 2 additions & 2 deletions forms/bootstrap/form_for.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/helpers/paths"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/form/bootstrap"
"github.com/gobuffalo/tags/v3"
"github.com/gobuffalo/tags/v3/form/bootstrap"
)

// FormFor implements a `github.com/gobuffalo/plush` helper around the
Expand Down
2 changes: 1 addition & 1 deletion forms/bootstrap/form_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/helpers/helptest"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

type Car struct {
Expand Down
4 changes: 2 additions & 2 deletions forms/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"html/template"

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/form"
"github.com/gobuffalo/tags/v3"
"github.com/gobuffalo/tags/v3/form"
)

// Form implements a `github.com/gobuffalo/plush` helper around the
Expand Down
4 changes: 2 additions & 2 deletions forms/form_for.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/helpers/paths"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/form"
"github.com/gobuffalo/tags/v3"
"github.com/gobuffalo/tags/v3/form"
)

// FormFor implements a `github.com/gobuffalo/plush` helper around the
Expand Down
2 changes: 1 addition & 1 deletion forms/form_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/helpers/helptest"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

type Car struct {
Expand Down
2 changes: 1 addition & 1 deletion forms/forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"html/template"

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

// Keys to be used in templates for the functions in this package.
Expand Down
11 changes: 1 addition & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@ module github.com/gobuffalo/helpers
go 1.13

require (
github.com/fatih/structs v1.1.0 // indirect
github.com/gobuffalo/envy v1.8.1
github.com/gobuffalo/flect v0.2.0
github.com/gobuffalo/github_flavored_markdown v1.1.0
github.com/gobuffalo/tags v2.1.7+incompatible
github.com/gobuffalo/uuid v2.0.5+incompatible // indirect
github.com/gobuffalo/validate v2.0.3+incompatible // indirect
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/onsi/ginkgo v1.10.3 // indirect
github.com/onsi/gomega v1.7.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 // indirect
github.com/gobuffalo/tags/v3 v3.0.2
github.com/stretchr/testify v1.4.0
)
43 changes: 5 additions & 38 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,25 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gobuffalo/envy v1.8.1 h1:RUr68liRvs0TS1D5qdW3mQv2SjAsu1QWMCx1tG4kDjs=
github.com/gobuffalo/envy v1.8.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w=
github.com/gobuffalo/flect v0.2.0 h1:EWCvMGGxOjsgwlWaP+f4+Hh6yrrte7JeFL2S6b+0hdM=
github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80=
github.com/gobuffalo/github_flavored_markdown v1.1.0 h1:8Zzj4fTRl/OP2R7sGerzSf6g2nEJnaBEJe7UAOiEvbQ=
github.com/gobuffalo/github_flavored_markdown v1.1.0/go.mod h1:TSpTKWcRTI0+v7W3x8dkSKMLJSUpuVitlptCkpeY8ic=
github.com/gobuffalo/tags v2.1.7+incompatible h1:GUxxh34f9SI4U0Pj3ZqvopO9SlzuqSf+g4ZGSPSszt4=
github.com/gobuffalo/tags v2.1.7+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY=
github.com/gobuffalo/uuid v2.0.5+incompatible h1:c5uWRuEnYggYCrT9AJm0U2v1QTG7OVDAvxhj8tIV5Gc=
github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE=
github.com/gobuffalo/validate v2.0.3+incompatible h1:6f4JCEz11Zi6iIlexMv7Jz10RBPvgI795AOaubtCwTE=
github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM=
github.com/gobuffalo/tags/v3 v3.0.2 h1:gxE6c6fA5radwQeg59aPIeYgCG8YA8AZd3Oh6fh5UXA=
github.com/gobuffalo/tags/v3 v3.0.2/go.mod h1:ZQeN6TCTiwAFnS0dNcbDtSgZDwNKSpqajvVtt6mlYpA=
github.com/gobuffalo/validate/v3 v3.0.0 h1:dF7Bg8NMF9Zv8bZvUMXYJXxZdj+eSZ8z/lGM7/jVFUE=
github.com/gobuffalo/validate/v3 v3.0.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY=
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.2 h1:XU784Pr0wdahMY2bYcyK6N1KuaRAdLtqD4qd8D18Bfs=
github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 h1:ofR1ZdrNSkiWcMsRrubK9tb2/SlZVWttAfqUjJi6QYc=
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d h1:yKm7XZV6j9Ev6lojP2XaIshpT4ymkqhMeSghO5Ps00E=
Expand All @@ -56,25 +33,15 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
Expand Down
2 changes: 1 addition & 1 deletion tags/css.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tags
import (
"html/template"

"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

// CSS creates html for a css link using `github.com/gobuffalo/tags`
Expand Down
2 changes: 1 addition & 1 deletion tags/css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

func TestCSS(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tags/img.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tags
import (
"html/template"

"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

// Img creates html for a `<img>` tag using `github.com/gobuffalo/tags`
Expand Down
2 changes: 1 addition & 1 deletion tags/img_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

func TestImg(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tags/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tags
import (
"html/template"

"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

// JS creates html for a `<script>` tag using `github.com/gobuffalo/tags`
Expand Down
2 changes: 1 addition & 1 deletion tags/js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

func TestJS(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tags/link_to.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/helpers/paths"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
)

// LinkTo creates html for a `<a>` tag using `github.com/gobuffalo/tags`
Expand Down
2 changes: 1 addition & 1 deletion tags/link_to_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/gobuffalo/helpers/helptest"
"github.com/gobuffalo/tags"
"github.com/gobuffalo/tags/v3"
"github.com/stretchr/testify/require"
)

Expand Down