From 45eb3a01e6501d2df52a9cdbcde8965973215aa1 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Tue, 27 Sep 2016 10:08:08 +0200 Subject: [PATCH 01/79] Initial commit --- .gitignore | 24 ++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ README.md | 2 ++ 3 files changed, 47 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..270c9b08 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Maputnik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..878a419b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# desktop +A Golang based cross platform executable for integrating Maputnik locally From 66e3ce8743d4e631a504cba9731ade639f940d89 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Tue, 27 Sep 2016 20:27:08 +0200 Subject: [PATCH 02/79] Add server and bindata packaging --- README.md | 24 ++++++++++++++++++++++++ api.go | 15 +++++++++++++++ maputnik.go | 29 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 api.go create mode 100644 maputnik.go diff --git a/README.md b/README.md index 878a419b..23fecf28 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # desktop A Golang based cross platform executable for integrating Maputnik locally + + +### Build + +First you need a app bundle distribution of Maptunik and copy over `public` +to the `gui` folder in this project. + +``` +npm run dist +``` + +Package the the `gui` as binary assets. + +``` +go get github.com/elazarl/go-bindata-assetfs/... +go-bindata-assetfs gui/... +``` + +Install the go package. + +``` +go install +``` + diff --git a/api.go b/api.go new file mode 100644 index 00000000..5ecc68ba --- /dev/null +++ b/api.go @@ -0,0 +1,15 @@ +package main + +import ( + "encoding/json" + "net/http" +) + +// Return all current deployments +func foo(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + encoder := json.NewEncoder(w) + encoder.Encode(map[string]string{ + "foo": "bar", + }) +} diff --git a/maputnik.go b/maputnik.go new file mode 100644 index 00000000..2a3f516f --- /dev/null +++ b/maputnik.go @@ -0,0 +1,29 @@ +package main + +import ( + "net/http" + "os" + + "github.com/gorilla/handlers" + "github.com/gorilla/mux" + "github.com/urfave/cli" +) + +func main() { + app := cli.NewApp() + app.Name = "maputnik" + app.Usage = "Server for integrating Maputnik locally" + + app.Action = func(c *cli.Context) error { + gui := http.FileServer(assetFS()) + + router := mux.NewRouter().StrictSlash(true) + //router.Path("/api/v1/apps").Methods("GET").HandlerFunc(foo) + router.PathPrefix("/").Handler(http.StripPrefix("/", gui)) + + loggedRouter := handlers.LoggingHandler(os.Stdout, router) + return http.ListenAndServe(":8000", loggedRouter) + } + + app.Run(os.Args) +} From 8b722fc96721731105e39bc34db04f7014581f63 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Tue, 27 Sep 2016 20:58:08 +0200 Subject: [PATCH 03/79] Add Makefile --- .gitignore | 6 ++++++ .gitmodules | 4 ++++ Makefile | 21 +++++++++++++++++++++ README.md | 23 +++++++++-------------- editor | 1 + 5 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 .gitmodules create mode 100644 Makefile create mode 160000 editor diff --git a/.gitignore b/.gitignore index daf913b1..17a0109d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,9 @@ _testmain.go *.exe *.test *.prof + +# Bindata +bindata_assetfs.go + +# Built binary +maputnik diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..b63e9721 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "editor"] + path = editor + url = git@github.com:maputnik/editor.git + branch = master diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..691be69a --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +SOURCEDIR=. +SOURCES := $(shell find $(SOURCEDIR) -name '*.go') +BINARY=maputnik + +all: $(BINARY) + +$(BINARY): $(SOURCES) + go build -o ${BINARY} + +editor/node_modules: + cd editor && npm install + +editor/public: editor/node_modules + cd editor && npm run build + +bindata_assetfs.go: editor/public + go-bindata-assetfs editor/public/ + +.PHONY: clean +clean: + rm -rf editor/public && rm -rf maputnik diff --git a/README.md b/README.md index 23fecf28..b59bb1c1 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,21 @@ -# desktop -A Golang based cross platform executable for integrating Maputnik locally +# Maputnik Desktop +A Golang based cross platform executable for integrating Maputnik locally. ### Build -First you need a app bundle distribution of Maptunik and copy over `public` -to the `gui` folder in this project. +Clone the repository recursively since the Maputnik editor is embedded +as submodule. ``` -npm run dist +git clone --recursive git@github.com:maputnik/desktop.git ``` -Package the the `gui` as binary assets. +Run `make` to build the app distribution bundle and create the `maputnik` binary +embedding the editor. ``` -go get github.com/elazarl/go-bindata-assetfs/... -go-bindata-assetfs gui/... -``` - -Install the go package. - -``` -go install +make ``` +You should now find the `maputnik` binary in your directory. diff --git a/editor b/editor new file mode 160000 index 00000000..3b59e54b --- /dev/null +++ b/editor @@ -0,0 +1 @@ +Subproject commit 3b59e54b2adf4fa5180a15cb7b0abdd12586c881 From 0421a7f099608c199f8e2c810181235c54e71b31 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Tue, 27 Sep 2016 21:30:00 +0200 Subject: [PATCH 04/79] Add websocket filewatcher --- filewatch/filewatch.go | 122 +++++++++++++++++++++++++++++++++++++++++ maputnik.go | 31 ++++++++++- 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 filewatch/filewatch.go diff --git a/filewatch/filewatch.go b/filewatch/filewatch.go new file mode 100644 index 00000000..d00c0f78 --- /dev/null +++ b/filewatch/filewatch.go @@ -0,0 +1,122 @@ +package filewatch + +import ( + "io/ioutil" + "log" + "net/http" + "os" + "strconv" + "time" + + "github.com/gorilla/websocket" +) + +// Adapted from https://github.com/gorilla/websocket +// Copyright (c) 2013 The Gorilla WebSocket Authors +// https://github.com/gorilla/websocket/blob/master/examples/filewatch/main.go + +const ( + // Time allowed to write the file to the client. + writeWait = 10 * time.Second + + // Time allowed to read the next pong message from the client. + pongWait = 60 * time.Second + + // Send pings to client with this period. Must be less than pongWait. + pingPeriod = (pongWait * 9) / 10 + + // Poll file for changes with this period. + filePeriod = 10 * time.Second +) + +var upgrader = websocket.Upgrader{ + ReadBufferSize: 1024, + WriteBufferSize: 1024, +} + +func readFileIfModified(filename string, lastMod time.Time) ([]byte, time.Time, error) { + fi, err := os.Stat(filename) + if err != nil { + return nil, lastMod, err + } + if !fi.ModTime().After(lastMod) { + return nil, lastMod, nil + } + p, err := ioutil.ReadFile(filename) + if err != nil { + return nil, fi.ModTime(), err + } + return p, fi.ModTime(), nil +} + +func reader(ws *websocket.Conn) { + defer ws.Close() + ws.SetReadLimit(512) + ws.SetReadDeadline(time.Now().Add(pongWait)) + ws.SetPongHandler(func(string) error { ws.SetReadDeadline(time.Now().Add(pongWait)); return nil }) + for { + _, _, err := ws.ReadMessage() + if err != nil { + break + } + } +} + +func writer(ws *websocket.Conn, filename string, lastMod time.Time) { + lastError := "" + pingTicker := time.NewTicker(pingPeriod) + fileTicker := time.NewTicker(filePeriod) + defer func() { + pingTicker.Stop() + fileTicker.Stop() + ws.Close() + }() + for { + select { + case <-fileTicker.C: + var p []byte + var err error + + p, lastMod, err = readFileIfModified(filename, lastMod) + + if err != nil { + if s := err.Error(); s != lastError { + lastError = s + p = []byte(lastError) + } + } else { + lastError = "" + } + + if p != nil { + ws.SetWriteDeadline(time.Now().Add(writeWait)) + if err := ws.WriteMessage(websocket.TextMessage, p); err != nil { + return + } + } + case <-pingTicker.C: + ws.SetWriteDeadline(time.Now().Add(writeWait)) + if err := ws.WriteMessage(websocket.PingMessage, []byte{}); err != nil { + return + } + } + } +} + +func ServeWebsocketFileWatcher(filename string, w http.ResponseWriter, r *http.Request) { + ws, err := upgrader.Upgrade(w, r, nil) + if err != nil { + if _, ok := err.(websocket.HandshakeError); !ok { + log.Println(err) + } + return + } + + var lastMod time.Time + if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err == nil { + lastMod = time.Unix(0, n) + } + + go writer(ws, filename, lastMod) + reader(ws) +} diff --git a/maputnik.go b/maputnik.go index 2a3f516f..4428a011 100644 --- a/maputnik.go +++ b/maputnik.go @@ -6,6 +6,7 @@ import ( "github.com/gorilla/handlers" "github.com/gorilla/mux" + "github.com/maputnik/desktop/filewatch" "github.com/urfave/cli" ) @@ -14,11 +15,39 @@ func main() { app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" + app.Flags = []cli.Flag{ + cli.StringFlag{ + Name: "file, f", + Usage: "Allow access to JSON style from web client", + }, + cli.BoolFlag{ + Name: "watch", + Usage: "Notify web client about JSON style file changes", + }, + } + app.Action = func(c *cli.Context) error { gui := http.FileServer(assetFS()) router := mux.NewRouter().StrictSlash(true) - //router.Path("/api/v1/apps").Methods("GET").HandlerFunc(foo) + + // Register websocket to notify we clients about file changes + filename := c.String("file") + + if filename != "" { + /* + router.Path("/files").Methods("GET").HandlerFunc(listFiles) + router.Path("/files/{filename}").Methods("PUT").HandlerFunc(saveFile) + */ + + if c.Bool("watch") { + router.Path("/ws").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + filewatch.ServeWebsocketFileWatcher(filename, w, r) + }) + } + + } + router.PathPrefix("/").Handler(http.StripPrefix("/", gui)) loggedRouter := handlers.LoggingHandler(os.Stdout, router) From 1f1580276d6a46131626a7acf48ef101bd3aac8d Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Tue, 27 Sep 2016 22:10:00 +0200 Subject: [PATCH 05/79] Integrate file access into API --- Makefile | 6 +++--- api.go | 47 ++++++++++++++++++++++++++++++++++++++++++----- maputnik.go | 20 ++++++++++++-------- 3 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 691be69a..be8a84d3 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ BINARY=maputnik all: $(BINARY) -$(BINARY): $(SOURCES) +$(BINARY): $(SOURCES) bindata_assetfs.go go build -o ${BINARY} editor/node_modules: @@ -14,8 +14,8 @@ editor/public: editor/node_modules cd editor && npm run build bindata_assetfs.go: editor/public - go-bindata-assetfs editor/public/ + go-bindata-assetfs --prefix "editor/" editor/public .PHONY: clean clean: - rm -rf editor/public && rm -rf maputnik + rm -rf editor/public && rm -f bindata_assetfs.go && rm -f maputnik diff --git a/api.go b/api.go index 5ecc68ba..20c6690e 100644 --- a/api.go +++ b/api.go @@ -2,14 +2,51 @@ package main import ( "encoding/json" + "io" + "log" "net/http" + "os" + "path/filepath" + + "github.com/gorilla/mux" ) -// Return all current deployments -func foo(w http.ResponseWriter, r *http.Request) { +func StyleFileAccessor(filename string) styleFileAccessor { + file, err := os.Open(filename) + if err != nil { + log.Fatalf("Can not access style file: %s", err.Error()) + } + + return styleFileAccessor{file} +} + +// Allows access to a single style file +type styleFileAccessor struct { + file *os.File +} + +func (fa styleFileAccessor) ListFiles(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") encoder := json.NewEncoder(w) - encoder.Encode(map[string]string{ - "foo": "bar", - }) + encoder.Encode([]string{filepath.Base(fa.file.Name())}) +} + +func (fa styleFileAccessor) ReadFile(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + _ = vars["filename"] + + //TODO: Choose right file + // right now we just return the single file we know of + w.Header().Set("Content-Type", "application/json") + if _, err := io.Copy(w, fa.file); err != nil { + log.Fatalf("Can not copy from file to request: %s", err.Error()) + } +} + +func (fa styleFileAccessor) SaveFile(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + + if _, err := io.Copy(fa.file, r.Body); err != nil { + log.Fatalf("Can not copy from request to file: %s", err.Error()) + } } diff --git a/maputnik.go b/maputnik.go index 4428a011..4db6396c 100644 --- a/maputnik.go +++ b/maputnik.go @@ -1,8 +1,10 @@ package main import ( + "fmt" "net/http" "os" + "path/filepath" "github.com/gorilla/handlers" "github.com/gorilla/mux" @@ -31,26 +33,28 @@ func main() { router := mux.NewRouter().StrictSlash(true) - // Register websocket to notify we clients about file changes filename := c.String("file") - if filename != "" { - /* - router.Path("/files").Methods("GET").HandlerFunc(listFiles) - router.Path("/files/{filename}").Methods("PUT").HandlerFunc(saveFile) - */ + fmt.Printf("%s is accessible via Maputnik\n", filename) + // Allow access to reading and writing file on the local system + path, _ := filepath.Abs(filename) + accessor := StyleFileAccessor(path) + router.Path("/files").Methods("GET").HandlerFunc(accessor.ListFiles) + router.Path("/files/{filename}").Methods("GET").HandlerFunc(accessor.ReadFile) + router.Path("/files/{filename}").Methods("PUT").HandlerFunc(accessor.SaveFile) + // Register websocket to notify we clients about file changes if c.Bool("watch") { router.Path("/ws").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { filewatch.ServeWebsocketFileWatcher(filename, w, r) }) } - } router.PathPrefix("/").Handler(http.StripPrefix("/", gui)) - loggedRouter := handlers.LoggingHandler(os.Stdout, router) + + fmt.Println("Exposing Maputnik on http://localhost:8000") return http.ListenAndServe(":8000", loggedRouter) } From 3d09f2a0f3f31feda92bfb4dc401670436f88cbe Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Tue, 27 Sep 2016 22:30:00 +0200 Subject: [PATCH 06/79] Add server usage example --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index b59bb1c1..61d115d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,33 @@ # Maputnik Desktop A Golang based cross platform executable for integrating Maputnik locally. +The idea is to package up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) +and embed it in the server program. + +### Usage + +*Not functional yet* + +Simply start up a web server and access the Maputnik editor GUI at `localhost:8000`. + +``` +maputnik +``` + +Expose a local style file to Maputnik allowing the web based editor +to save to the local filesystem. + +``` +maputnik --file basic-v9.json +``` + +Watch the local style for changes and inform the editor via web socket. +This makes it possible to edit the style with a local text editor and still +use Maputnik. + +``` +maputnik --watch --file basic-v9.json +``` ### Build From d874b2503b19d6f1f618730717464b857ed5ac65 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Wed, 2 Nov 2016 17:01:46 +0100 Subject: [PATCH 07/79] Add Travis file --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..756ad27b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: go +install: + - go get +test: + - make From f8cb0619f33eca56ebac3ed2a19a82be8b439038 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Wed, 2 Nov 2016 17:08:48 +0100 Subject: [PATCH 08/79] Use HTTPS endpoint for submodule --- .gitmodules | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index b63e9721..ca9a4e79 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "editor"] - path = editor - url = git@github.com:maputnik/editor.git + path = editor + url = https://github.com/maputnik/editor.git branch = master diff --git a/README.md b/README.md index 61d115d0..2cce64ec 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Maputnik Desktop +# Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) A Golang based cross platform executable for integrating Maputnik locally. The idea is to package up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) From ecab640a9a8b124098a662266d352a4fcb85572b Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Wed, 2 Nov 2016 17:10:40 +0100 Subject: [PATCH 09/79] Add AppVeyor integration --- appveyor.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..a2da451c --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,31 @@ +# version format +version: "{build}" + +# Operating system (build VM template) +os: Windows Server 2012 R2 + +clone_folder: c:\gopath\src\github.com\maputnik\desktop + +# environment variables +environment: + GOPATH: c:\gopath + GO15VENDOREXPERIMENT: 1 + +# scripts that run after cloning repository +install: + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - go version + - go env + - go get + +# to run your custom scripts instead of automatic MSBuild +build_script: + - go vet ./... + - gofmt -s -l . + - make + +# to disable automatic tests +test: off + +# to disable deployment +deploy: off From 7d1890156d98187f26a379c8be37553908491092 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Thu, 3 Nov 2016 13:18:08 +0100 Subject: [PATCH 10/79] Update Travis go get --- .travis.yml | 7 +++++-- README.md | 13 +++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 756ad27b..dabb9935 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: go install: - - go get +- go get github.com/gorilla/handlers +- go get github.com/gorilla/mux +- go get github.com/gorilla/websocket +- go get github.com/urfave/cli test: - - make +- make diff --git a/README.md b/README.md index 2cce64ec..1c1a996d 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,22 @@ maputnik --watch --file basic-v9.json ### Build -Clone the repository recursively since the Maputnik editor is embedded -as submodule. +Clone the repository **recursively** since the Maputnik editor is embedded +as submodule. Make sure you clone it into the correct directory `$GOPATH/src/github.com/maputnik`. ``` git clone --recursive git@github.com:maputnik/desktop.git ``` +Install the 3rd party dependencies. + +``` +go get github.com/gorilla/handlers +go get github.com/gorilla/mux +go get github.com/gorilla/websocket +go get github.com/urfave/cli +``` + Run `make` to build the app distribution bundle and create the `maputnik` binary embedding the editor. From ca2df37c796a5b3abf7567b0b9b6a10add83c22c Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Thu, 3 Nov 2016 13:19:58 +0100 Subject: [PATCH 11/79] Fix go get in AppVeyor --- appveyor.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a2da451c..0e58785f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,16 +13,19 @@ environment: # scripts that run after cloning repository install: - - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - - go version - - go env - - go get +- set PATH=%GOPATH%\bin;c:\go\bin;%PATH% +- go version +- go env +- go get github.com/gorilla/handlers +- go get github.com/gorilla/mux +- go get github.com/gorilla/websocket +- go get github.com/urfave/cli # to run your custom scripts instead of automatic MSBuild build_script: - - go vet ./... - - gofmt -s -l . - - make +- go vet ./... +- gofmt -s -l . +- make # to disable automatic tests test: off From 5b712d74aec91b79431a10f58ae6fdf9507ccfb2 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Thu, 3 Nov 2016 13:24:02 +0100 Subject: [PATCH 12/79] Use MinGW make in AppVeyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0e58785f..0fa5986c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,7 +25,7 @@ install: build_script: - go vet ./... - gofmt -s -l . -- make +- mingw32-make.exe # to disable automatic tests test: off From b1af4917e54596148bfbc407111a58dbd6c9adad Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Thu, 3 Nov 2016 13:26:14 +0100 Subject: [PATCH 13/79] Add missing bindata deps --- .travis.yml | 5 +++++ README.md | 2 ++ appveyor.yml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index dabb9935..f1f1c974 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,13 @@ +os: +- linux +- osx language: go install: - go get github.com/gorilla/handlers - go get github.com/gorilla/mux - go get github.com/gorilla/websocket - go get github.com/urfave/cli +- go get github.com/elazarl/go-bindata-assetfs/... +- go get github.com/jteeuwen/go-bindata/... test: - make diff --git a/README.md b/README.md index 1c1a996d..59f5c0ca 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ go get github.com/gorilla/handlers go get github.com/gorilla/mux go get github.com/gorilla/websocket go get github.com/urfave/cli +go get github.com/elazarl/go-bindata-assetfs/... +go get github.com/jteeuwen/go-bindata/... ``` Run `make` to build the app distribution bundle and create the `maputnik` binary diff --git a/appveyor.yml b/appveyor.yml index 0fa5986c..fb206606 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,6 +20,8 @@ install: - go get github.com/gorilla/mux - go get github.com/gorilla/websocket - go get github.com/urfave/cli +- go get github.com/elazarl/go-bindata-assetfs/... +- go get github.com/jteeuwen/go-bindata/... # to run your custom scripts instead of automatic MSBuild build_script: From 009f4e105dc46bf1107f4bf5ee0ad31fe798623f Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Thu, 3 Nov 2016 13:29:14 +0100 Subject: [PATCH 14/79] Specify path to mingw make --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index fb206606..4d07c960 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,7 +27,7 @@ install: build_script: - go vet ./... - gofmt -s -l . -- mingw32-make.exe +- C:\MinGW\bin\mingw32-make.exe # to disable automatic tests test: off From 11375008facd06578116363a3a17de0098167d0a Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Sat, 5 Nov 2016 17:40:19 +0100 Subject: [PATCH 15/79] Extend README with endpoint desription --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 59f5c0ca..10481eb9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) A Golang based cross platform executable for integrating Maputnik locally. -The idea is to package up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) -and embed it in the server program. +This binary packages up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) +and embeds it in the program for easy distribution. It also allows +exposing a local style file and work on it both in Maputnik and with your favorite +editor. ### Usage @@ -29,6 +31,17 @@ use Maputnik. maputnik --watch --file basic-v9.json ``` +### API + +`maputnik` exposes the configured styles via a HTTP API. + +| Method | Description +|---------------------------------|--------------------------------------- +| `GET /files` | List all configured style files +| `GET /files/{filename}` | Get contents of a single style file +| `PUT GET /files/{filename}` | Update contents of a style file +| `WEBSOCKET /ws` | Listen to change events for the configured style files + ### Build Clone the repository **recursively** since the Maputnik editor is embedded From 0d77518a02b3fe5445e3e3d3c28bf01270722854 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sat, 3 Dec 2016 16:51:47 +0100 Subject: [PATCH 16/79] Support saving file --- api.go | 39 ++++++++++++++++++++++++++++++++++----- maputnik.go | 6 +++--- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/api.go b/api.go index 20c6690e..ac149fef 100644 --- a/api.go +++ b/api.go @@ -2,48 +2,77 @@ package main import ( "encoding/json" + "fmt" "io" + "io/ioutil" "log" "net/http" "os" - "path/filepath" "github.com/gorilla/mux" ) func StyleFileAccessor(filename string) styleFileAccessor { - file, err := os.Open(filename) + file, err := os.OpenFile(filename, os.O_RDWR, 0666) if err != nil { log.Fatalf("Can not access style file: %s", err.Error()) } - return styleFileAccessor{file} + return styleFileAccessor{file, styleId(file)} +} + +func styleId(file *os.File) string { + raw, err := ioutil.ReadAll(file) + if err != nil { + log.Panicln(err) + } + + var spec styleSpec + err = json.Unmarshal(raw, &spec) + if err != nil { + log.Panicln(err) + } + + if spec.Id == "" { + fmt.Println("No id in style") + } + return spec.Id +} + +type styleSpec struct { + Id string `json:"id"` } // Allows access to a single style file type styleFileAccessor struct { file *os.File + id string } func (fa styleFileAccessor) ListFiles(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") encoder := json.NewEncoder(w) - encoder.Encode([]string{filepath.Base(fa.file.Name())}) + encoder.Encode([]string{fa.id}) } func (fa styleFileAccessor) ReadFile(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - _ = vars["filename"] + _ = vars["styleId"] //TODO: Choose right file // right now we just return the single file we know of w.Header().Set("Content-Type", "application/json") + fa.file.Seek(0, 0) if _, err := io.Copy(w, fa.file); err != nil { log.Fatalf("Can not copy from file to request: %s", err.Error()) } } func (fa styleFileAccessor) SaveFile(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + _ = vars["styleId"] + + //TODO: Save to right file w.Header().Set("Content-Type", "application/json") if _, err := io.Copy(fa.file, r.Body); err != nil { diff --git a/maputnik.go b/maputnik.go index 4db6396c..a86a417a 100644 --- a/maputnik.go +++ b/maputnik.go @@ -39,9 +39,9 @@ func main() { // Allow access to reading and writing file on the local system path, _ := filepath.Abs(filename) accessor := StyleFileAccessor(path) - router.Path("/files").Methods("GET").HandlerFunc(accessor.ListFiles) - router.Path("/files/{filename}").Methods("GET").HandlerFunc(accessor.ReadFile) - router.Path("/files/{filename}").Methods("PUT").HandlerFunc(accessor.SaveFile) + router.Path("/styles").Methods("GET").HandlerFunc(accessor.ListFiles) + router.Path("/styles/{styleId}").Methods("GET").HandlerFunc(accessor.ReadFile) + router.Path("/styles/{styleId}").Methods("PUT").HandlerFunc(accessor.SaveFile) // Register websocket to notify we clients about file changes if c.Bool("watch") { From 35ed202cd07190b3d4e761df90dc7787f48098f0 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sat, 3 Dec 2016 23:04:12 +0100 Subject: [PATCH 17/79] Support CORS --- maputnik.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index a86a417a..b74e67a0 100644 --- a/maputnik.go +++ b/maputnik.go @@ -53,9 +53,10 @@ func main() { router.PathPrefix("/").Handler(http.StripPrefix("/", gui)) loggedRouter := handlers.LoggingHandler(os.Stdout, router) + corsRouter := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}), handlers.AllowedMethods([]string{"GET", "PUT"}), handlers.AllowedOrigins([]string{"*"}), handlers.AllowCredentials())(loggedRouter) fmt.Println("Exposing Maputnik on http://localhost:8000") - return http.ListenAndServe(":8000", loggedRouter) + return http.ListenAndServe(":8000", corsRouter) } app.Run(os.Args) From ce9216b2d5bd4dbeb90ad3084f5275d82d04aa65 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sat, 3 Dec 2016 23:04:32 +0100 Subject: [PATCH 18/79] Write and read file directly --- api.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/api.go b/api.go index ac149fef..64556336 100644 --- a/api.go +++ b/api.go @@ -1,28 +1,22 @@ package main import ( + "bytes" "encoding/json" "fmt" - "io" "io/ioutil" "log" "net/http" - "os" "github.com/gorilla/mux" ) func StyleFileAccessor(filename string) styleFileAccessor { - file, err := os.OpenFile(filename, os.O_RDWR, 0666) - if err != nil { - log.Fatalf("Can not access style file: %s", err.Error()) - } - - return styleFileAccessor{file, styleId(file)} + return styleFileAccessor{filename, styleId(filename)} } -func styleId(file *os.File) string { - raw, err := ioutil.ReadAll(file) +func styleId(filename string) string { + raw, err := ioutil.ReadFile(filename) if err != nil { log.Panicln(err) } @@ -45,8 +39,8 @@ type styleSpec struct { // Allows access to a single style file type styleFileAccessor struct { - file *os.File - id string + filename string + id string } func (fa styleFileAccessor) ListFiles(w http.ResponseWriter, r *http.Request) { @@ -62,10 +56,12 @@ func (fa styleFileAccessor) ReadFile(w http.ResponseWriter, r *http.Request) { //TODO: Choose right file // right now we just return the single file we know of w.Header().Set("Content-Type", "application/json") - fa.file.Seek(0, 0) - if _, err := io.Copy(w, fa.file); err != nil { - log.Fatalf("Can not copy from file to request: %s", err.Error()) + + raw, err := ioutil.ReadFile(fa.filename) + if err != nil { + log.Panicln(err) } + w.Write(raw) } func (fa styleFileAccessor) SaveFile(w http.ResponseWriter, r *http.Request) { @@ -75,7 +71,11 @@ func (fa styleFileAccessor) SaveFile(w http.ResponseWriter, r *http.Request) { //TODO: Save to right file w.Header().Set("Content-Type", "application/json") - if _, err := io.Copy(fa.file, r.Body); err != nil { + body, _ := ioutil.ReadAll(r.Body) + var out bytes.Buffer + json.Indent(&out, body, "", " ") + + if err := ioutil.WriteFile(fa.filename, out.Bytes(), 0666); err != nil { log.Fatalf("Can not copy from request to file: %s", err.Error()) } } From 60bea1777a896eb3d3d6716325d1648042abeb71 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sat, 31 Dec 2016 16:12:07 +0100 Subject: [PATCH 19/79] Ugrade to v0.3.1 --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index 3b59e54b..99acbd4d 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 3b59e54b2adf4fa5180a15cb7b0abdd12586c881 +Subproject commit 99acbd4d92100c44817730da46f0ebceef682ac6 From d2cd84de2ba905ee5d7f95f671c7476d21b8ef4e Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 15:50:58 +0100 Subject: [PATCH 20/79] Switch filewatch implementation to fsnotify --- .travis.yml | 1 + README.md | 1 + appveyor.yml | 1 + filewatch/filewatch.go | 123 ++++++++++++----------------------------- 4 files changed, 38 insertions(+), 88 deletions(-) diff --git a/.travis.yml b/.travis.yml index f1f1c974..17bf4aec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ os: - osx language: go install: +- go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers - go get github.com/gorilla/mux - go get github.com/gorilla/websocket diff --git a/README.md b/README.md index 10481eb9..3b0e2b28 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Install the 3rd party dependencies. go get github.com/gorilla/handlers go get github.com/gorilla/mux go get github.com/gorilla/websocket +go get github.com/fsnotify/fsnotify go get github.com/urfave/cli go get github.com/elazarl/go-bindata-assetfs/... go get github.com/jteeuwen/go-bindata/... diff --git a/appveyor.yml b/appveyor.yml index 4d07c960..6fbda7ca 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,6 +16,7 @@ install: - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - go version - go env +- go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers - go get github.com/gorilla/mux - go get github.com/gorilla/websocket diff --git a/filewatch/filewatch.go b/filewatch/filewatch.go index d00c0f78..4248212e 100644 --- a/filewatch/filewatch.go +++ b/filewatch/filewatch.go @@ -4,103 +4,55 @@ import ( "io/ioutil" "log" "net/http" - "os" - "strconv" - "time" + "github.com/fsnotify/fsnotify" "github.com/gorilla/websocket" ) -// Adapted from https://github.com/gorilla/websocket -// Copyright (c) 2013 The Gorilla WebSocket Authors -// https://github.com/gorilla/websocket/blob/master/examples/filewatch/main.go - -const ( - // Time allowed to write the file to the client. - writeWait = 10 * time.Second - - // Time allowed to read the next pong message from the client. - pongWait = 60 * time.Second - - // Send pings to client with this period. Must be less than pongWait. - pingPeriod = (pongWait * 9) / 10 - - // Poll file for changes with this period. - filePeriod = 10 * time.Second -) - var upgrader = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, + CheckOrigin: func(r *http.Request) bool { return true }, } -func readFileIfModified(filename string, lastMod time.Time) ([]byte, time.Time, error) { - fi, err := os.Stat(filename) +func writer(ws *websocket.Conn, filename string) { + watcher, err := fsnotify.NewWatcher() if err != nil { - return nil, lastMod, err + log.Fatal(err) } - if !fi.ModTime().After(lastMod) { - return nil, lastMod, nil - } - p, err := ioutil.ReadFile(filename) - if err != nil { - return nil, fi.ModTime(), err - } - return p, fi.ModTime(), nil -} + defer watcher.Close() -func reader(ws *websocket.Conn) { - defer ws.Close() - ws.SetReadLimit(512) - ws.SetReadDeadline(time.Now().Add(pongWait)) - ws.SetPongHandler(func(string) error { ws.SetReadDeadline(time.Now().Add(pongWait)); return nil }) - for { - _, _, err := ws.ReadMessage() - if err != nil { - break + done := make(chan bool) + go func() { + for { + select { + case event := <-watcher.Events: + if event.Op&fsnotify.Write == fsnotify.Write { + log.Println("Modified file:", event.Name) + var p []byte + var err error + + p, err = ioutil.ReadFile(filename) + if err != nil { + log.Fatal(err) + } + + if p != nil { + if err := ws.WriteMessage(websocket.TextMessage, p); err != nil { + return + } + } + } + case err := <-watcher.Errors: + log.Println("Watch error:", err) + } } - } -} - -func writer(ws *websocket.Conn, filename string, lastMod time.Time) { - lastError := "" - pingTicker := time.NewTicker(pingPeriod) - fileTicker := time.NewTicker(filePeriod) - defer func() { - pingTicker.Stop() - fileTicker.Stop() - ws.Close() }() - for { - select { - case <-fileTicker.C: - var p []byte - var err error - p, lastMod, err = readFileIfModified(filename, lastMod) - - if err != nil { - if s := err.Error(); s != lastError { - lastError = s - p = []byte(lastError) - } - } else { - lastError = "" - } - - if p != nil { - ws.SetWriteDeadline(time.Now().Add(writeWait)) - if err := ws.WriteMessage(websocket.TextMessage, p); err != nil { - return - } - } - case <-pingTicker.C: - ws.SetWriteDeadline(time.Now().Add(writeWait)) - if err := ws.WriteMessage(websocket.PingMessage, []byte{}); err != nil { - return - } - } + if err = watcher.Add(filename); err != nil { + log.Fatal(err) } + <-done } func ServeWebsocketFileWatcher(filename string, w http.ResponseWriter, r *http.Request) { @@ -112,11 +64,6 @@ func ServeWebsocketFileWatcher(filename string, w http.ResponseWriter, r *http.R return } - var lastMod time.Time - if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err == nil { - lastMod = time.Unix(0, n) - } - - go writer(ws, filename, lastMod) - reader(ws) + writer(ws, filename) + defer ws.Close() } From 6be895995153128b2390e12be5e1e30688d51678 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 15:52:10 +0100 Subject: [PATCH 21/79] Update to latest master --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index 99acbd4d..e92dfd82 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 99acbd4d92100c44817730da46f0ebceef682ac6 +Subproject commit e92dfd8284a26fdc93b92e230ddac15914a98b58 From 5e3156ab2166d4ee40c0eec6a01deb4a864c8f3f Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 16:00:59 +0100 Subject: [PATCH 22/79] Fetch submodule in appveyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 6fbda7ca..1c44ff87 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,6 +13,7 @@ environment: # scripts that run after cloning repository install: +- git submodule update --init --recursive - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - go version - go env From 10136c07db1c9625ae80e2ea3710de389199614b Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 16:16:18 +0100 Subject: [PATCH 23/79] Publish artifacts --- .travis.yml | 4 ++++ appveyor.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 17bf4aec..556661f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ os: - linux - osx language: go +addons: + artifacts: + paths: + - maputnik install: - go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers diff --git a/appveyor.yml b/appveyor.yml index 1c44ff87..e9c86e4a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,6 +31,9 @@ build_script: - gofmt -s -l . - C:\MinGW\bin\mingw32-make.exe +artifacts: +- path: maputnik + # to disable automatic tests test: off From 69f63f2844ddee0bdfd0fdbdc8f8c09d6e0dfd46 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 16:22:01 +0100 Subject: [PATCH 24/79] Use latest node in desktop build --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 556661f9..7215c2d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ os: - linux - osx +node_js: +- "6.1" language: go addons: artifacts: From a73b2fd7e196cfdcd53131b331588722e2182778 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 16:24:36 +0100 Subject: [PATCH 25/79] Use nvm for travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7215c2d3..940e8ae6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,14 @@ os: - linux - osx -node_js: -- "6.1" language: go addons: artifacts: paths: - maputnik install: +- nvm install 6 +- nvm use 6 - go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers - go get github.com/gorilla/mux From d233e0a14d596c9252474baa7213d48e768fa64d Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 16:33:29 +0100 Subject: [PATCH 26/79] Create public dir --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 940e8ae6..ad0e1022 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,6 @@ install: - go get github.com/urfave/cli - go get github.com/elazarl/go-bindata-assetfs/... - go get github.com/jteeuwen/go-bindata/... -test: +script: +- mkdir -p editor/public - make From 3e46c0d3bae7d1e7335c5809b0f183e1bdbe3722 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 16:49:18 +0100 Subject: [PATCH 27/79] Set version, badge and download instruction --- README.md | 10 +++++++--- maputnik.go | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3b0e2b28..412dc599 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) +# Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/sepe9jhfs123dwk9?svg=true)](https://ci.appveyor.com/project/lukasmartinelli/desktop) + A Golang based cross platform executable for integrating Maputnik locally. This binary packages up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) @@ -6,9 +7,12 @@ and embeds it in the program for easy distribution. It also allows exposing a local style file and work on it both in Maputnik and with your favorite editor. -### Usage -*Not functional yet* +## Install + +You can download a single binary for Linux, OSX or Windows from [the latest releases of **maputnik/editor**](https://github.com/maputnik/editor/releases/latest). + +### Usage Simply start up a web server and access the Maputnik editor GUI at `localhost:8000`. diff --git a/maputnik.go b/maputnik.go index b74e67a0..8e3bd3f1 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,6 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" + app.Version = "0.3.1" app.Flags = []cli.Flag{ cli.StringFlag{ From 147cbc1580cb456bb4c66eedde77e9878a876c44 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 1 Jan 2017 21:12:24 +0100 Subject: [PATCH 28/79] Include subdirectories in embedded assets --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index be8a84d3..582aeec8 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ editor/public: editor/node_modules cd editor && npm run build bindata_assetfs.go: editor/public - go-bindata-assetfs --prefix "editor/" editor/public + go-bindata-assetfs --prefix "editor/" editor/public/... .PHONY: clean clean: From d895cf079c2ef2f4fc1e2ee26530789f9287b93a Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 8 Jan 2017 10:39:12 +0100 Subject: [PATCH 29/79] Execute maputnik in travis --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index ad0e1022..769dcae2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,11 @@ install: - go get github.com/urfave/cli - go get github.com/elazarl/go-bindata-assetfs/... - go get github.com/jteeuwen/go-bindata/... +- wget https://raw.githubusercontent.com/openmaptiles/klokantech-basic-gl-style/master/style.json script: - mkdir -p editor/public - make +- ./maputnik --help +- ./maputnik --version +- ./maputnik --file style.json +- ./maputnik --watch --file style.json From f242c2c015a99308903a127c707d1eeabeae7a8c Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 8 Jan 2017 10:45:01 +0100 Subject: [PATCH 30/79] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 412dc599..69444a0c 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ and embeds it in the program for easy distribution. It also allows exposing a local style file and work on it both in Maputnik and with your favorite editor. +Report issues on [maputnik/editor](https://github.com/maputnik/editor). ## Install From de853eb2d77880a446575230303dbaeaa5309b40 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 8 Jan 2017 13:25:03 +0100 Subject: [PATCH 31/79] Use Go 1.7 explicitely in Travis --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 769dcae2..2bdeb800 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ os: - linux - osx language: go +go: +- 1.7.x addons: artifacts: paths: @@ -22,5 +24,5 @@ script: - make - ./maputnik --help - ./maputnik --version -- ./maputnik --file style.json +- timeout 5s ./maputnik --file style.json - ./maputnik --watch --file style.json From b9e70a943f5461df07d6f72cb8f70685c6783f54 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 8 Jan 2017 13:29:12 +0100 Subject: [PATCH 32/79] Update x/sys --- .travis.yml | 4 ++-- README.md | 1 + appveyor.yml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2bdeb800..21d7f9d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ addons: install: - nvm install 6 - nvm use 6 +- go get -u golang.org/x/sys/... - go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers - go get github.com/gorilla/mux @@ -24,5 +25,4 @@ script: - make - ./maputnik --help - ./maputnik --version -- timeout 5s ./maputnik --file style.json -- ./maputnik --watch --file style.json +- timeout 5s ./maputnik --watch --file style.json diff --git a/README.md b/README.md index 69444a0c..5f9d71ef 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ git clone --recursive git@github.com:maputnik/desktop.git Install the 3rd party dependencies. ``` +go get -u golang.org/x/sys/... go get github.com/gorilla/handlers go get github.com/gorilla/mux go get github.com/gorilla/websocket diff --git a/appveyor.yml b/appveyor.yml index e9c86e4a..97f6e736 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,7 @@ install: - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - go version - go env +- go get -u golang.org/x/sys/... - go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers - go get github.com/gorilla/mux From 004177a3c834ede4101917ed3ff0cc78d5789580 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 8 Jan 2017 13:40:38 +0100 Subject: [PATCH 33/79] Kill watch ocmmand after 5s --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 21d7f9d1..07d98757 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,4 @@ script: - make - ./maputnik --help - ./maputnik --version -- timeout 5s ./maputnik --watch --file style.json +- ./maputnik --watch --file style.json & sleep 5; kill $! From d29a79e79fe33795f449149a771720ed7ae79f78 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 8 Jan 2017 17:15:57 +0100 Subject: [PATCH 34/79] Update editor --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index e92dfd82..7b24cbf3 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit e92dfd8284a26fdc93b92e230ddac15914a98b58 +Subproject commit 7b24cbf39b23692a4f3bb79dda1c1113e6a22270 From 4ffea21c5f74516be2f200d918fc2cc5f5c321c1 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Tue, 10 Jan 2017 14:57:13 +0100 Subject: [PATCH 35/79] Upgrade to latest Maputnik --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index 7b24cbf3..43d9440e 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 7b24cbf39b23692a4f3bb79dda1c1113e6a22270 +Subproject commit 43d9440e05278b9cffc023ed4a98cc918db5b3e3 From 50d61cdb0ed7f561e3fb2372225941765348cff5 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Fri, 13 Jan 2017 21:56:06 +0100 Subject: [PATCH 36/79] Move to v1.0.0 --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index 43d9440e..24dc7134 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 43d9440e05278b9cffc023ed4a98cc918db5b3e3 +Subproject commit 24dc71344e8c319d56914d57e1caa865855dc1d6 From d314add6a97070bf99f290562f5076bd90e3b09e Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Mon, 16 Jan 2017 10:18:27 +0100 Subject: [PATCH 37/79] Release v1.0.1 of CLI --- editor | 2 +- maputnik.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/editor b/editor index 24dc7134..c15ac14f 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 24dc71344e8c319d56914d57e1caa865855dc1d6 +Subproject commit c15ac14f88f97bf7582f964f1ca86c7509ae5fc4 diff --git a/maputnik.go b/maputnik.go index 8e3bd3f1..5cc6fc9e 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "0.3.1" + app.Version = "1.0.1" app.Flags = []cli.Flag{ cli.StringFlag{ From 5b21a2fa4fef95b350db0442401ba7a4d50cc676 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Wed, 18 Jan 2017 13:03:50 +0100 Subject: [PATCH 38/79] Build latest --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index c15ac14f..3a15a3bb 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit c15ac14f88f97bf7582f964f1ca86c7509ae5fc4 +Subproject commit 3a15a3bb064fc950ebb3c5278c71f3e76c472227 From 1997e31b6b61e1e41a0584326c4b08c833be2787 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Wed, 18 Jan 2017 13:06:43 +0100 Subject: [PATCH 39/79] Build latest --- editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor b/editor index 3a15a3bb..e4850805 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 3a15a3bb064fc950ebb3c5278c71f3e76c472227 +Subproject commit e4850805fbfbfafd15808b11fab468444aaf44f1 From 87290889fdaf0ed879f604007840a77275521673 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Wed, 25 Jan 2017 13:57:27 +0100 Subject: [PATCH 40/79] Upgrade to v1.0.2 --- editor | 2 +- maputnik.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/editor b/editor index e4850805..5c286f8d 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit e4850805fbfbfafd15808b11fab468444aaf44f1 +Subproject commit 5c286f8d969678815fe38c2a87a3346b03d8ef74 diff --git a/maputnik.go b/maputnik.go index 5cc6fc9e..652cb641 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "1.0.1" + app.Version = "1.0.2" app.Flags = []cli.Flag{ cli.StringFlag{ From 3ef0a90de40324fcbffb29673147a64b8f819548 Mon Sep 17 00:00:00 2001 From: Fabian Wickborn Date: Wed, 25 Oct 2017 20:33:45 +0200 Subject: [PATCH 41/79] Fix README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f9d71ef..7b0cdeb4 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,9 @@ maputnik --watch --file basic-v9.json | Method | Description |---------------------------------|--------------------------------------- -| `GET /files` | List all configured style files -| `GET /files/{filename}` | Get contents of a single style file -| `PUT GET /files/{filename}` | Update contents of a style file +| `GET /files` | List all configured style files +| `GET /files/{filename}` | Get contents of a single style file +| `PUT /files/{filename}` | Update contents of a style file | `WEBSOCKET /ws` | Listen to change events for the configured style files ### Build From d3ecef3de6862117e91569cb42baef70f3488331 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 15 Apr 2018 16:14:22 +0530 Subject: [PATCH 42/79] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 5f9d71ef..091962ef 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/sepe9jhfs123dwk9?svg=true)](https://ci.appveyor.com/project/lukasmartinelli/desktop) +> :warning: The desktop build of Maputnik is no longer maintained. + +![](https://camo.githubusercontent.com/ea32c1383049053bd0ceba2b31834841f229bf64/68747470733a2f2f63312e737461746963666c69636b722e636f6d2f352f343339362f33363730343333373739315f343236383236313038395f6e2e6a7067) + +--- A Golang based cross platform executable for integrating Maputnik locally. This binary packages up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) From c55278e7da1bdcbcd536685b5323d7cf6455f2a0 Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 15:56:29 +0100 Subject: [PATCH 43/79] Remove editor submodule --- .gitmodules | 4 ---- editor | 1 - 2 files changed, 5 deletions(-) delete mode 100644 .gitmodules delete mode 160000 editor diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ca9a4e79..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "editor"] - path = editor - url = https://github.com/maputnik/editor.git - branch = master diff --git a/editor b/editor deleted file mode 160000 index 5c286f8d..00000000 --- a/editor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5c286f8d969678815fe38c2a87a3346b03d8ef74 From 35c0150522ea66d8f30e1f89176d34f92581ee42 Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 16:05:02 +0100 Subject: [PATCH 44/79] Download release instead of building editor from source --- .gitignore | 2 ++ .travis.yml | 3 --- Makefile | 13 +++++++------ appveyor.yml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 17a0109d..5a236cd6 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Folders _obj _test +editor # Architecture specific extensions/prefixes *.[568vq] @@ -25,6 +26,7 @@ _testmain.go # Bindata bindata_assetfs.go +bindata.go # Built binary maputnik diff --git a/.travis.yml b/.travis.yml index 07d98757..2b33de95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,6 @@ addons: paths: - maputnik install: -- nvm install 6 -- nvm use 6 - go get -u golang.org/x/sys/... - go get github.com/fsnotify/fsnotify - go get github.com/gorilla/handlers @@ -21,7 +19,6 @@ install: - go get github.com/jteeuwen/go-bindata/... - wget https://raw.githubusercontent.com/openmaptiles/klokantech-basic-gl-style/master/style.json script: -- mkdir -p editor/public - make - ./maputnik --help - ./maputnik --version diff --git a/Makefile b/Makefile index 582aeec8..2b3b94ce 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,22 @@ SOURCEDIR=. SOURCES := $(shell find $(SOURCEDIR) -name '*.go') BINARY=maputnik +EDITOR_VERSION ?= v1.5.0 all: $(BINARY) $(BINARY): $(SOURCES) bindata_assetfs.go go build -o ${BINARY} -editor/node_modules: - cd editor && npm install +editor/create_folder: + mkdir -p editor -editor/public: editor/node_modules - cd editor && npm run build +editor/pull_release: editor/create_folder + cd editor && rm -rf public && curl -L https://github.com/maputnik/editor/releases/download/$(EDITOR_VERSION)/public.zip --output public.zip && unzip public.zip && rm public.zip -bindata_assetfs.go: editor/public +bindata_assetfs.go: editor/pull_release go-bindata-assetfs --prefix "editor/" editor/public/... .PHONY: clean clean: - rm -rf editor/public && rm -f bindata_assetfs.go && rm -f maputnik + rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -f maputnik diff --git a/appveyor.yml b/appveyor.yml index 97f6e736..2cc98eed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,6 @@ environment: # scripts that run after cloning repository install: -- git submodule update --init --recursive - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - go version - go env @@ -25,6 +24,7 @@ install: - go get github.com/urfave/cli - go get github.com/elazarl/go-bindata-assetfs/... - go get github.com/jteeuwen/go-bindata/... +- make # to run your custom scripts instead of automatic MSBuild build_script: From 8052701021c179521a6b343dc29de115d463cd1f Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 17:18:48 +0100 Subject: [PATCH 45/79] Use go cross compile to build once with travis for all platforms --- .travis.yml | 5 ++++- Makefile | 4 ++-- README.md | 6 +++--- appveyor.yml | 42 ------------------------------------------ 4 files changed, 9 insertions(+), 48 deletions(-) delete mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml index 2b33de95..18120461 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ go: addons: artifacts: paths: - - maputnik + - maputnik_linux + - maputnik_darwin + - maputnik_windows.exe install: - go get -u golang.org/x/sys/... - go get github.com/fsnotify/fsnotify @@ -17,6 +19,7 @@ install: - go get github.com/urfave/cli - go get github.com/elazarl/go-bindata-assetfs/... - go get github.com/jteeuwen/go-bindata/... +- go get github.com/mitchellh/gox - wget https://raw.githubusercontent.com/openmaptiles/klokantech-basic-gl-style/master/style.json script: - make diff --git a/Makefile b/Makefile index 2b3b94ce..4548565d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ EDITOR_VERSION ?= v1.5.0 all: $(BINARY) $(BINARY): $(SOURCES) bindata_assetfs.go - go build -o ${BINARY} + gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "${BINARY}_{{.OS}}" editor/create_folder: mkdir -p editor @@ -19,4 +19,4 @@ bindata_assetfs.go: editor/pull_release .PHONY: clean clean: - rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -f maputnik + rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -f maputnik_* diff --git a/README.md b/README.md index 091962ef..2745650a 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,10 @@ maputnik --watch --file basic-v9.json ### Build -Clone the repository **recursively** since the Maputnik editor is embedded -as submodule. Make sure you clone it into the correct directory `$GOPATH/src/github.com/maputnik`. +Clone the repository. Make sure you clone it into the correct directory `$GOPATH/src/github.com/maputnik`. ``` -git clone --recursive git@github.com:maputnik/desktop.git +git clone git@github.com:maputnik/desktop.git ``` Install the 3rd party dependencies. @@ -72,6 +71,7 @@ go get github.com/fsnotify/fsnotify go get github.com/urfave/cli go get github.com/elazarl/go-bindata-assetfs/... go get github.com/jteeuwen/go-bindata/... +go get github.com/mitchellh/gox ``` Run `make` to build the app distribution bundle and create the `maputnik` binary diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2cc98eed..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -# version format -version: "{build}" - -# Operating system (build VM template) -os: Windows Server 2012 R2 - -clone_folder: c:\gopath\src\github.com\maputnik\desktop - -# environment variables -environment: - GOPATH: c:\gopath - GO15VENDOREXPERIMENT: 1 - -# scripts that run after cloning repository -install: -- set PATH=%GOPATH%\bin;c:\go\bin;%PATH% -- go version -- go env -- go get -u golang.org/x/sys/... -- go get github.com/fsnotify/fsnotify -- go get github.com/gorilla/handlers -- go get github.com/gorilla/mux -- go get github.com/gorilla/websocket -- go get github.com/urfave/cli -- go get github.com/elazarl/go-bindata-assetfs/... -- go get github.com/jteeuwen/go-bindata/... -- make - -# to run your custom scripts instead of automatic MSBuild -build_script: -- go vet ./... -- gofmt -s -l . -- C:\MinGW\bin\mingw32-make.exe - -artifacts: -- path: maputnik - -# to disable automatic tests -test: off - -# to disable deployment -deploy: off From 69519df82f70aac75782583b5c9399698986b906 Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 17:25:27 +0100 Subject: [PATCH 46/79] Use folders for different maputnik executables --- .travis.yml | 10 ++++------ Makefile | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18120461..9e53ba17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,7 @@ go: addons: artifacts: paths: - - maputnik_linux - - maputnik_darwin - - maputnik_windows.exe + - bin install: - go get -u golang.org/x/sys/... - go get github.com/fsnotify/fsnotify @@ -23,6 +21,6 @@ install: - wget https://raw.githubusercontent.com/openmaptiles/klokantech-basic-gl-style/master/style.json script: - make -- ./maputnik --help -- ./maputnik --version -- ./maputnik --watch --file style.json & sleep 5; kill $! +- ./bin/linux/maputnik --help +- ./bin/linux/maputnik --version +- ./bin/linux/maputnik --watch --file style.json & sleep 5; kill $! diff --git a/Makefile b/Makefile index 4548565d..f5ea7b43 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ EDITOR_VERSION ?= v1.5.0 all: $(BINARY) $(BINARY): $(SOURCES) bindata_assetfs.go - gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "${BINARY}_{{.OS}}" + gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}" editor/create_folder: mkdir -p editor @@ -19,4 +19,4 @@ bindata_assetfs.go: editor/pull_release .PHONY: clean clean: - rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -f maputnik_* + rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -f bin From 5b8412765b71112c6e02ef8124d8b2eca82ecbde Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 17:29:49 +0100 Subject: [PATCH 47/79] Linux should be enough to build go for linux, windows and mac --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9e53ba17..2914179b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ os: - linux -- osx language: go go: - 1.7.x From 3a45b8dd4104f8679f80de23d3fd89d92f24f02b Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 17:33:38 +0100 Subject: [PATCH 48/79] Move dependencies into Makefile --- .travis.yml | 9 --------- Makefile | 13 ++++++++++++- README.md | 19 ++----------------- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2914179b..d0c63cb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,15 +8,6 @@ addons: paths: - bin install: -- go get -u golang.org/x/sys/... -- go get github.com/fsnotify/fsnotify -- go get github.com/gorilla/handlers -- go get github.com/gorilla/mux -- go get github.com/gorilla/websocket -- go get github.com/urfave/cli -- go get github.com/elazarl/go-bindata-assetfs/... -- go get github.com/jteeuwen/go-bindata/... -- go get github.com/mitchellh/gox - wget https://raw.githubusercontent.com/openmaptiles/klokantech-basic-gl-style/master/style.json script: - make diff --git a/Makefile b/Makefile index f5ea7b43..fbcbc017 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,21 @@ EDITOR_VERSION ?= v1.5.0 all: $(BINARY) +dependencies: + go get -u golang.org/x/sys/... + go get github.com/gorilla/handlers + go get github.com/gorilla/mux + go get github.com/gorilla/websocket + go get github.com/fsnotify/fsnotify + go get github.com/urfave/cli + go get github.com/elazarl/go-bindata-assetfs/... + go get github.com/jteeuwen/go-bindata/... + go get github.com/mitchellh/gox + $(BINARY): $(SOURCES) bindata_assetfs.go gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}" -editor/create_folder: +editor/create_folder: dependencies mkdir -p editor editor/pull_release: editor/create_folder diff --git a/README.md b/README.md index 2745650a..6078d590 100644 --- a/README.md +++ b/README.md @@ -60,25 +60,10 @@ Clone the repository. Make sure you clone it into the correct directory `$GOPATH git clone git@github.com:maputnik/desktop.git ``` -Install the 3rd party dependencies. - -``` -go get -u golang.org/x/sys/... -go get github.com/gorilla/handlers -go get github.com/gorilla/mux -go get github.com/gorilla/websocket -go get github.com/fsnotify/fsnotify -go get github.com/urfave/cli -go get github.com/elazarl/go-bindata-assetfs/... -go get github.com/jteeuwen/go-bindata/... -go get github.com/mitchellh/gox -``` - -Run `make` to build the app distribution bundle and create the `maputnik` binary -embedding the editor. +Run `make` to install the 3rd party dependencies and build the `maputnik` binary embedding the editor. ``` make ``` -You should now find the `maputnik` binary in your directory. +You should now find the `maputnik` binary in your `bin` directory. From 18e15eeb5c170f6ef071368fb6485cce24eed103 Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 17:35:23 +0100 Subject: [PATCH 49/79] remove complete bin folder in `make clean` --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fbcbc017..067763a8 100644 --- a/Makefile +++ b/Makefile @@ -30,4 +30,4 @@ bindata_assetfs.go: editor/pull_release .PHONY: clean clean: - rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -f bin + rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -rf bin From 85dd22b09ad0f3b81c93e89209d65a8297b7e57a Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Thu, 7 Feb 2019 17:58:11 +0100 Subject: [PATCH 50/79] Use recent go version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0c63cb8..50b1aa22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ os: - linux language: go go: -- 1.7.x +- 1.11.x addons: artifacts: paths: From e3a9a8a38ce4a8a7841d4d7c822fa12d63240ca2 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Sat, 9 Feb 2019 10:09:05 +0100 Subject: [PATCH 51/79] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e6f27046..b97c6f9b 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,9 @@ maputnik --watch --file basic-v9.json | Method | Description |---------------------------------|--------------------------------------- -| `GET /files` | List all configured style files -| `GET /files/{filename}` | Get contents of a single style file -| `PUT /files/{filename}` | Update contents of a style file +| `GET /styles` | List the ID of all configured style files +| `GET /styles/{filename}` | Get contents of a single style file +| `PUT /styles/{filename}` | Update contents of a style file | `WEBSOCKET /ws` | Listen to change events for the configured style files ### Build From 4533fd06ed20dec34b056142f489f28dceabfad4 Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Sat, 9 Feb 2019 12:39:32 +0100 Subject: [PATCH 52/79] Have Desktop version (changes in Desktop code) and editor version in version field --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index 652cb641..52ad596f 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "1.0.2" + app.Version = "Desktop: 1.0.3; Editor: 1.5.0" app.Flags = []cli.Flag{ cli.StringFlag{ From e52a63e1dd95cc88dabbd9a2fa66e52fbe3d113e Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Sat, 9 Feb 2019 12:47:47 +0100 Subject: [PATCH 53/79] Remove the deprecation warning from the readme --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 6078d590..64764d3d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/sepe9jhfs123dwk9?svg=true)](https://ci.appveyor.com/project/lukasmartinelli/desktop) -> :warning: The desktop build of Maputnik is no longer maintained. - -![](https://camo.githubusercontent.com/ea32c1383049053bd0ceba2b31834841f229bf64/68747470733a2f2f63312e737461746963666c69636b722e636f6d2f352f343339362f33363730343333373739315f343236383236313038395f6e2e6a7067) - --- A Golang based cross platform executable for integrating Maputnik locally. From 562a4f7322caff7a3ffc65a56ee9783798d77e8c Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Sat, 9 Feb 2019 13:45:45 +0100 Subject: [PATCH 54/79] Remove appveyor status from README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 64764d3d..9f9f9a9c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/sepe9jhfs123dwk9?svg=true)](https://ci.appveyor.com/project/lukasmartinelli/desktop) +# Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) --- From 2e58be1c90e0bec41b256d8b7a01492ade56261e Mon Sep 17 00:00:00 2001 From: Lukas Welte Date: Sat, 9 Feb 2019 13:47:58 +0100 Subject: [PATCH 55/79] Switch around editor and desktop in version field so that it prints nicer --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index 52ad596f..c371fba4 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Desktop: 1.0.3; Editor: 1.5.0" + app.Version = "Editor: 1.5.0; Desktop: 1.0.3" app.Flags = []cli.Flag{ cli.StringFlag{ From d951256b1c1aa5ce19161de1f7632dcbd51b977b Mon Sep 17 00:00:00 2001 From: Jesse Crocker Date: Mon, 15 Apr 2019 12:29:15 -0600 Subject: [PATCH 56/79] Add option to choose a listening port --- maputnik.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/maputnik.go b/maputnik.go index c371fba4..611e025c 100644 --- a/maputnik.go +++ b/maputnik.go @@ -27,6 +27,11 @@ func main() { Name: "watch", Usage: "Notify web client about JSON style file changes", }, + cli.IntFlag{ + Name: "port", + Value: 8000, + Usage: "TCP port to listen on", + }, } app.Action = func(c *cli.Context) error { @@ -56,8 +61,8 @@ func main() { loggedRouter := handlers.LoggingHandler(os.Stdout, router) corsRouter := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}), handlers.AllowedMethods([]string{"GET", "PUT"}), handlers.AllowedOrigins([]string{"*"}), handlers.AllowCredentials())(loggedRouter) - fmt.Println("Exposing Maputnik on http://localhost:8000") - return http.ListenAndServe(":8000", corsRouter) + fmt.Printf("Exposing Maputnik on http://localhost:%d\n", c.Int("port")) + return http.ListenAndServe(fmt.Sprintf(":%d", c.Int("port")), corsRouter) } app.Run(os.Args) From 1ce2d59b9ba706385500679fc28e52f4a83f3ea6 Mon Sep 17 00:00:00 2001 From: Jesse Crocker Date: Wed, 4 Sep 2019 09:21:56 -0600 Subject: [PATCH 57/79] Add --port option to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b5d8d78d..b3f1c816 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ use Maputnik. maputnik --watch --file basic-v9.json ``` +Choose a local port to listen on, instead of using the default port 8000. + +``` +maputnik --port 8001 +``` + ### API `maputnik` exposes the configured styles via a HTTP API. From 3153eea1daac02006c57267f53c54dccf1bd2414 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Tue, 8 Oct 2019 22:29:45 +0200 Subject: [PATCH 58/79] Update version numbers --- Makefile | 2 +- maputnik.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 067763a8..77e33466 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ SOURCEDIR=. SOURCES := $(shell find $(SOURCEDIR) -name '*.go') BINARY=maputnik -EDITOR_VERSION ?= v1.5.0 +EDITOR_VERSION ?= v1.6.0 all: $(BINARY) diff --git a/maputnik.go b/maputnik.go index 611e025c..a3391449 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.5.0; Desktop: 1.0.3" + app.Version = "Editor: 1.6.0; Desktop: 1.0.4" app.Flags = []cli.Flag{ cli.StringFlag{ From 538cea7f458910f7963e8b75453483eebcd74259 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Sun, 13 Oct 2019 14:28:42 +0200 Subject: [PATCH 59/79] Update editor to v1.6.1 --- Makefile | 2 +- maputnik.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 77e33466..dce0af9d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ SOURCEDIR=. SOURCES := $(shell find $(SOURCEDIR) -name '*.go') BINARY=maputnik -EDITOR_VERSION ?= v1.6.0 +EDITOR_VERSION ?= v1.6.1 all: $(BINARY) diff --git a/maputnik.go b/maputnik.go index a3391449..16e076d7 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.6.0; Desktop: 1.0.4" + app.Version = "Editor: 1.6.1; Desktop: 1.0.4" app.Flags = []cli.Flag{ cli.StringFlag{ From 4a3825fa897f88233535a633a038442fc45f7fc0 Mon Sep 17 00:00:00 2001 From: Takayuki Miyauchi Date: Fri, 21 Feb 2020 07:24:00 +0900 Subject: [PATCH 60/79] fixed the error `cannot use cli.StringFlag literal ...` --- maputnik.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maputnik.go b/maputnik.go index 16e076d7..0a28f18d 100644 --- a/maputnik.go +++ b/maputnik.go @@ -19,15 +19,15 @@ func main() { app.Version = "Editor: 1.6.1; Desktop: 1.0.4" app.Flags = []cli.Flag{ - cli.StringFlag{ + &cli.StringFlag{ Name: "file, f", Usage: "Allow access to JSON style from web client", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "watch", Usage: "Notify web client about JSON style file changes", }, - cli.IntFlag{ + &cli.IntFlag{ Name: "port", Value: 8000, Usage: "TCP port to listen on", From 293342e4fbdcbf5f5935d340f0670dd3cd40c667 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 28 May 2020 22:04:40 +0200 Subject: [PATCH 61/79] Update Desktop version number --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index 0a28f18d..a1d1d706 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.6.1; Desktop: 1.0.4" + app.Version = "Editor: 1.6.1; Desktop: 1.0.5" app.Flags = []cli.Flag{ &cli.StringFlag{ From 686fd27b356ab76b2e546fcaefe153f0fd368ab1 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 28 May 2020 22:05:48 +0200 Subject: [PATCH 62/79] Update Editor to v1.7.0 --- Makefile | 2 +- maputnik.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dce0af9d..3c125ec7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ SOURCEDIR=. SOURCES := $(shell find $(SOURCEDIR) -name '*.go') BINARY=maputnik -EDITOR_VERSION ?= v1.6.1 +EDITOR_VERSION ?= v1.7.0 all: $(BINARY) diff --git a/maputnik.go b/maputnik.go index a1d1d706..c0dc1671 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.6.1; Desktop: 1.0.5" + app.Version = "Editor: 1.7.0; Desktop: 1.0.5" app.Flags = []cli.Flag{ &cli.StringFlag{ From 0e788c5841b09a7a9535c391acbc63541e66433a Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 28 May 2020 22:55:39 +0200 Subject: [PATCH 63/79] Update go version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 50b1aa22..855aebed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ os: - linux language: go go: -- 1.11.x +- 1.14.x addons: artifacts: paths: From 6f21fd8dff52fa5e15ab6bbeb10b21447d0889fd Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 28 May 2020 22:56:08 +0200 Subject: [PATCH 64/79] Use OSM Liberty style --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 855aebed..c62a2151 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ addons: paths: - bin install: -- wget https://raw.githubusercontent.com/openmaptiles/klokantech-basic-gl-style/master/style.json +- wget https://maputnik.github.io/osm-liberty/style.json script: - make - ./bin/linux/maputnik --help From cdcc61e23496b88cc1ebd313d21b36dac2cb3421 Mon Sep 17 00:00:00 2001 From: pathmapper <20856381+pathmapper@users.noreply.github.com> Date: Sun, 31 May 2020 21:04:11 +0200 Subject: [PATCH 65/79] Create go.yml --- .github/workflows/go.yml | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..7746c1d8 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,61 @@ +name: go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + env: + GOPATH: ${{ github.workspace }} + GO111MODULE: off + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ^1.14.x + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + with: + path: ./src/github.com/maputnik/desktop/ + + - name: Get style + run: wget https://maputnik.github.io/osm-liberty/style.json + + - name: Make + run: cd src/github.com/maputnik/desktop/ && make + + - name: Test --help + run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --help + + - name: Test --version + run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --version + + - name: Test --watch + run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --watch --file style.json & sleep 5; kill $! + + - name: Artifacts/linux + uses: actions/upload-artifact@v1 + with: + name: maputnik-linux + path: ./src/github.com/maputnik/desktop/bin/linux/ + + - name: Artifacts/darwin + uses: actions/upload-artifact@v1 + with: + name: maputnik-darwin + path: ./src/github.com/maputnik/desktop/bin/darwin/ + + - name: Artifacts/windows + uses: actions/upload-artifact@v1 + with: + name: maputnik-windows + path: ./src/github.com/maputnik/desktop/bin/windows/ From 1e7b6e809c0039e4c8ccc2377bf8b6fe3c93e399 Mon Sep 17 00:00:00 2001 From: pathmapper <20856381+pathmapper@users.noreply.github.com> Date: Sun, 31 May 2020 21:05:00 +0200 Subject: [PATCH 66/79] Remove Travis --- .travis.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c62a2151..00000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -os: -- linux -language: go -go: -- 1.14.x -addons: - artifacts: - paths: - - bin -install: -- wget https://maputnik.github.io/osm-liberty/style.json -script: -- make -- ./bin/linux/maputnik --help -- ./bin/linux/maputnik --version -- ./bin/linux/maputnik --watch --file style.json & sleep 5; kill $! From 6d00214f55802d96d3faaa13c83c9944e678b208 Mon Sep 17 00:00:00 2001 From: pathmapper <20856381+pathmapper@users.noreply.github.com> Date: Sun, 31 May 2020 21:09:02 +0200 Subject: [PATCH 67/79] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3f1c816..6b3393f7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Maputnik Desktop [![Build Status](https://travis-ci.org/maputnik/desktop.svg?branch=master)](https://travis-ci.org/maputnik/desktop) +# Maputnik Desktop [![GitHub CI status](https://github.com/maputnik/desktop/workflows/go/badge.svg)](https://github.com/maputnik/desktop/actions?query=workflow%3Ago) --- From 7dfcdac202dfcf03e26cd63b4aed32ff46ddb87a Mon Sep 17 00:00:00 2001 From: pathmapper Date: Sun, 31 May 2020 21:23:52 +0200 Subject: [PATCH 68/79] Rename ci --- .github/workflows/{go.yml => ci.yml} | 8 ++++---- README.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{go.yml => ci.yml} (98%) diff --git a/.github/workflows/go.yml b/.github/workflows/ci.yml similarity index 98% rename from .github/workflows/go.yml rename to .github/workflows/ci.yml index 7746c1d8..21f0298d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: go +name: ci on: push: @@ -35,10 +35,10 @@ jobs: - name: Test --help run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --help - + - name: Test --version run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --version - + - name: Test --watch run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --watch --file style.json & sleep 5; kill $! @@ -53,7 +53,7 @@ jobs: with: name: maputnik-darwin path: ./src/github.com/maputnik/desktop/bin/darwin/ - + - name: Artifacts/windows uses: actions/upload-artifact@v1 with: diff --git a/README.md b/README.md index 6b3393f7..286929dc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Maputnik Desktop [![GitHub CI status](https://github.com/maputnik/desktop/workflows/go/badge.svg)](https://github.com/maputnik/desktop/actions?query=workflow%3Ago) +# Maputnik Desktop [![GitHub CI status](https://github.com/maputnik/desktop/workflows/ci/badge.svg)](https://github.com/maputnik/desktop/actions?query=workflow%3Aci) --- From d9e3aa6ac47496e94d581b7e1cc75078e9a9b795 Mon Sep 17 00:00:00 2001 From: pathmapper <20856381+pathmapper@users.noreply.github.com> Date: Sun, 31 May 2020 21:41:02 +0200 Subject: [PATCH 69/79] Update for use in the editor ci workflow --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3c125ec7..113d93c6 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,8 @@ editor/create_folder: dependencies mkdir -p editor editor/pull_release: editor/create_folder - cd editor && rm -rf public && curl -L https://github.com/maputnik/editor/releases/download/$(EDITOR_VERSION)/public.zip --output public.zip && unzip public.zip && rm public.zip + # if the directory /home/runner/work/editor/editor/build/build exists, we assume that we are are running the makefile within the editor ci workflow + test -d /home/runner/work/editor/editor/build/build && echo "exists" && cd editor && cp -R /home/runner/work/editor/editor/build/build public/ || (echo "does not exist" && cd editor && rm -rf public && curl -L https://github.com/maputnik/editor/releases/download/$(EDITOR_VERSION)/public.zip --output public.zip && unzip public.zip && rm public.zip) bindata_assetfs.go: editor/pull_release go-bindata-assetfs --prefix "editor/" editor/public/... From 1495d11462076b10ed8b274f35384f8ffbf89209 Mon Sep 17 00:00:00 2001 From: pathmapper <20856381+pathmapper@users.noreply.github.com> Date: Wed, 3 Jun 2020 15:05:47 +0200 Subject: [PATCH 70/79] Update desktop version number The makefile was updated in https://github.com/maputnik/desktop/pull/14 --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index c0dc1671..fc686bda 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.7.0; Desktop: 1.0.5" + app.Version = "Editor: 1.7.0; Desktop: 1.0.6" app.Flags = []cli.Flag{ &cli.StringFlag{ From 77b3655c3c7a836fd059f2effa601de64e773e6f Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 23 Jul 2020 19:22:43 +0200 Subject: [PATCH 71/79] Add option to serve directory under /static/ (from #2) --- maputnik.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/maputnik.go b/maputnik.go index fc686bda..d426f827 100644 --- a/maputnik.go +++ b/maputnik.go @@ -32,6 +32,10 @@ func main() { Value: 8000, Usage: "TCP port to listen on", }, + cli.StringFlag{ + Name: "static", + Usage: "Serve directory under /static/", + } } app.Action = func(c *cli.Context) error { @@ -57,6 +61,12 @@ func main() { } } + staticDir := c.String("static") + if staticDir != "" { + h := http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))) + router.PathPrefix("/static/").Handler(h) + } + router.PathPrefix("/").Handler(http.StripPrefix("/", gui)) loggedRouter := handlers.LoggingHandler(os.Stdout, router) corsRouter := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}), handlers.AllowedMethods([]string{"GET", "PUT"}), handlers.AllowedOrigins([]string{"*"}), handlers.AllowCredentials())(loggedRouter) From 698fdfc95824d0097e423c109adb4038dc19fab7 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 23 Jul 2020 19:28:34 +0200 Subject: [PATCH 72/79] Fix syntax error --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index d426f827..f713806d 100644 --- a/maputnik.go +++ b/maputnik.go @@ -35,7 +35,7 @@ func main() { cli.StringFlag{ Name: "static", Usage: "Serve directory under /static/", - } + }, } app.Action = func(c *cli.Context) error { From e24d390f7c198532a2bc980b4b8216d1dd1fe50d Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 23 Jul 2020 19:33:23 +0200 Subject: [PATCH 73/79] Fix build error --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index f713806d..4b4f7030 100644 --- a/maputnik.go +++ b/maputnik.go @@ -32,7 +32,7 @@ func main() { Value: 8000, Usage: "TCP port to listen on", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "static", Usage: "Serve directory under /static/", }, From 77ed14a340b7bd7d99f5912d8f8a617c9ec0b5d2 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 23 Jul 2020 19:52:38 +0200 Subject: [PATCH 74/79] Update desktop version number --- maputnik.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputnik.go b/maputnik.go index 4b4f7030..ba96b0bd 100644 --- a/maputnik.go +++ b/maputnik.go @@ -16,7 +16,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.7.0; Desktop: 1.0.6" + app.Version = "Editor: 1.7.0; Desktop: 1.0.7" app.Flags = []cli.Flag{ &cli.StringFlag{ From 46616773879751967e43d9c4f881502d298c3827 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 23 Jul 2020 20:19:33 +0200 Subject: [PATCH 75/79] Add docs --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 286929dc..b6b8baa6 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,14 @@ You can download a single binary for Linux, OSX or Windows from [the latest rele Simply start up a web server and access the Maputnik editor GUI at `localhost:8000`. -``` +```bash maputnik ``` Expose a local style file to Maputnik allowing the web based editor to save to the local filesystem. -``` +```bash maputnik --file basic-v9.json ``` @@ -33,16 +33,23 @@ Watch the local style for changes and inform the editor via web socket. This makes it possible to edit the style with a local text editor and still use Maputnik. -``` +```bash maputnik --watch --file basic-v9.json ``` Choose a local port to listen on, instead of using the default port 8000. -``` +```bash maputnik --port 8001 ``` +Specify a path to a directory which, if it exists, will be served under http://localhost:8000/static/ . +Could be used to serve sprites and glyphs. + +```bash +maputnik --static ./localFolder +``` + ### API `maputnik` exposes the configured styles via a HTTP API. From b7ef0943f423688a468c8941b9a218873b8522e5 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Thu, 23 Jul 2020 20:25:24 +0200 Subject: [PATCH 76/79] Fix formatting --- maputnik.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/maputnik.go b/maputnik.go index ba96b0bd..0eecee85 100644 --- a/maputnik.go +++ b/maputnik.go @@ -62,10 +62,10 @@ func main() { } staticDir := c.String("static") - if staticDir != "" { - h := http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))) - router.PathPrefix("/static/").Handler(h) - } + if staticDir != "" { + h := http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))) + router.PathPrefix("/static/").Handler(h) + } router.PathPrefix("/").Handler(http.StripPrefix("/", gui)) loggedRouter := handlers.LoggingHandler(os.Stdout, router) From 7265bf0aa4664a9ffe675aee508d29ef08ef6859 Mon Sep 17 00:00:00 2001 From: Kevin Schaul Date: Tue, 18 Jul 2023 09:44:57 -0500 Subject: [PATCH 77/79] Refactor into a go module, update dependencies (#18) * Refactor into a go module `go get` is no longer supported outside of a go module. This commit converts the project into a go module, moving dependencies into a go.mod file. * Use go.rice instead of go-bindata-assetfs go.rice appears to be maintained and more popular * Edit dependencies * Pin to specific versions * Updating workflows * Fix syntax, I hope * Update go * Increment version number * Version number * version number --- .github/workflows/ci.yml | 78 +++++++++++++++++----------------------- .gitignore | 5 ++- Makefile | 31 ++++++++-------- go.mod | 27 ++++++++++++++ go.sum | 54 ++++++++++++++++++++++++++++ maputnik.go | 5 +-- 6 files changed, 133 insertions(+), 67 deletions(-) create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21f0298d..abb90994 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,61 +1,49 @@ name: ci -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push] jobs: - build: - name: Build + runs-on: ubuntu-latest - env: - GOPATH: ${{ github.workspace }} - GO111MODULE: off + steps: + - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ^1.14.x - id: go + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18 - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - with: - path: ./src/github.com/maputnik/desktop/ + - name: Make + run: make - - name: Get style - run: wget https://maputnik.github.io/osm-liberty/style.json + - name: Test --help + run: ./bin/linux/maputnik --help - - name: Make - run: cd src/github.com/maputnik/desktop/ && make + - name: Test --version + run: ./bin/linux/maputnik --version - - name: Test --help - run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --help + - name: Get style + run: wget https://maputnik.github.io/osm-liberty/style.json - - name: Test --version - run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --version + - name: Test --watch + run: ./bin/linux/maputnik --watch --file style.json & sleep 5; kill $! - - name: Test --watch - run: ./src/github.com/maputnik/desktop/bin/linux/maputnik --watch --file style.json & sleep 5; kill $! + - name: Artifacts/linux + uses: actions/upload-artifact@v3 + with: + name: maputnik-linux + path: bin/linux/ - - name: Artifacts/linux - uses: actions/upload-artifact@v1 - with: - name: maputnik-linux - path: ./src/github.com/maputnik/desktop/bin/linux/ + - name: Artifacts/darwin + uses: actions/upload-artifact@v3 + with: + name: maputnik-darwin + path: bin/darwin/ - - name: Artifacts/darwin - uses: actions/upload-artifact@v1 - with: - name: maputnik-darwin - path: ./src/github.com/maputnik/desktop/bin/darwin/ - - - name: Artifacts/windows - uses: actions/upload-artifact@v1 - with: - name: maputnik-windows - path: ./src/github.com/maputnik/desktop/bin/windows/ + - name: Artifacts/windows + uses: actions/upload-artifact@v3 + with: + name: maputnik-windows + path: bin/windows/ diff --git a/.gitignore b/.gitignore index 5a236cd6..a8e1971d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,9 +24,8 @@ _testmain.go *.test *.prof -# Bindata -bindata_assetfs.go -bindata.go +# Binary version of pubilic/editor +rice-box.go # Built binary maputnik diff --git a/Makefile b/Makefile index 113d93c6..140d9d6b 100644 --- a/Makefile +++ b/Makefile @@ -2,33 +2,30 @@ SOURCEDIR=. SOURCES := $(shell find $(SOURCEDIR) -name '*.go') BINARY=maputnik EDITOR_VERSION ?= v1.7.0 +GOPATH := $(if $(GOPATH),$(GOPATH),$(HOME)/go) +GOBIN := $(if $(GOBIN),$(GOBIN),$(HOME)/go/bin) all: $(BINARY) -dependencies: - go get -u golang.org/x/sys/... - go get github.com/gorilla/handlers - go get github.com/gorilla/mux - go get github.com/gorilla/websocket - go get github.com/fsnotify/fsnotify - go get github.com/urfave/cli - go get github.com/elazarl/go-bindata-assetfs/... - go get github.com/jteeuwen/go-bindata/... - go get github.com/mitchellh/gox +$(BINARY): $(GOBIN)/gox $(SOURCES) rice-box.go + $(GOBIN)/gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}" -$(BINARY): $(SOURCES) bindata_assetfs.go - gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}" - -editor/create_folder: dependencies +editor/create_folder: mkdir -p editor editor/pull_release: editor/create_folder # if the directory /home/runner/work/editor/editor/build/build exists, we assume that we are are running the makefile within the editor ci workflow test -d /home/runner/work/editor/editor/build/build && echo "exists" && cd editor && cp -R /home/runner/work/editor/editor/build/build public/ || (echo "does not exist" && cd editor && rm -rf public && curl -L https://github.com/maputnik/editor/releases/download/$(EDITOR_VERSION)/public.zip --output public.zip && unzip public.zip && rm public.zip) -bindata_assetfs.go: editor/pull_release - go-bindata-assetfs --prefix "editor/" editor/public/... +$(GOBIN)/gox: + go install github.com/mitchellh/gox@v1.0.1 + +$(GOBIN)/rice: + go install github.com/GeertJohan/go.rice/rice@v1.0.3 + +rice-box.go: $(GOBIN)/rice editor/pull_release + $(GOBIN)/rice embed-go .PHONY: clean clean: - rm -rf editor/public && rm -f bindata.go && rm -f bindata_assetfs.go && rm -rf bin + rm -rf editor/public && rm -f rice-box.go && rm -rf bin diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..2ef268ab --- /dev/null +++ b/go.mod @@ -0,0 +1,27 @@ +module maputnik/desktop + +go 1.19 + +require ( + github.com/GeertJohan/go.rice v1.0.3 + github.com/fsnotify/fsnotify v1.6.0 + github.com/gorilla/handlers v1.5.1 + github.com/gorilla/mux v1.8.0 + github.com/gorilla/websocket v1.5.0 + github.com/maputnik/desktop v1.0.7 + github.com/urfave/cli v1.22.12 +) + +require ( + github.com/GeertJohan/go.incremental v1.0.0 // indirect + github.com/akavel/rsrc v0.8.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/daaku/go.zipexe v1.0.2 // indirect + github.com/felixge/httpsnoop v1.0.1 // indirect + github.com/jessevdk/go-flags v1.4.0 // indirect + github.com/nkovacs/streamquote v1.0.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.0.1 // indirect + golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..da1a3d5d --- /dev/null +++ b/go.sum @@ -0,0 +1,54 @@ +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/GeertJohan/go.incremental v1.0.0 h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg= +github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= +github.com/GeertJohan/go.rice v1.0.3 h1:k5viR+xGtIhF61125vCE1cmJ5957RQGXG6dmbaWZSmI= +github.com/GeertJohan/go.rice v1.0.3/go.mod h1:XVdrU4pW00M4ikZed5q56tPf1v2KwnIKeIdc9CBYNt4= +github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw= +github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/daaku/go.zipexe v1.0.2 h1:Zg55YLYTr7M9wjKn8SY/WcpuuEi+kR2u4E8RhvpyXmk= +github.com/daaku/go.zipexe v1.0.2/go.mod h1:5xWogtqlYnfBXkSB1o9xysukNP9GTvaNkqzUZbt3Bw8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/maputnik/desktop v1.0.7 h1:rdFg7emIJOT3YsZpwqSChmWtMOvu+T4h6WwVQAZP9n4= +github.com/maputnik/desktop v1.0.7/go.mod h1:wmDjHUztx9jOBz0I22589yWguAGdV/sEM57YANpN8oQ= +github.com/nkovacs/streamquote v1.0.0 h1:PmVIV08Zlx2lZK5fFZlMZ04eHcDTIFJCv/5/0twVUow= +github.com/nkovacs/streamquote v1.0.0/go.mod h1:BN+NaZ2CmdKqUuTUXUEm9j95B2TRbpOWpxbJYzzgUsc= +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/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/urfave/cli v1.22.12 h1:igJgVw1JdKH+trcLWLeLwZjU9fEfPesQ+9/e4MQ44S8= +github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/maputnik.go b/maputnik.go index 0eecee85..1442cb44 100644 --- a/maputnik.go +++ b/maputnik.go @@ -6,6 +6,7 @@ import ( "os" "path/filepath" + "github.com/GeertJohan/go.rice" "github.com/gorilla/handlers" "github.com/gorilla/mux" "github.com/maputnik/desktop/filewatch" @@ -16,7 +17,7 @@ func main() { app := cli.NewApp() app.Name = "maputnik" app.Usage = "Server for integrating Maputnik locally" - app.Version = "Editor: 1.7.0; Desktop: 1.0.7" + app.Version = "Editor: 1.7.0; Desktop: 1.1.0" app.Flags = []cli.Flag{ &cli.StringFlag{ @@ -39,7 +40,7 @@ func main() { } app.Action = func(c *cli.Context) error { - gui := http.FileServer(assetFS()) + gui := http.FileServer(rice.MustFindBox("editor/public").HTTPBox()) router := mux.NewRouter().StrictSlash(true) From 7ac1b03b5a8f240a10578cbb9df06d87d460bb41 Mon Sep 17 00:00:00 2001 From: Kevin Schaul Date: Mon, 12 Feb 2024 11:06:45 -0600 Subject: [PATCH 78/79] Move into /desktop dir For eventual merge into maplibre/maputnik repo --- .github/workflows/ci.yml | 3 +++ .gitignore => desktop/.gitignore | 0 LICENSE => desktop/LICENSE | 0 Makefile => desktop/Makefile | 0 README.md => desktop/README.md | 0 api.go => desktop/api.go | 0 {filewatch => desktop/filewatch}/filewatch.go | 0 go.mod => desktop/go.mod | 0 go.sum => desktop/go.sum | 0 maputnik.go => desktop/maputnik.go | 0 10 files changed, 3 insertions(+) rename .gitignore => desktop/.gitignore (100%) rename LICENSE => desktop/LICENSE (100%) rename Makefile => desktop/Makefile (100%) rename README.md => desktop/README.md (100%) rename api.go => desktop/api.go (100%) rename {filewatch => desktop/filewatch}/filewatch.go (100%) rename go.mod => desktop/go.mod (100%) rename go.sum => desktop/go.sum (100%) rename maputnik.go => desktop/maputnik.go (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abb90994..29e4839e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ jobs: build: runs-on: ubuntu-latest + defaults: + run: + working-directory: ./desktop steps: - uses: actions/checkout@v3 diff --git a/.gitignore b/desktop/.gitignore similarity index 100% rename from .gitignore rename to desktop/.gitignore diff --git a/LICENSE b/desktop/LICENSE similarity index 100% rename from LICENSE rename to desktop/LICENSE diff --git a/Makefile b/desktop/Makefile similarity index 100% rename from Makefile rename to desktop/Makefile diff --git a/README.md b/desktop/README.md similarity index 100% rename from README.md rename to desktop/README.md diff --git a/api.go b/desktop/api.go similarity index 100% rename from api.go rename to desktop/api.go diff --git a/filewatch/filewatch.go b/desktop/filewatch/filewatch.go similarity index 100% rename from filewatch/filewatch.go rename to desktop/filewatch/filewatch.go diff --git a/go.mod b/desktop/go.mod similarity index 100% rename from go.mod rename to desktop/go.mod diff --git a/go.sum b/desktop/go.sum similarity index 100% rename from go.sum rename to desktop/go.sum diff --git a/maputnik.go b/desktop/maputnik.go similarity index 100% rename from maputnik.go rename to desktop/maputnik.go From a304d4e0600b7ec076a8c02f2e8fe6ee63b9d411 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 12 Feb 2024 13:48:37 -0500 Subject: [PATCH 79/79] Renamed ci to ci-desktop --- .github/workflows/{ci.yml => ci-desktop.yml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{ci.yml => ci-desktop.yml} (91%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-desktop.yml similarity index 91% rename from .github/workflows/ci.yml rename to .github/workflows/ci-desktop.yml index 29e4839e..332d83f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-desktop.yml @@ -1,6 +1,6 @@ -name: ci +name: ci-desktop -on: [push] +on: [ push ] jobs: build: @@ -28,7 +28,7 @@ jobs: run: ./bin/linux/maputnik --version - name: Get style - run: wget https://maputnik.github.io/osm-liberty/style.json + run: wget https://maputnik.github.io/osm-liberty/style.json - name: Test --watch run: ./bin/linux/maputnik --watch --file style.json & sleep 5; kill $!