Add Makefile, create skins directory, and update libraries
This commit is contained in:
parent
8532f8664a
commit
d1ab763241
19
Makefile
19
Makefile
@ -4,7 +4,6 @@ PROJECTNAME="OpenSkins-Standalone-Plugin"
|
|||||||
|
|
||||||
# Go related variables.
|
# Go related variables.
|
||||||
GOBASE=$(shell pwd)
|
GOBASE=$(shell pwd)
|
||||||
GOPATH=$(GOBASE)/vendor:$(GOBASE)
|
|
||||||
GOBIN=$(GOBASE)/bin
|
GOBIN=$(GOBASE)/bin
|
||||||
GOFILES=$(wildcard *.go)
|
GOFILES=$(wildcard *.go)
|
||||||
|
|
||||||
@ -21,34 +20,38 @@ go-compile: go-clean go-get go-build
|
|||||||
|
|
||||||
go-build:
|
go-build:
|
||||||
@echo " > Building binary..."
|
@echo " > Building binary..."
|
||||||
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -buildmode=plugin -o $(GOBIN)/$(PROJECTNAME) $(GOFILES)
|
@go build -buildmode=plugin -o $(GOBIN)/$(PROJECTNAME) $(GOFILES)
|
||||||
|
|
||||||
go-generate:
|
go-generate:
|
||||||
@echo " > Generating dependency files..."
|
@echo " > Generating dependency files..."
|
||||||
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go generate $(generate)
|
@go generate $(generate)
|
||||||
|
|
||||||
go-get:
|
go-get:
|
||||||
@echo " > Checking if there is any missing dependencies..."
|
@echo " > Checking if there is any missing dependencies..."
|
||||||
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get $(get)
|
@go get $(get)
|
||||||
|
|
||||||
go-install:
|
go-install:
|
||||||
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go install $(GOFILES)
|
@go install $(GOFILES)
|
||||||
|
|
||||||
go-clean:
|
go-clean:
|
||||||
@echo " > Cleaning build cache"
|
@echo " > Cleaning build cache"
|
||||||
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go clean
|
@go clean
|
||||||
|
|
||||||
go-test:
|
go-test:
|
||||||
@echo " > Running tests..."
|
@echo " > Running tests..."
|
||||||
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go test
|
@go test
|
||||||
|
|
||||||
go-run:
|
go-run:
|
||||||
@echo " > Running ${PROJECTNAME}"
|
@echo " > Running ${PROJECTNAME}"
|
||||||
@-(cd $(GOBIN); ./$(PROJECTNAME))
|
@-(cd $(GOBIN); ./$(PROJECTNAME))
|
||||||
|
|
||||||
|
openskins-common:
|
||||||
|
@echo " > Updating common library..."
|
||||||
|
@go get -u github.com/josephbmanley/OpenSkins-Common
|
||||||
|
|
||||||
|
|
||||||
## install: downloads and installs dependencies
|
## install: downloads and installs dependencies
|
||||||
install: go-get
|
install: openskins-common go-get
|
||||||
|
|
||||||
## clean: test
|
## clean: test
|
||||||
clean:
|
clean:
|
||||||
|
@ -45,6 +45,14 @@ func (s *SkinstoreStandalone) Initialize() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(config.SkinDirectory); err != nil {
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
os.Mkdir(config.SkinDirectory, 0755)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +94,7 @@ func (s *SkinstoreStandalone) AddSkin(skinID string, fileData []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crate file if it didn't exist
|
// Create file if it didn't exist
|
||||||
if _, err := os.Create(skinPath); err != nil {
|
if _, err := os.Create(skinPath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -109,17 +117,17 @@ func (s *SkinstoreStandalone) AddSkin(skinID string, fileData []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSkin deletes a skin object
|
// DeleteSkin deletes a skin object
|
||||||
func (s *SkinstoreStandalone) DeleteSkin(skinID string) error {
|
// func (s *SkinstoreStandalone) DeleteSkin(skinID string) error {
|
||||||
skinPath := fmt.Sprintf("%v/%v", config.SkinDirectory, skinID)
|
// skinPath := fmt.Sprintf("%v/%v", config.SkinDirectory, skinID)
|
||||||
|
|
||||||
// Check if skin exists
|
// // Check if skin exists
|
||||||
if _, err := os.Stat(skinPath); err != nil {
|
// if _, err := os.Stat(skinPath); err != nil {
|
||||||
// Check if error was not 404 error
|
// // Check if error was not 404 error
|
||||||
if !os.IsNotExist(err) {
|
// if !os.IsNotExist(err) {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
|
|
||||||
return os.Remove(skinPath)
|
// return os.Remove(skinPath)
|
||||||
}
|
// }
|
||||||
|
8
go.mod
8
go.mod
@ -3,8 +3,10 @@ module github.com/josephbmanley/OpenSkins-Standalone-Plugin
|
|||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cristalhq/aconfig v0.10.0
|
github.com/cristalhq/aconfig v0.10.1
|
||||||
github.com/cristalhq/aconfig/aconfigyaml v0.10.0
|
github.com/cristalhq/aconfig/aconfigyaml v0.11.0
|
||||||
github.com/ilyakaznacheev/cleanenv v1.2.5
|
github.com/ilyakaznacheev/cleanenv v1.2.5
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227061123-22199a5c0ab9
|
github.com/josephbmanley/OpenSkins-Common v0.0.1
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
|
||||||
)
|
)
|
||||||
|
22
go.sum
22
go.sum
@ -3,25 +3,27 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
|||||||
github.com/cristalhq/aconfig v0.10.0-beta/go.mod h1:0ZBp7dUf0F2Jr7YbLjw8OVlAD0eeV2bU3NwmVgeUReo=
|
github.com/cristalhq/aconfig v0.10.0-beta/go.mod h1:0ZBp7dUf0F2Jr7YbLjw8OVlAD0eeV2bU3NwmVgeUReo=
|
||||||
github.com/cristalhq/aconfig v0.10.0 h1:5dyXjRkUBDuueSHFYxlLdxpZrnzGHwlffhL16NiT+XQ=
|
github.com/cristalhq/aconfig v0.10.0 h1:5dyXjRkUBDuueSHFYxlLdxpZrnzGHwlffhL16NiT+XQ=
|
||||||
github.com/cristalhq/aconfig v0.10.0/go.mod h1:0ZBp7dUf0F2Jr7YbLjw8OVlAD0eeV2bU3NwmVgeUReo=
|
github.com/cristalhq/aconfig v0.10.0/go.mod h1:0ZBp7dUf0F2Jr7YbLjw8OVlAD0eeV2bU3NwmVgeUReo=
|
||||||
|
github.com/cristalhq/aconfig v0.10.1 h1:5UO85SWSfsWFj6h6cF8etPNEi6HVHXRhe21TpVZX45Y=
|
||||||
|
github.com/cristalhq/aconfig v0.10.1/go.mod h1:0ZBp7dUf0F2Jr7YbLjw8OVlAD0eeV2bU3NwmVgeUReo=
|
||||||
github.com/cristalhq/aconfig/aconfigyaml v0.10.0 h1:6NuPBSbZ338FaF62pqDzFY/sBEfvBytgyJVS0feUAh0=
|
github.com/cristalhq/aconfig/aconfigyaml v0.10.0 h1:6NuPBSbZ338FaF62pqDzFY/sBEfvBytgyJVS0feUAh0=
|
||||||
github.com/cristalhq/aconfig/aconfigyaml v0.10.0/go.mod h1:xzEaBQp+1noCICuXzwVAGj+IScIDi4GkLLeRrUhmi1o=
|
github.com/cristalhq/aconfig/aconfigyaml v0.10.0/go.mod h1:xzEaBQp+1noCICuXzwVAGj+IScIDi4GkLLeRrUhmi1o=
|
||||||
|
github.com/cristalhq/aconfig/aconfigyaml v0.11.0 h1:AjVw0c4Kay0vPpIO4p9bwe6FZ4TQfpA9bsqL6E+Rv/4=
|
||||||
|
github.com/cristalhq/aconfig/aconfigyaml v0.11.0/go.mod h1:6Njh1iqdBkm0v76shQjRmHgqLsdyRozMrQ6NdmYNWUc=
|
||||||
github.com/ilyakaznacheev/cleanenv v1.2.5 h1:/SlcF9GaIvefWqFJzsccGG/NJdoaAwb7Mm7ImzhO3DM=
|
github.com/ilyakaznacheev/cleanenv v1.2.5 h1:/SlcF9GaIvefWqFJzsccGG/NJdoaAwb7Mm7ImzhO3DM=
|
||||||
github.com/ilyakaznacheev/cleanenv v1.2.5/go.mod h1:/i3yhzwZ3s7hacNERGFwvlhwXMDcaqwIzmayEhbRplk=
|
github.com/ilyakaznacheev/cleanenv v1.2.5/go.mod h1:/i3yhzwZ3s7hacNERGFwvlhwXMDcaqwIzmayEhbRplk=
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201226022245-12099a28475a h1:bW/ahOovqRP2r1Ynp4WXxrOCiHq1vqye8RFyYLIZ6hg=
|
github.com/josephbmanley/OpenSkins-Common v0.0.0-20210129235549-eea81c7820d0 h1:nrARrp3he8wkT1P+ryMjJbMxhlwjmVWLhDWvxU5iHoo=
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201226022245-12099a28475a/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
github.com/josephbmanley/OpenSkins-Common v0.0.0-20210129235549-eea81c7820d0/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227051624-01b75eb56779 h1:ArCBRyblBk/x0BGgNu6gJ7j7kNvn91K7OmpOHpHUwAs=
|
github.com/josephbmanley/OpenSkins-Common v0.0.1 h1:rOvP3YMgx1XNJ9JQU76AMWkypiWKHQw4Wxr76dhsMME=
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227051624-01b75eb56779/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
github.com/josephbmanley/OpenSkins-Common v0.0.1/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227052902-2d6c9664ec1e h1:5nRhRlgg/IX2yp4R/NDG1ku65ldkl5/LKxZxg4UcWw4=
|
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227052902-2d6c9664ec1e/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227060121-852c176c7219 h1:PHEi0kL7sC2ERY34grA1bsObqXRcZzMZVDisCB4xm3Q=
|
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227060121-852c176c7219/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227061123-22199a5c0ab9 h1:rEfQZyiAKIKchefT4uUGojwLVPDEylORTOU1/l+VEQU=
|
|
||||||
github.com/josephbmanley/OpenSkins-Common v0.0.0-20201227061123-22199a5c0ab9/go.mod h1:xmRLNQLOMLqiQ2hzP81mdsNbu6ZxyLozoVWaR2A0BMY=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
olympos.io/encoding/edn v0.0.0-20200308123125-93e3b8dd0e24 h1:sreVOrDp0/ezb0CHKVek/l7YwpxPJqv+jT3izfSphA4=
|
olympos.io/encoding/edn v0.0.0-20200308123125-93e3b8dd0e24 h1:sreVOrDp0/ezb0CHKVek/l7YwpxPJqv+jT3izfSphA4=
|
||||||
olympos.io/encoding/edn v0.0.0-20200308123125-93e3b8dd0e24/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw=
|
olympos.io/encoding/edn v0.0.0-20200308123125-93e3b8dd0e24/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw=
|
||||||
|
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ=
|
||||||
|
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw=
|
||||||
|
2
main.go
2
main.go
@ -5,6 +5,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
//SkinstoreModule.Initialize()
|
||||||
|
//SkinstoreModule.AddSkin("TEST", []byte{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkinstoreModule is a thing
|
// SkinstoreModule is a thing
|
||||||
|
0
skins/TEST
Normal file
0
skins/TEST
Normal file
Reference in New Issue
Block a user