Skip to content

Commit

Permalink
Update goreleaser, cleaned up linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ainsleyclark committed Jun 17, 2021
1 parent 128f2ff commit cf270bd
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 19 deletions.
12 changes: 9 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: verbis
project_name: Verbis
before:
hooks:
- make all
Expand All @@ -11,7 +11,7 @@ after:
- cmd: rm .gitignore
- cmd: mv .gitignore.bak .gitignore
builds:
- id: "verbis"
- id: "main"
env:
- CGO_ENABLED=0
goos:
Expand All @@ -33,7 +33,7 @@ builds:
archives:
-
builds:
- verbis
- main
format: zip
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: "verbis"
Expand All @@ -54,3 +54,9 @@ changelog:
exclude:
- '^docs:'
- '^test:'
release:
github:
owner: ainsleyclark
name: verbis
name_template: "{{.ProjectName}} v{{.Version}}"
draft: true
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ build-prod:
run:
go run ./main.go

live-serve:
HOST="localhost" gin -i --port=8080 --laddr=127.0.0.1 --all run serve

live-test:
HOST="localhost" gin -i --port=8080 --laddr=127.0.0.1 --all run test
release:
./bin/release.sh

format:
go fmt ./api/...
Expand Down
2 changes: 1 addition & 1 deletion api/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
AssetsChannel = 10
UploadChannel = 10
ServerChannel = 50
Repo = "ainsleyclark/verbis"
Repo = "https://github.com/ainsleyclark/verbis"
)

var AssetsChan = make(chan int, AssetsChannel)
Expand Down
20 changes: 20 additions & 0 deletions api/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,34 @@
package cmd

import (
"fmt"
"github.com/ainsleyclark/verbis/api/deps"
"github.com/ainsleyclark/verbis/api/version"
"github.com/gookit/color"
"github.com/spf13/cobra"
"os"
)

var (
testCmd = &cobra.Command{
Use: "test",
Short: "Test Command",
Run: func(cmd *cobra.Command, args []string) {
cfg, _, err := doctor(false)
if err != nil {
printError(err.Error())
os.Exit(1)
}

d := deps.New(*cfg)

fmt.Println(version.Version)

update, err := d.Updater.Update()
if err != nil {
color.Blue.Println(update, err)
}
fmt.Println(update)
},
}
)
1 change: 0 additions & 1 deletion api/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package database

