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

View File

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

View File

@@ -6,9 +6,9 @@ import (
"os" "os"
"path" "path"
"gitbase.de/apairon/mark2web" "gitbase.de/apairon/mark2web/pkg/filter"
"gitbase.de/apairon/mark2web/filter" "gitbase.de/apairon/mark2web/pkg/helper"
"gitbase.de/apairon/mark2web/helper" "gitbase.de/apairon/mark2web/pkg/mark2web"
) )
var ( 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" "path"
"strings" "strings"
"gitbase.de/apairon/mark2web" "gitbase.de/apairon/mark2web/pkg/helper"
"gitbase.de/apairon/mark2web/helper" "gitbase.de/apairon/mark2web/pkg/mark2web"
"github.com/ddliu/motto" "github.com/ddliu/motto"
"github.com/flosch/pongo2" "github.com/flosch/pongo2"
_ "github.com/robertkrimen/otto/underscore" _ "github.com/robertkrimen/otto/underscore"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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