Skip to content

Commit

Permalink
[Auto Updating] Merge auto update work (#10)
Browse files Browse the repository at this point in the history
* Quest Editor work

* [Refactor] Move console package to internal

* Updater work

* Update updater.go

* Push up release makefile

* Windows automatic update work

* Update package.json

* Remove testing

* Update prompt

* os.Exit(0)

* Update updater.go

* Re-release 1.3.1 with fixes
  • Loading branch information
Akkadius authored Jan 5, 2022
1 parent 7f5b51d commit 1b9f6ef
Show file tree
Hide file tree
Showing 30 changed files with 589 additions and 505 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ steps:
- sudo chown -R go /drone/src
- ./scripts/build-release.sh
when:
branch: ["master"]
event: [push]
branch: [ "master" ]
event: [ push ]
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ spire.exe~

frontend/public/eq-asset-preview-master/
internal/http/spa/a_spa-packr.go

spire-linux-amd64
spire-windows-amd64.exe
spire-linux-amd64.zip
spire-windows-amd64.exe.zip
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.3.1]

### Spire Self Updating

* This release implements self updating and notifies users when a new version of Spire is available for download

## [1.3.0]

### Spire Launch!
Expand Down
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,26 @@ mysql-init: ##@mysql Initialize database

init-strip-mysql-remote-root: ##@mysql Strips MySQL remote root user
$(DRUNPREFIX) $(COMPOSE_COMMAND) exec mysql bash -c "mysql -uroot -p${MYSQL_ROOT_PASSWORD} -h localhost -e \"delete from mysql.user where User = 'root' and Host = '%'; FLUSH PRIVILEGES\""

#----------------------
# build
#----------------------

build-assets: ##@build Builds static assets before packing into binary
curl --compressed -o /tmp/assets.zip -L https://github.com/Akkadius/eq-asset-preview/archive/refs/heads/master.zip
unzip -qq -o /tmp/assets.zip -d /tmp/assets
cp -R /tmp/assets/eq-asset-preview-master/ ./frontend/public/

build-frontend: ##@build Builds frontend to be packed into binary
cd frontend && npm install && npm run build

build-binary: ##@build Build and packs release binary
packr clean
packr
GOOS=linux GOARCH=amd64 go build -o spire-linux-amd64
GOOS=windows GOARCH=amd64 go build -o spire-windows-amd64.exe
zip spire-linux-amd64.zip spire-linux-amd64
zip spire-windows-amd64.exe.zip spire-windows-amd64.exe

release-binary: ##@build Releases binary
gh-release --assets=spire-linux-amd64.zip,spire-windows-amd64.exe.zip -y
2 changes: 1 addition & 1 deletion boot/inject_commands.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package boot

