-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from davidovich/implement-fs
Implement fs
Showing
38 changed files
with
386 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# this is a sample summon config file | ||
# see https://github.com/davidovich/summon#configuration | ||
version: 1 | ||
aliases: {"git-version": "bin/version.sh"} | ||
# outputdir: "overridden_dir" | ||
exec: | ||
bash: | ||
hello-bash: ['{{ summon "hello.sh" }}'] | ||
|
||
docker run -v {{ env "PWD" }}:/mounted-app alpine ls: | ||
list: [/mounted-app] | ||
|
||
go run: | ||
gohack: [github.com/rogpeppe/gohack@v1.0.2] | ||
|
||
docker {{ lower "INFO" }}: # naive example of templating | ||
docker-info: | ||
|
||
? docker run -ti --rm -w /{{ env "PWD" | base }} | ||
-v {{ env "PWD" }}:/{{ env "PWD" | base }} | ||
hairyhenderson/figlet | ||
: | ||
figlet: ['hello {{ env "USER" }}'] | ||
|
||
# echo: # future implementation idea | ||
# - handle: echo | ||
# args: ['echoing: {{ .Message }}'] | ||
# env: [] | ||
|
||
python3 -c: | ||
hello: | ||
- | | ||
import sys | ||
print('pyhon version:'); print(sys.version) | ||
if True: | ||
print() | ||
print(f"hello from python! args: {sys.argv}") | ||
python -c: | ||
hellopy2: [print('hello from python!')] | ||
|
||
bash -c: | ||
# small function to setup a temporary GOPATH compatible godoc server inside docker | ||
# see https://github.com/golang/go/issues/26827. This allows serving documentation | ||
# for a go modules enabled project. | ||
godoc: | ||
- | | ||
function _godoc() { | ||
[ ! -f "$(pwd)/go.mod" ] && echo "error: go.mod not found" || | ||
module=$(awk 'NR==1{print $2}' go.mod) && | ||
docker run --rm -ti -e "GOPATH=/tmp/go" -p 6060:6060 -v $(pwd):/tmp/go/src/$module golang:1.15 /bin/bash -c "GO111MODULE=on go get golang.org/x/tools/cmd/godoc && echo -e \"\nhttp://localhost:6060/pkg/$module\" && \$(go env GOPATH)/bin/godoc -http=:6060" | ||
unset -f _godoc; | ||
} | ||
_godoc | ||
# kmerge merges a the default kubeconfig with a kubeconfig file passed as argement | ||
# https://github.com/kubernetes/kubernetes/issues/46381#issuecomment-461404505 | ||
kmerge: | ||
- | | ||
function kmerge() { | ||
KUBECONFIG=~/.kube/config:$1 kubectl config view --flatten > ~/.kube/mergedkub && mv ~/.kube/mergedkub ~/.kube/config | ||
} | ||
kmerge | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
b content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
module github.com/davidovich/summon | ||
|
||
go 1.17 | ||
|
||
require ( | ||
github.com/DiSiqueira/GoTree v1.0.1-0.20190529205929-3e23dcd4532b | ||
github.com/Masterminds/sprig/v3 v3.1.0 | ||
github.com/gobuffalo/packr/v2 v2.5.1 | ||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 | ||
github.com/lithammer/dedent v1.1.0 | ||
github.com/spf13/afero v1.2.1 | ||
github.com/spf13/cobra v1.0.0 | ||
github.com/spf13/pflag v1.0.5 | ||
github.com/stretchr/testify v1.5.1 | ||
golang.org/x/sys v0.0.0-20200819091447-39769834ee22 // indirect | ||
gopkg.in/yaml.v2 v2.2.2 | ||
) | ||
|
||
go 1.15 | ||
require ( | ||
github.com/Masterminds/goutils v1.1.0 // indirect | ||
github.com/Masterminds/semver/v3 v3.1.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/google/uuid v1.1.1 // indirect | ||
github.com/huandu/xstrings v1.3.1 // indirect | ||
github.com/imdario/mergo v0.3.8 // indirect | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/mitchellh/copystructure v1.0.0 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/spf13/cast v1.3.1 // indirect | ||
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 // indirect | ||
golang.org/x/text v0.3.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
SUMMONER_NAME := {{ .SummonerName }} | ||
|
||
ASSETS := $(shell find $(SUMMONER_NAME)/assets) | ||
|
||
all: bin/$(SUMMONER_NAME) | ||
|
||
bin/$(SUMMONER_NAME): $(SUMMONER_NAME)/$(SUMMONER_NAME).go $(ASSETS) | ||
go build -o $@ $< | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf bin |
17 changes: 9 additions & 8 deletions
17
internal/templates/scaffold/README.md → ...nal/scaffold/templates/scaffold/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
internal/scaffold/templates/scaffold/{{.SummonerName}}/{{.SummonerName}}.{{.go}}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"embed" | ||
|
||
"github.com/davidovich/summon" | ||
) | ||
|
||
// capture the files of the assets tree, assuming the assets directory | ||
// is named "assets". | ||
//go:embed assets/* | ||
var fs embed.FS | ||
|
||
func main() { | ||
os.Exit(summon.Main(os.Args, fs)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module {{ .ModName }} | ||
|
||
require github.com/davidovich/summon latest |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
internal/templates/scaffold/{{.SummonerName}}/summon{{.go}}
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters