]> Sergey Matveev's repositories - mmfileget.git/commitdiff
Update dependency, move to redo
authorSergey Matveev <stargrave@stargrave.org>
Thu, 3 Dec 2020 10:26:59 +0000 (13:26 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 3 Dec 2020 10:28:42 +0000 (13:28 +0300)
.gitignore
Makefile [deleted file]
all.do [new file with mode: 0644]
go.mod
main.go
mmfileget.do [new file with mode: 0644]
vendor-done.do [new file with mode: 0644]

index 19b737d13c801828d145f158a957d7bcaa8404ea..3f1a70c21fc9eed350dd46b2c2e500ffe262dafa 100644 (file)
@@ -1,3 +1,4 @@
 mattermost-server
 mmfileget
 vendor
+vendor-done
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 56163a4..0000000
--- 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 (file)
index 0000000..c4da23a
--- /dev/null
+++ b/all.do
@@ -0,0 +1 @@
+redo-ifchange mmfileget
diff --git a/go.mod b/go.mod
index 37e097c8d1376c86cdbf1ddae8ee36a90f2deae0..74b652c63131ecd1f17f9133b860965e3d5eb2c6 100644 (file)
--- 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 (file)
--- a/main.go
+++ b/main.go
@@ -7,11 +7,11 @@ import (
        "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 (file)
index 0000000..fb22a9e
--- /dev/null
@@ -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 (file)
index 0000000..0e0c937
--- /dev/null
@@ -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