better project layout
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sebastian Frank 2019-03-19 11:15:32 +01:00
parent dfc932b7b0
commit 70d7497eda
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3
128 changed files with 48 additions and 42 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
test.html
html/
html/
build/dist

View File

@ -1,5 +0,0 @@
#!/bin/sh
mkdir -p dist
go build -v -ldflags "-X main.Version=`git describe --tags --long` -X main.GitHash=`git rev-parse HEAD` -X main.BuildTime=`date -u '+%Y-%m-%d_%I:%M:%S%p'`" -o dist/mark2web-`cat VERSION`-${GOOS}-${GOARCH}${FILEEXT} mark2web/main.go

View File

@ -15,15 +15,15 @@ steps:
commands:
- git submodule update --init --recursive
- git fetch --tags
- ./build.sh
- scripts/build.sh
when:
event: [ push, tag ]
- name: test with example content
image: alpine
commands:
- ./dist/mark2web-`cat VERSION`-linux-amd64 -version
- ./dist/mark2web-`cat VERSION`-linux-amd64 -in _example -out example_out -create -logLevel debug
- dist/mark2web-`cat build/VERSION`-linux-amd64 -version
- dist/mark2web-`cat build/VERSION`-linux-amd64 -in example -out example_out -create -logLevel debug
when:
event: [ push, tag ]
@ -34,7 +34,7 @@ steps:
GOOS: freebsd
GOARCH: amd64
commands:
- ./build.sh
- scripts/build.sh
when:
event: [ tag ]
@ -45,7 +45,7 @@ steps:
GOOS: darwin
GOARCH: amd64
commands:
- ./build.sh
- scripts/build.sh
when:
event: [ tag ]
@ -57,7 +57,7 @@ steps:
GOARCH: amd64
FILEEXT: .exe
commands:
- ./build.sh
- scripts/build.sh
when:
event: [ tag ]
@ -65,7 +65,7 @@ steps:
image: docker
commands:
- cp dist/mark2web-`cat VERSION`-linux-amd64 mark2web
- docker build -t apairon/mark2web .
- docker build -t apairon/mark2web build/package
volumes:
- name: docker
path: /var/run/docker.sock
@ -81,7 +81,7 @@ steps:
from_secret: rsync_pass
commands:
- /mark2web -version
- /mark2web -in _website -out html -create -logLevel info
- /mark2web -in website -out html -create -logLevel info
- '
rsync -rlcgD -i -u -v --stats
--delete
@ -110,8 +110,8 @@ steps:
base_url: https://gitbase.de
files:
- dist/*
title: VERSION
note: RELEASE.md
title: build/VERSION
note: build/RELEASE.md
checksum:
- md5
- sha256
@ -121,4 +121,4 @@ steps:
volumes:
- name: docker
host:
path: /var/run/docker.sock
path: /var/run/docker.sock

View File

@ -1,4 +1,4 @@
FROM alpine
RUN apk update && apk add ca-certificates openssh-client sshpass rsync gzip && rm -r /var/cache/
ADD mark2web /
ADD ../../mark2web /
CMD ["/mark2web"]

View File

@ -6,9 +6,9 @@ import (
"os"
"path"
"gitbase.de/apairon/mark2web"
"gitbase.de/apairon/mark2web/filter"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/filter"
"gitbase.de/apairon/mark2web/pkg/helper"
"gitbase.de/apairon/mark2web/pkg/mark2web"
)
var (

View File

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -5,8 +5,8 @@ import (
"path"
"strings"
"gitbase.de/apairon/mark2web"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
"gitbase.de/apairon/mark2web/pkg/mark2web"
"github.com/ddliu/motto"
"github.com/flosch/pongo2"
_ "github.com/robertkrimen/otto/underscore"

View File

@ -12,8 +12,8 @@ import (
"strconv"
"strings"
"gitbase.de/apairon/mark2web"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
"gitbase.de/apairon/mark2web/pkg/mark2web"
"github.com/disintegration/imaging"
"github.com/flosch/pongo2"
)

View File

@ -1,8 +1,8 @@
package filter
import (
"gitbase.de/apairon/mark2web"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
"gitbase.de/apairon/mark2web/pkg/mark2web"
"github.com/flosch/pongo2"
)

View File

@ -1,7 +1,7 @@
package filter
import (
"gitbase.de/apairon/mark2web"
"gitbase.de/apairon/mark2web/pkg/mark2web"
"github.com/flosch/pongo2"
)

View File

@ -1,4 +1,4 @@
package mark2web
package helper
import "fmt"

View File

@ -6,7 +6,7 @@ import (
"regexp"
"strings"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
cpy "github.com/otiai10/copy"
)

View File

@ -1,5 +1,7 @@
package mark2web
import "gitbase.de/apairon/mark2web/pkg/helper"
// CollectionConfig describes a collection
type CollectionConfig struct {
Name *string `yaml:"Name"`
@ -21,7 +23,7 @@ type ThisPathConfig struct {
Navname *string `yaml:"Navname"`
GoTo *string `yaml:"GoTo"`
Collections []*CollectionConfig `yaml:"Collections"`
Data MapString `yaml:"Data"`
Data helper.MapString `yaml:"Data"`
}
// IndexConfig describes index input and output file
@ -81,5 +83,5 @@ type PathConfig struct {
Markdown *MarkdownConfig `yaml:"Markdown"`
Imaging *ImagingConfig `yaml:"Imaging"`
Data MapString `yaml:"Data"`
Data helper.MapString `yaml:"Data"`
}

View File

@ -7,7 +7,7 @@ import (
"regexp"
"strings"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
"github.com/davecgh/go-spew/spew"
"github.com/flosch/pongo2"
cpy "github.com/otiai10/copy"

View File

@ -8,7 +8,7 @@ import (
"strings"
"time"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
"github.com/davecgh/go-spew/spew"
"github.com/extemporalgenome/slug"
"github.com/flosch/pongo2"
@ -44,7 +44,7 @@ func (node *TreeNode) handleCollections() {
}
if node.ColMap == nil {
node.ColMap = make(MapString)
node.ColMap = make(helper.MapString)
}
ctx := NewContext()
ctx["This"] = node.Config.This
@ -239,7 +239,7 @@ func Add2Nav(currentNode *TreeNode, pathConfig *PathConfig, tplFilename, outDir
}
if dataMapKey != "" {
if newNode.Config.Data == nil {
newNode.Config.Data = make(MapString)
newNode.Config.Data = make(helper.MapString)
}
// as submap in Data
newNode.Config.Data[dataMapKey] = ctx

View File

@ -1,7 +1,7 @@
package mark2web
import (
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
"github.com/flosch/pongo2"
)

View File

@ -5,7 +5,7 @@ import (
"regexp"
"strings"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
)
// NavElement is one element with ist attributes and subs
@ -14,7 +14,7 @@ type NavElement struct {
GoTo string
Active bool
ColMap MapString
ColMap helper.MapString
Data interface{}

View File

@ -4,7 +4,7 @@ import (
"path"
"strings"
"gitbase.de/apairon/mark2web/helper"
"gitbase.de/apairon/mark2web/pkg/helper"
)
// ResolveNavPath fixes nav target relative to current navigation path

View File

@ -1,12 +1,14 @@
package mark2web
import "gitbase.de/apairon/mark2web/pkg/helper"
// TreeNode is complete config tree of content dir
type TreeNode struct {
InputPath string
OutputPath string
Hidden bool // for collections which are not part of the navigation
ColMap MapString
ColMap helper.MapString
InputFiles []string
OtherFiles []string

7
scripts/build.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
curdir=$(dirname $0)
distdir="$curdir/../dist"
mkdir -p "$distdir"
go build -v -ldflags "-X main.Version=`git describe --tags --long` -X main.GitHash=`git rev-parse HEAD` -X main.BuildTime=`date -u '+%Y-%m-%d_%I:%M:%S%p'`" -o "$distdir/mark2web-`cat $curdir/../build/VERSION`-${GOOS}-${GOARCH}${FILEEXT}" "$curdir/../cmd/mark2web/main.go"

View File

View File

Before

Width:  |  Height:  |  Size: 790 KiB

After

Width:  |  Height:  |  Size: 790 KiB

View File

Before

Width:  |  Height:  |  Size: 714 KiB

After

Width:  |  Height:  |  Size: 714 KiB

View File

Before

Width:  |  Height:  |  Size: 453 KiB

After

Width:  |  Height:  |  Size: 453 KiB

View File

Before

Width:  |  Height:  |  Size: 436 KiB

After

Width:  |  Height:  |  Size: 436 KiB

View File

Before

Width:  |  Height:  |  Size: 644 KiB

After

Width:  |  Height:  |  Size: 644 KiB

View File

Before

Width:  |  Height:  |  Size: 524 KiB

After

Width:  |  Height:  |  Size: 524 KiB

View File

Before

Width:  |  Height:  |  Size: 881 KiB

After

Width:  |  Height:  |  Size: 881 KiB

View File

Before

Width:  |  Height:  |  Size: 520 KiB

After

Width:  |  Height:  |  Size: 520 KiB

View File

Before

Width:  |  Height:  |  Size: 595 KiB

After

Width:  |  Height:  |  Size: 595 KiB

View File

Before

Width:  |  Height:  |  Size: 691 KiB

After

Width:  |  Height:  |  Size: 691 KiB

View File

Before

Width:  |  Height:  |  Size: 389 KiB

After

Width:  |  Height:  |  Size: 389 KiB

View File

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 171 KiB

View File

Before

Width:  |  Height:  |  Size: 715 KiB

After

Width:  |  Height:  |  Size: 715 KiB

Some files were not shown because too many files have changed in this diff Show More