Skip to content

Commit

Permalink
Merge pull request #51 from gliderlabs/master
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
josegonzalez authored Mar 13, 2020
2 parents 8344abc + 932c97f commit 5f04e75
Show file tree
Hide file tree
Showing 10 changed files with 408 additions and 70 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2.1
jobs:
build:
machine:
image: ubuntu-1604:201903-01
working_directory: ~/sigil
steps:
- checkout
- run:
name: update go
command: |
curl --silent https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz -o /tmp/go1.13.8.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf /tmp/go1.13.8.linux-amd64.tar.gz
- run:
name: go version
command: |
go version
which go
echo $PATH
- run:
name: install system dependencies
command: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y lxc lxc1 gcc git build-essential ruby-dev ruby1.9.1 rpm
gem install fpm package_cloud --no-ri --no-rdoc
- run:
name: install code dependencies
command: |
make deps
- run:
name: build
command: |
glu circleci
glu container up
CIRCLECI=false make build
- store_artifacts:
path: /home/circleci/sigil/build
- run:
name: test
command: |
make test
- run:
name: release
command: |
if [[ "$CIRCLE_BRANCH" == "release" ]]; then
make release
fi
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Build output
build/*

# Release output
release/*

# Validation output
validation/*

# .env files
.env*

build
site
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,27 @@ All notable changes to this project will be documented in this file.

### Changed

[unreleased]: https://github.com/gliderlabs/glidergun/compare/v0.1.0...HEAD
## [v0.5.0] - 2020-03-13
### Fixed

- #19: @stormcat24 Use correct protocol for download url
- #24: @mozamimy Fix a typo in SplitKv function
- #30: @lalyos Fix tojson
- #39: @josegonzalez Fix sigil installation instructions
- #46: @uphy `exists` function never returns false on full path

### Added

- #13: @lalyos Make go templating left and right delimiter customizable.
- #16: @lalyos Add substring function
- #21: @lalyos Add base64enc and base64dec functions
- #28: @lalyos Add [jmespath](http://jmespath.org) function
- #52: @josegonzalez Release packages in CI

### Changed

- @josegonzalez Upgrade to circleci 2.1
- @josegonzalez Upgrade to golang 1.13.8

[unreleased]: https://github.com/gliderlabs/registrator/compare/v0.5.0...HEAD
[v0.5.0]: https://github.com/gliderlabs/registrator/compare/v0.5.0...v0.4.0
50 changes: 48 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
NAME=sigil
ARCH=$(shell uname -m)
ORG=gliderlabs
VERSION=0.4.0
VERSION=0.5.0
define DESCRIPTION
Standalone string interpolator and template processor
Sigil is a command line tool for template processing
and POSIX-compliant variable expansion. It was created
for configuration templating, but can be used for any
text processing.
endef
REPO_NAME ?= gliderlabs/sigil
ARCHITECTURE = amd64

export DESCRIPTION

build:
glu build darwin,linux ./cmd
ifdef CIRCLECI
sudo chown -R circleci:circleci build
endif
$(MAKE) deb
$(MAKE) rpm

test:
basht tests/*.bash

install: build
install build/$(shell uname -s)/sigil /usr/local/bin
install build/$(shell uname -s)/$(NAME) /usr/local/bin

deps:
go get github.com/gliderlabs/glu
Expand All @@ -19,8 +35,38 @@ deps:

release:
glu release v$(VERSION)
package_cloud push "dokku/dokku/ubuntu/xenial" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb
package_cloud push "dokku/dokku/ubuntu/bionic" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb
package_cloud push "dokku/dokku/debian/buster" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb
package_cloud push "dokku/dokku/debian/stretch" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb
package_cloud push "dokku/dokku/el/7" build/rpm/$(subst /,-,$(REPO_NAME))-$(VERSION)-1.x86_64.rpm

clean:
rm -rf build release

.PHONY: build release

deb:
mkdir -p build/deb
fpm -t deb -s dir -n $(subst /,-,$(REPO_NAME)) \
--version $(VERSION) \
--architecture amd64 \
--package build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb \
--url "https://github.com/$(REPO_NAME)" \
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
--category utils \
--description "$$DESCRIPTION" \
--license 'MIT License' \
build/Linux/sigil=/usr/bin/$(NAME)

rpm:
mkdir -p build/rpm
fpm -t rpm -s dir -n $(subst /,-,$(REPO_NAME)) \
--version $(VERSION) \
--architecture x86_64 \
--package build/rpm/$(subst /,-,$(REPO_NAME))-$(VERSION)-1.x86_64.rpm \
--url "https://github.com/$(REPO_NAME)" \
--category utils \
--description "$$DESCRIPTION" \
--license 'MIT License' \
build/Linux/sigil=/usr/bin/$(NAME)
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ for any text processing.

## Getting Sigil

```
$ curl https://dl.gliderlabs.com/sigil/latest/$(uname -sm|tr \ _).tgz \
```shell
curl -L "https://github.com/gliderlabs/sigil/releases/download/v0.5.0/sigil_0.5.0_$(uname -sm|tr \ _).tgz" \
| tar -zxC /usr/local/bin
```

Expand Down Expand Up @@ -58,6 +58,20 @@ in this form is simply used as:
You can do much more with this syntax, such as modifier pipelines. All of which
is explained below.

#### Custom Delimiters

Sometimes you want to use sigil to generate text, which uses golang templating itself.
For example if you want to generate [packer](https://www.packer.io/docs/) configuration
your template might contain a lot of `{{` and `}}`.

Intead of replacing all `{{` with `{{“{{”}}`, you can change the delimiters,
by setting the `SIGIL_DELIMS` environment variable. It is the left and right
delimiter strings, separated by a coma.

```
SIGIL_DELIMS={{{,}}} sigil -i 'hello {{{ $name }}}' name=packer
```

### Functions

There are a number of builtin functions that can be used as modifiers,
Expand Down
Loading

0 comments on commit 5f04e75

Please sign in to comment.