no longer require go-bindata, which was abandoned

however, go 1.16 is now required

(it is quite ancient anyway at this point)
pull/1/head
Wojciech Kwolek 2024-03-13 02:11:10 +01:00
parent ff1eba5b42
commit a1a55bf8d2
Signed by: irth
SSH Key Fingerprint: SHA256:FAXb3OrtGoWgBfLFtqFOSVxGU8zuBPvG47dyUHA39Z4
6 changed files with 33 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
dist
server/memelibrary/assets.go

View File

@ -26,10 +26,8 @@ In Mattermost 5.15 and earlier, follow these steps:
Read our documentation about the [Developer Workflow](https://developers.mattermost.com/extend/plugins/developer-workflow/) and [Developer Setup](https://developers.mattermost.com/extend/plugins/developer-setup/) for more information about developing and extending plugins.
Run `make memelibrary` to bundle up the meme assets (images, fonts, etc.).
For convenience, you can run the plugin from your terminal to preview an image for a given input. For example, on macOS, you can run the following to generate the above meme and open it in Preview:
`go run server/plugin.go -out demo.jpg 'memes. memes everywhere' && open demo.jpg`
This is especially useful when adding or modifying memes as you can quickly modify assets, `make memelibrary`, and preview the result using the above command. (See the files in ` memelibrary/assets` to get started with that.)
This is especially useful when adding or modifying memes as you can quickly modify assets, and preview the result using the above command. (See the files in ` memelibrary/assets` to get started with that.)

View File

@ -1,7 +0,0 @@
# Include custom targets and environment variables here
.DEFAULT_GOAL := all
memelibrary: $(shell find server/memelibrary/assets)
env GO111MODULE=off $(GO) get github.com/jteeuwen/go-bindata/...
$(GOPATH)/bin/go-bindata -o server/memelibrary/assets.go -pkg memelibrary -prefix server/memelibrary/assets/ -ignore '(^|/)\..*' server/memelibrary/assets/...

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/mattermost/mattermost-plugin-memes
go 1.12
go 1.16
require (
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0

View File

@ -0,0 +1,31 @@
package memelibrary
import (
"embed"
"path"
)
//go:embed assets
var content embed.FS
func AssetDir(name string) ([]string, error) {
entries, err := content.ReadDir(path.Join("assets", name))
if err != nil {
return nil, err
}
files := make([]string, len(entries))
for i, entry := range entries {
files[i] = entry.Name()
}
return files, nil
}
func MustAsset(name string) []byte {
data, err := content.ReadFile(path.Join("assets", name))
if err != nil {
panic(err)
}
return data
}

View File

@ -132,7 +132,6 @@ func serveTemplatePNG(w http.ResponseWriter, r *http.Request) {
}
}
type Plugin struct {
plugin.MattermostPlugin