11 Commits
2.2.0 ... 2.3.2

Author SHA1 Message Date
Tyler Akins
81f9ec326d Leaning away from committing package.json
Thank you yutachaos!
2021-11-25 15:59:30 -06:00
Tyler Akins
dae1c66f8f Merge branch 'feature/added_github_action' of https://github.com/yutachaos/mo into yutachaos-feature/added_github_action 2021-11-25 15:57:52 -06:00
Tyler Akins
08576fca7b Adding script to run against official specs 2021-11-25 15:40:13 -06:00
Tyler Akins
3aa5c462f8 Quoting variable
This suggestion is brought to you by neema80 - thank you!

This closes #48.
2021-11-25 15:36:47 -06:00
yutachaos
a28ed0ccd5 Added docker image push action 2021-04-23 13:01:42 +09:00
Tyler Akins
c86fd9a89b Merge pull request #45 from yutachaos/feature/added_docker_release
Added dockerfile and release GitHub Action
2021-04-17 11:02:12 -05:00
yutachaos
03eb3925ac Added Dockerfile 2021-04-09 14:37:51 +09:00
yutachaos
8e3e08a42b Added docker image push action 2021-04-09 14:37:45 +09:00
Tyler Akins
4c332c9188 Updating test and documentation 2020-10-01 07:42:57 -05:00
Tyler Akins
67ba8bae2c Calling out that the argument can be used multiple times 2020-10-01 07:39:02 -05:00
Tyler Akins
1d2617dde1 Confirming multiple --source arguments work 2020-10-01 07:37:48 -05:00
13 changed files with 116 additions and 17 deletions

13
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: CI
on: [push]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- name: Run tests
run: ./run-tests
- name: Run against spec
run: ./run-spec

45
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: docker push
on: [push]
jobs:
push_to_registry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Docker meta
if: startsWith(github.ref, 'refs/tags/')
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ghcr.io/${{ github.repository }}
tag-match: v(.*)
- name: Set up QEMU
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
if: startsWith(github.ref, 'refs/tags/')
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
push: true

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ tests/*.diff
spec/
spec-runner/
node_modules/
package.json
package-lock.json

2
API.md
View File

@@ -36,7 +36,7 @@ Display a help message.
-s=FILE, --source=FILE
Source a file into the environment before processing template files.
Source a file into the environment before processing template files. This can be used multiple times.
--

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM alpine:3.13.4
COPY ./mo .
RUN apk add --update bash && \
chmod +x mo &&\
mv mo /usr/local/bin/mo && \
rm -rf /var/cache/apk/*
WORKDIR /opt
ENTRYPOINT ["/usr/local/bin/mo"]

4
mo
View File

@@ -25,6 +25,7 @@
#/ This message.
#/ -s=FILE, --source=FILE
#/ Load FILE into the environment before processing templates.
#/ Can be used multiple times.
#
# Mo is under a MIT style licence with an additional non-advertising clause.
# See LICENSE.md for the full text.
@@ -71,6 +72,7 @@
# -s=FILE, --source=FILE
#
# Source a file into the environment before processing template files.
# This can be used multiple times.
#
# --
#
@@ -300,7 +302,7 @@ moFindEndTag() {
moFindString() {
local pos string
string=${2%%$3*}
string=${2%%"$3"*}
[[ "$string" == "$2" ]] && pos=-1 || pos=${#string}
local "$1" && moIndirect "$1" "$pos"
}

View File

@@ -1,10 +0,0 @@
{
"dependencies": {
"async": "*"
},
"scripts": {
"clean": "rm -rf package-lock.json node_modules/ spec/",
"install-tests": "npm install; git clone https://github.com/mustache/spec.git spec",
"test": "node run-spec.js spec/specs/*.json"
}
}

20
run-spec Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Create a package.json so the dependency package is installed in the local
# directory
echo '{"private":true, "dependencies":{"async": "*"}}' > package.json
npm install
# Install or update the specs
if [[ ! -d spec ]]; then
git clone https://github.com/mustache/spec.git spec
else
(
cd spec;
git pull
)
fi
# Actually run the specs
node run-spec.js spec/specs/*.json

View File

@@ -14,14 +14,15 @@ Simple usage:
Options:
-u, --fail-not-set
- Fail upon expansion of an unset variable.
Fail upon expansion of an unset variable.
-x, --fail-on-function
- Fail when a function returns a non-zero status code.
Fail when a function returns a non-zero status code.
-e, --false
- Treat the string "false" as empty for conditionals.
Treat the string "false" as empty for conditionals.
-h, --help
- This message.
This message.
-s=FILE, --source=FILE
- Load FILE into the environment before processing templates.
Load FILE into the environment before processing templates.
Can be used multiple times.
MO_VERSION=2.2.0

View File

@@ -0,0 +1,2 @@
export A=from1
export B=from1

View File

@@ -0,0 +1,2 @@
export B=from2
export C=from2

View File

@@ -0,0 +1,3 @@
A: from1
B: from2
C: from2

8
tests/source-multiple.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
cat <<EOF | ../mo --source=source-multiple-1.vars --source=source-multiple-2.vars
A: {{A}}
B: {{B}}
C: {{C}}
EOF