Skip to content

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
runeimp committed Nov 28, 2019
2 parents 89356d5 + 0af32a8 commit a5c110b
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 28 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Templar ChangeLog
=================

V2.0.1
v2.0.2
------

* Updated dot files and docs


v2.0.1
------

* Updated dot files
Expand Down
35 changes: 29 additions & 6 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@
# I highly recommend using just for basic automation.
#

alias ver := version

# Like in make the first recipe is used by default.
# I like listing all the recipes by default.
# I also like wiping the terminal buffer like CLS in DOS. It makes me happy. :-)
@_default:
just _term-wipe
just --list

# Cleanup around here!
clean:
just _term-wipe

# The real cleaner
@_clean:
rm -f *.out
rm -f output.txt
rm -rf dist

# Cleanup around here!
clean:
just _term-wipe
just _clean
@just _dir-list


Expand All @@ -39,15 +46,28 @@ _dir-list:
just dist-{{sub}}
# Distribution Releaser
dist-release:
#!/bin/sh
just _term-wipe
just _clean
goreleaser
@# goreleaser release --skip-publish
mv *.{deb,gz,md,rpm,txt,yaml,zip} ../distro/templar_2.0.1/
# goreleaser release --skip-publish
ver="$(git tag | tail -1)"
ver="${ver:1}"
if [ -d "distro/templar_${ver}" ]; then
echo "WARNING: Do you need to tag a new release first?"
echo "A directory already exists for templar_${ver}"
else
echo mkdir -p "distro/templar_${ver}"
cd dist
echo mv *.{deb,gz,md,rpm,txt,yaml,zip} ../distro/templar_${ver}/
fi

# Distribution Tester
dist-test:
just _term-wipe
@just _clean
@# goreleaser --snapshot --skip-publish --rm-dist
goreleaser release --skip-publish --rm-dist
goreleaser release --skip-publish


# Run the command line app
Expand Down Expand Up @@ -127,3 +147,6 @@ _term-wipe:
clear
fi

@version:
cat templar.go | grep -F 'Version =' | cut -d'"' -f2

17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Templar v2.0.2
==============
Templar
=======

Templar Command Line Tool v2.0.0
Templar Library v0.1.0

Command line templating system written in Go. Though the initial idea was written in BASH. And that was cool; but that version had serious limitations as well. Go to the rescue!

Expand Down Expand Up @@ -28,13 +31,15 @@ Usage

```bash
$ templar template.mustache
The contents of the template with {{placeholders}}
populated from the system environment and (if present)
the environment settings of a .env file.
```


Example
-------


### INI Files

* Global variables are treated like normal ENV file variables.
Expand Down Expand Up @@ -64,11 +69,7 @@ Test Suite

Test uses Go's normal unit testing tools at this time.


Fitness for Use
---------------

I give no guarantees for this tools fitness for use on any specific system. I suspect it is "safe enough" for use on any untested systems. I've only used this on my own iMac with macOS Mojave on it. I share this code with the world so as to be easy for me to reference personally and in the hope that others will find it useful. Though I strive for portability and usefulness I make no claim that it will always work as expected in any given situation on any system tested.
Test Coverage: 83.9%



Expand Down
26 changes: 13 additions & 13 deletions cmd/templar/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//
// PACKAGES
//
/*
* PACKAGE
*/
package main

//
// IMPORTS
//
/*
* IMPORTS
*/
import (
"fmt"
"os"
Expand All @@ -20,9 +20,10 @@ import (
* CONSTANTS
*/
const (
AppDesc = "Command line templating system based on Mustache template engine and data supplied by environment variables, ENV, INI, and JSON files. And soon YAML, and TOML files as well."
AppName = "Templar"
CLIName = "templar"
AppDesc = "Command line templating system based on Mustache template engine and data supplied by environment variables, ENV, INI, and JSON files. And soon YAML, and TOML files as well."
AppName = "Templar"
AppVersion = "2.0.0"
CLIName = "templar"
)

const (
Expand All @@ -37,16 +38,15 @@ const (
* GENERATED VARIABLES
*/
var (
version = "oid"
commit = "none"
date = "unknown"
commit = "none"
date = "unknown"
)

/*
* DERIVED CONSTANTS
*/
var (
AppLabel = fmt.Sprintf("%s v%s\n%s Library v%s", AppName, version, templar.Name, templar.Version)
AppLabel = fmt.Sprintf("%s v%s\n%s Library v%s", AppName, AppVersion, templar.Name, templar.Version)
)

/*
Expand Down
12 changes: 12 additions & 0 deletions templar.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
ini "gopkg.in/ini.v1"
)

/*
* CONSTANTS
*/
const (
// Name denotes the library name
Name = "Templar"
Expand All @@ -21,17 +24,26 @@ const (
Version = "0.1.0"
)

/*
* VARIABLES
*/
var (
dataProvider map[string]interface{}
initialized = false
)

/*
* TYPES
*/
var Data struct {
INIFile []string
JSONFile []string
Template string
}

/*
* METHODS
*/
func init() {
dataProvider = make(map[string]interface{})
}
Expand Down

0 comments on commit a5c110b

Please sign in to comment.