.gitignore | 1 + Makefile | 13 ------------- all.do | 1 + go.mod | 4 ++-- main.go | 4 ++-- mmfileget.do | 2 ++ vendor-done.do | 6 ++++++ diff --git a/.gitignore b/.gitignore index 19b737d13c801828d145f158a957d7bcaa8404ea..3f1a70c21fc9eed350dd46b2c2e500ffe262dafa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ mattermost-server mmfileget vendor +vendor-done diff --git a/Makefile b/Makefile deleted file mode 100644 index 56163a4c59846d530121cc6660bf13e8e2982492..0000000000000000000000000000000000000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -GO ?= go - -all: mmfileget - -mmfileget: main.go mattermost-server vendor - $(GO) build -mod=vendor - -mattermost-server: - git clone --depth 1 --branch v5.11.1 https://github.com/mattermost/mattermost-server.git - -vendor: mattermost-server - ln -s mattermost-server/vendor - ln -s $(PWD)/mattermost-server vendor/github.com/mattermost/mattermost-server diff --git a/all.do b/all.do new file mode 100644 index 0000000000000000000000000000000000000000..c4da23a7d025fe3a294c736baa68d08e0aee0f7a --- /dev/null +++ b/all.do @@ -0,0 +1 @@ +redo-ifchange mmfileget diff --git a/go.mod b/go.mod index 37e097c8d1376c86cdbf1ddae8ee36a90f2deae0..74b652c63131ecd1f17f9133b860965e3d5eb2c6 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module go.stargrave.org/mmfileget go 1.13 -require github.com/mattermost/mattermost-server v5.11.1+incompatible +require github.com/mattermost/mattermost-server v5.29.0+incompatible -replace github.com/mattermost/mattermost-server v5.11.1+incompatible => ./mattermost-server +replace github.com/mattermost/mattermost-server v5.29.0+incompatible => ./mattermost-server diff --git a/main.go b/main.go index 1e717eccb7c519da4ba556a1a5c79a86281f0e9c..d87829610ec267c1d0cc56500aa60cdbf35acf67 100644 --- a/main.go +++ b/main.go @@ -7,11 +7,11 @@ "os" "path/filepath" "strings" - "github.com/mattermost/mattermost-server/model" + "github.com/mattermost/mattermost-server/v5/model" ) func main() { - url := os.Args[1] // https://MACHINE/api/v4/files/FILE + url := strings.TrimPrefix(os.Args[1], "-") // -?https://MACHINE/api/v4/files/FILE s := strings.Split(url, "/") machine, fileId := s[2], s[6] diff --git a/mmfileget.do b/mmfileget.do new file mode 100644 index 0000000000000000000000000000000000000000..fb22a9e5430e7d36b33b3972ecd5256f1c2d8af7 --- /dev/null +++ b/mmfileget.do @@ -0,0 +1,2 @@ +redo-ifchange main.go vendor-done +${GO:-go} build -o $3 -mod=vendor diff --git a/vendor-done.do b/vendor-done.do new file mode 100644 index 0000000000000000000000000000000000000000..0e0c937e8fa7ec224706009ecde2fa27838a9e1f --- /dev/null +++ b/vendor-done.do @@ -0,0 +1,6 @@ +git clone --depth 1 --branch v5.29.0 https://github.com/mattermost/mattermost-server.git +ln -fs mattermost-server/vendor . +rm vendor/modules.txt +mkdir -p vendor/github.com/mattermost/mattermost-server +ln -fs `pwd`/mattermost-server vendor/github.com/mattermost/mattermost-server/v5 +touch $3