Skip to content

Commit

Permalink
rename the pack.js to <UUID>.json when injecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryex committed Jul 7, 2020
1 parent 6452d24 commit bc70c3b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
*.json
*.dungeondraft_*
*.log
vendor/
gui/
6 changes: 5 additions & 1 deletion cmd/dungeondraft-pack/dungeondraft-pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"runtime"
"strings"

"github.com/ryex/dungeondraft-gopackager/pkg/pack"
log "github.com/sirupsen/logrus"
"gitlab.com/ryexandrite/dungeondraft-gopackager/pkg/pack"
)

const usageText = `Desc:
Expand Down Expand Up @@ -66,6 +66,10 @@ func main() {

log.SetOutput(os.Stdout)

log.SetFormatter(&log.TextFormatter{
ForceColors: true,
})

// Only log the warning severity or above.
log.SetLevel(log.WarnLevel)
if debug {
Expand Down
5 changes: 4 additions & 1 deletion cmd/dungeondraft-unpack/dungeondraft-unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"path/filepath"
"strings"

"github.com/ryex/dungeondraft-gopackager/pkg/unpack"
log "github.com/sirupsen/logrus"
"gitlab.com/ryexandrite/dungeondraft-gopackager/pkg/unpack"
)

const usageText = `Desc:
Expand Down Expand Up @@ -54,6 +54,9 @@ func main() {
packName := strings.TrimSuffix(packFileName, filepath.Ext(packFileName))

log.SetOutput(os.Stdout)
log.SetFormatter(&log.TextFormatter{
ForceColors: true,
})

// Only log the warning severity or above.
log.SetLevel(log.WarnLevel)
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module gitlab.com/ryexandrite/dungeondraft-gopackager
module github.com/ryex/dungeondraft-gopackager

go 1.14

require github.com/sirupsen/logrus v1.6.0
require (
github.com/sirupsen/logrus v1.6.0
)
2 changes: 1 addition & 1 deletion internal/structures/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"io"
"io/ioutil"

"github.com/ryex/dungeondraft-gopackager/internal/utils"
"github.com/sirupsen/logrus"
"gitlab.com/ryexandrite/dungeondraft-gopackager/internal/utils"
)

// PackageHeadersBytes is a struct used for reading and writing the encoded package headers
Expand Down
7 changes: 4 additions & 3 deletions pkg/pack/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package pack
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/ryex/dungeondraft-gopackager/internal/structures"
"github.com/ryex/dungeondraft-gopackager/internal/utils"
"github.com/sirupsen/logrus"
"gitlab.com/ryexandrite/dungeondraft-gopackager/internal/structures"
"gitlab.com/ryexandrite/dungeondraft-gopackager/internal/utils"
)

// Packer packs up a folder into a dungeodraft_pack file
Expand Down Expand Up @@ -174,7 +175,7 @@ func (p *Packer) BuildFileList() (err error) {

packJSONPath := filepath.Join(p.path, `pack.json`)

packJSONRelPath, err := filepath.Rel(p.path, packJSONPath)
packJSONRelPath, err := filepath.Rel(p.path, filepath.Join(p.path, fmt.Sprintf(`%s.json`, p.id)))
if err != nil {
p.log.Error("can not get path relative to package root")
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/unpack/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"regexp"
"strings"

"github.com/ryex/dungeondraft-gopackager/internal/structures"
"github.com/ryex/dungeondraft-gopackager/internal/utils"
"github.com/sirupsen/logrus"
"gitlab.com/ryexandrite/dungeondraft-gopackager/internal/structures"
"gitlab.com/ryexandrite/dungeondraft-gopackager/internal/utils"
)

// Unpacker unpacks dungeondraft_pack files in the pck arcive format
Expand Down

0 comments on commit bc70c3b

Please sign in to comment.