//nolint
import (
_ "embed"
"fmt"
Expand Down
23 changes: 23 additions & 0 deletions api/deps/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@
package deps

import (
"fmt"
"github.com/ainsleyclark/updater"
"github.com/ainsleyclark/verbis/api"
"github.com/ainsleyclark/verbis/api/domain"
"github.com/ainsleyclark/verbis/api/environment"
"github.com/ainsleyclark/verbis/api/errors"
"github.com/ainsleyclark/verbis/api/helpers/paths"
"github.com/ainsleyclark/verbis/api/services/site"
"github.com/ainsleyclark/verbis/api/services/theme"
"github.com/ainsleyclark/verbis/api/services/webp"
"github.com/ainsleyclark/verbis/api/store"
"github.com/ainsleyclark/verbis/api/tpl"
"github.com/ainsleyclark/verbis/api/verbisfs"
"github.com/ainsleyclark/verbis/api/version"
"github.com/ainsleyclark/verbis/api/watchers"
log "github.com/sirupsen/logrus"
"os"
"runtime"
)

// Deps holds dependencies used by many.
Expand Down Expand Up @@ -54,6 +60,8 @@ type Deps struct {
// template
tmpl tpl.TemplateHandler

Updater updater.Patcher

Installed bool

Running bool
Expand Down Expand Up @@ -131,10 +139,25 @@ func New(cfg Config) *Deps {
Theme: theme.New(),
FS: verbisfs.New(api.Production, p),
WebP: webp.New(p.Bin + webp.Path),
Updater: getUpdater(),
}

d.Watcher = watchers.New(d.ThemePath())
d.Watcher.Start()

return d
}

func getUpdater() updater.Patcher {
const op = "Deps.GetUpdater"
opts := &updater.Options{
RepositoryURL: api.Repo,
ArchiveName: fmt.Sprintf("verbis_%s_%s_%s.zip", "0.0.1", runtime.GOOS, runtime.GOARCH),
Version: version.Version,
}
u, err := updater.New(opts)
if err != nil {
log.Fatal(&errors.Error{Code: errors.INTERNAL, Message: "Error creating new Verbis updater", Operation: op, Err: err})
}
return u
}
2 changes: 1 addition & 1 deletion api/domain/forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (f FormLabel) Name() string {
return strings.Title(s)
}

// String is thge stringer on the FormLabel type
// String is thg stringer on the FormLabel type
func (f FormLabel) String() string {
return string(f)
}
Expand Down
2 changes: 1 addition & 1 deletion api/tpl/tplimpl/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type fileHandler func(config tpl.TemplateConfig, template string) (content strin
// engine.
//
// Returns errors.TEMPLATE if thee file does not exist or filepath.Abs failed.
func DefaultFileHandler() fileHandler { //nolint
func DefaultFileHandler() fileHandler {
const op = "TemplateEngine.defaultFileHandler"

return func(config tpl.TemplateConfig, template string) (content string, err error) {
Expand Down
2 changes: 1 addition & 1 deletion api/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// Version is The main version number that is being run
// at the moment.
var Version = "0.0.1"
var Version = "0.0.0"

// Prerelease A pre-release marker for the version. If this is ""
// (empty string) then it means that it is a final release.
Expand Down
1 change: 0 additions & 1 deletion api/www/static_prod.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package www
import "embed"

var (
// nolint
//go:embed layouts/* mail/* public/* sitemaps/* templates/* test/*
Web embed.FS
)
4 changes: 3 additions & 1 deletion bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
version=$1
message=$2

# Check goreleaser passed
goreleaser check

# Check version is not empty
if [[ $version == "" ]]
then
Expand All @@ -27,7 +30,6 @@ git tag -a $version -m $message
git push origin $version

# Run goreleaser
goreleaser check
goreleaser --rm-dist


Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/SparkPost/gosparkpost v0.2.0
github.com/ainsleyclark/go-mail v1.0.3
github.com/ainsleyclark/updater v0.0.0-20210617153514-fc3f00cae92b
github.com/briandowns/spinner v1.11.1
github.com/common-nighthawk/go-figure v0.0.0-20200609044655-c4b36f998cf2
github.com/disintegration/imaging v1.6.2
Expand All @@ -23,7 +24,7 @@ require (
github.com/golang/protobuf v1.4.3 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/uuid v1.1.2
github.com/gookit/color v1.3.1
github.com/gookit/color v1.4.2
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/go-version v1.3.0
github.com/jasonlvhit/gocron v0.0.1
Expand All @@ -46,7 +47,7 @@ require (
github.com/ompluscator/dynamic-struct v1.2.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/errors v0.9.1
github.com/radovskyb/watcher v1.0.7
github.com/sanity-io/litter v1.5.0
github.com/sendgrid/rest v2.6.4+incompatible // indirect
Expand Down
14 changes: 12 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ github.com/SparkPost/gosparkpost v0.2.0 h1:yzhHQT7cE+rqzd5tANNC74j+2x3lrPznqPJrx
github.com/SparkPost/gosparkpost v0.2.0/go.mod h1:S9WKcGeou7cbPpx0kTIgo8Q69WZvUmVeVzbD+djalJ4=
github.com/ainsleyclark/go-mail v1.0.3 h1:ASkHtT/TJunG6Cdp1gC7amGKFfG9jLZYYiMKcMmyv5s=
github.com/ainsleyclark/go-mail v1.0.3/go.mod h1:wOJDCAUZNyRFcrSgX+cNxdx3vJvTPDv2uGfbUm7oC5Y=
github.com/ainsleyclark/updater v0.0.0-20210617153514-fc3f00cae92b h1:Kwi/bjW4FI0von+WEPfODUTtC+CRxmNiQ42ZB+jwGsY=
github.com/ainsleyclark/updater v0.0.0-20210617153514-fc3f00cae92b/go.mod h1:mNcw433pyJp6g9Rl9QwVUp0ASWnsrZsy65mk1HPdGaQ=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
Expand Down Expand Up @@ -154,8 +156,8 @@ github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gookit/color v1.3.1 h1:PPD/C7sf8u2L8XQPdPgsWRoAiLQGZEZOzU3cf5IYYUk=
github.com/gookit/color v1.3.1/go.mod h1:R3ogXq2B9rTbXoSHJ1HyUVAZ3poOJHpd9nQmyGZsfvQ=
github.com/gookit/color v1.4.2 h1:tXy44JFSFkKnELV6WaMo/lLfu/meqITX3iAV52do7lk=
github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
Expand Down Expand Up @@ -208,6 +210,8 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU=
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
Expand Down Expand Up @@ -255,6 +259,7 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-zglob v0.0.3/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=
github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
Expand All @@ -273,6 +278,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mouuff/go-rocket-update v1.5.0 h1:qz+XDJtCjVVNdhEw7xn7K6NB1HieEFIabP1A9wFCv8M=
github.com/mouuff/go-rocket-update v1.5.0/go.mod h1:CnOyUYCxAJyC1g1mebSGC7gJysLTlX+RpxKgD1B0zLs=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nickalie/go-binwrapper v0.0.0-20190114141239-525121d43c84 h1:/6MoQlTdk1eAi0J9O89ypO8umkp+H7mpnSF2ggSL62Q=
github.com/nickalie/go-binwrapper v0.0.0-20190114141239-525121d43c84/go.mod h1:Eeech2fhQ/E4bS8cdc3+SGABQ+weQYGyWBvZ/mNr5uY=
Expand Down Expand Up @@ -380,6 +387,8 @@ github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
Expand Down Expand Up @@ -470,6 +479,7 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down
Binary file added verbisexec.old
Binary file not shown.

0 comments on commit cf270bd

Please sign in to comment.