import (
"github.com/Akkadius/spire/console/cmd"
"github.com/Akkadius/spire/internal/console/cmd"
_ "github.com/go-sql-driver/mysql"
"github.com/google/wire"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion boot/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 117 additions & 6 deletions frontend/src/views/quest-editor/QuestEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,29 @@ export default {
})
let languageQuestPrepend = "."
let methodPrefix = m.methodPrefix
if (language === "lua") {
if (m.methodPrefix !== "eq") {
methodPrefix = "";
languageQuestPrepend = ":"
}
}
if (language === "perl") {
languageQuestPrepend = "::"
if (m.methodPrefix !== "quest") {
methodPrefix = "";
// m.methodPrefix = `\$ ` + m.methodPrefix.toLowerCase()
languageQuestPrepend = ""
}
}
// this is label friendly, doesn't include completion indexes
let methodLabel = util.format(
"%s%s%s(%s)",
m.methodPrefix,
methodPrefix,
languageQuestPrepend,
m.method,
m.params.join(", ")
Expand All @@ -106,18 +121,25 @@ export default {
// method snippet contains completion indexes for user to fill out param values
let methodSnippet = util.format(
"%s%s%s(%s)",
m.methodPrefix,
methodPrefix,
languageQuestPrepend,
m.method,
completionParams.join(", ")
)
// console.log(methodLabel)
if (methodSnippet.includes("$")) {
// console.log(methodSnippet)
}
let completionSnippet = {
label: methodLabel,
// filterText: methodLabel,
kind: monaco.languages.CompletionItemKind.Function,
// filterText: methodLabel,
eqemuClass: m.methodPrefix.toLowerCase(),
insertText: methodSnippet,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
}
Expand All @@ -129,7 +151,7 @@ export default {
gSuggestions[language] = suggestions
monaco.languages.registerCompletionItemProvider(language, {
// triggerCharacters: ['.', ':', ' '],
triggerCharacters: ['>'],
provideCompletionItems: (model, position, context) => {
// find out if we are completing a property in the 'dependencies' object.
// var textUntilPosition = model.getValueInRange({
Expand All @@ -156,6 +178,28 @@ export default {
};
},
});
const config = {
surroundingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '<', close: '>' },
// { open: "'", close: "'" },
// { open: '"', close: '"' },
],
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
// { open: "'", close: "'", notIn: ['string', 'comment'] },
// { open: '"', close: '"', notIn: ['string', 'comment'] },
],
};
monaco.languages.setLanguageConfiguration('lua', config);
monaco.languages.setLanguageConfiguration('perl', config);
})
Expand Down Expand Up @@ -251,8 +295,72 @@ export default {
// console.log("language is " + this.language)
// console.log(gSuggestions[this.language])
let editor = this.editor;
const currentLine = editor.getModel().getLineContent(editor.getPosition().lineNumber)
const line = editor.getPosition().lineNumber;
const col = editor.getPosition().column + 1;
const textUntilPosition = editor.getModel().getValueInRange({
startLineNumber: editor.getPosition().lineNumber,
startColumn: 0,
endLineNumber: line,
endColumn: col
});
const currentPos = textUntilPosition.length;
let searchFilter = ""
const wordSplit = textUntilPosition.split(" ")
if (wordSplit.length > 0) {
let lastWord = wordSplit[wordSplit.length - 1]
const lastWordContainsClosingParenthesis =
lastWord.includes("(") && lastWord.includes(")")
if (lastWord.includes("$") && !lastWordContainsClosingParenthesis) {
let wordSplit = lastWord.split("$")
if (wordSplit.length > 0) {
let secondSplit = wordSplit[1].trim().split("->")
if (secondSplit.length > 0) {
searchFilter = secondSplit[0].trim()
console.log("search filter is [%s]", searchFilter)
}
}
}
console.log("last word is [%s]", lastWord)
}
console.log("[currentLine] [%s]", currentLine)
console.log("[textUntilPosition] [%s]", textUntilPosition)
// sometimes a class inherits others... like mobs
let searchClasses = [searchFilter]
if (["client", "npc"].includes(searchFilter)) {
searchClasses = [searchFilter, "mob"]
} else if (searchFilter.toLowerCase().includes("entity_list")) {
searchClasses = ["entitylist"]
} else if (searchFilter.toLowerCase().includes("door")) {
searchClasses = ["doors"]
}
let suggestions = gSuggestions[this.language]
for (let key in suggestions) {
if (searchFilter !== "") {
// eqemuClass
// we're searching on class objects, if there doesn't exist any then lets skip
if (!suggestions[key].eqemuClass) {
continue;
}
// make sure our last word contains our class prefix
if (!searchClasses.includes(suggestions[key].eqemuClass)) {
continue;
}
}
suggestions[key].range = range
}
Expand All @@ -264,6 +372,8 @@ export default {
// console.log("editor mounted")
// console.log(editor)
this.editor = editor
// editor.trigger('source - use any string you like', 'editor.action.triggerSuggest', {});
editor.onDidType(e => {
Expand Down Expand Up @@ -366,9 +476,10 @@ export default {
code: `Select a file...`,
options: {
theme: 'vs-dark',
autoClosingBrackets: false,
// autoClosingBrackets: false,
autoIndent: true,
}
},
editor: null,
}
}
}
Expand Down
31 changes: 7 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,32 @@ module github.com/Akkadius/spire
go 1.16

require (
github.com/Jeffail/gabs v1.4.0
github.com/adotout/pack_2d v0.0.0-20140426184322-aed359845096
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/asticode/go-astikit v0.21.1 // indirect
github.com/asticode/go-astilectron v0.24.0 // indirect
github.com/aws/aws-sdk-go v1.19.0
github.com/cosmtrek/air v1.27.3 // indirect
github.com/danilopolani/gocialite v1.0.2
github.com/davecgh/go-spew v1.1.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/die-net/lrucache v0.0.0-20190707192454-883874fe3947
github.com/gertd/go-pluralize v0.1.7
github.com/go-errors/errors v1.1.1
github.com/go-git/go-billy/v5 v5.0.0
github.com/go-git/go-git/v5 v5.2.0
github.com/go-openapi/jsonreference v0.19.3 // indirect
github.com/go-openapi/spec v0.19.4 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/gobuffalo/envy v1.9.0 // indirect
github.com/gobuffalo/logger v1.0.4 // indirect
github.com/gobuffalo/packd v1.0.0 // indirect
github.com/gobuffalo/packr v1.30.1
github.com/gobuffalo/packr/v2 v2.8.1 // indirect
github.com/gomarkdown/markdown v0.0.0-20201030010234-8ba61b39d0e4
github.com/google/go-github/v41 v41.0.0
github.com/google/wire v0.4.0
github.com/gorilla/mux v1.8.0
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
github.com/iancoleman/strcase v0.1.0
github.com/influxdata/influxdb-client-go/v2 v2.2.2
github.com/jinzhu/gorm v1.9.16
github.com/joho/godotenv v1.3.0
github.com/k0kubun/pp v3.0.1+incompatible // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/labstack/echo/v4 v4.1.16
github.com/mailru/easyjson v0.7.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/muesli/termenv v0.7.4
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/oleiade/reflections v1.0.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
Expand All @@ -50,15 +38,10 @@ require (
github.com/swaggo/swag v1.6.3
github.com/valyala/fasttemplate v1.2.0 // indirect
github.com/volatiletech/null/v8 v8.1.0
github.com/volatiletech/sqlboiler/v4 v4.2.0
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/oleiade/reflections.v1 v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gorm.io/driver/mysql v1.1.2
gorm.io/gorm v1.21.15
willnorris.com/go/imageproxy v0.10.0
)
Loading

0 comments on commit 1b9f6ef

Please sign in to comment.