-
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.
- Loading branch information
0 parents
commit e11248f
Showing
64 changed files
with
1,479 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Run tests | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: "${{ github.repository }}" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
pip install -r requirements_dev.txt | ||
tox . |
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,9 @@ | ||
.idea/ | ||
.vscode | ||
env/ | ||
|
||
!demos/gallery/tackle.yaml | ||
demos/gallery/* | ||
ouput.json | ||
|
||
before.yaml |
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,58 @@ | ||
# tackle-demo | ||
|
||
Simple demo to introduce the format and features for [`tackle-box`](https://github.com/geometry-labs/tackle-box) | ||
|
||
``` | ||
pip3 install tackle-box | ||
tackle https://github.com/robcxyz/tackle-demo | ||
``` | ||
|
||
This demo walks you through many of the aspects of tackle boxes DSL. | ||
|
||
```shell | ||
? What demos do you want to do? (<up>, <down> to move, <space> to select, <a> to toggle, <i> to invert) | ||
❯○ Monty Python basic demo | ||
○ Embedded tackle boxes | ||
○ A tutorial of all the hooks and providers | ||
○ A tutorial on useful patterns with jinja | ||
○ Galllery of the most popular cookiecutters | ||
``` | ||
|
||
### Basic Demo | ||
|
||
Simply write your tackle box per this format. The key in the jinja syntax defaults to the context filename for the template, in this case `yaml`. | ||
|
||
A `tackle.yaml` file placed in a directory and run with `tackle .` would call the script. | ||
```yaml | ||
--- | ||
name: | ||
type: input | ||
message: What is your name? | ||
|
||
colors: | ||
type: checkbox | ||
message: What are your favorite colors? | ||
choices: | ||
- blue | ||
- green | ||
- grey | ||
|
||
wingspeed: | ||
type: select | ||
message: What is the airspeed velocity of an unladen swallow?? | ||
choices: | ||
- I donno | ||
- What do you mean? African or European swallow? | ||
|
||
bad_outcome: | ||
type: print | ||
statement: Wrong answer {{ name }}... (Flung off bridge) | ||
when: "{{ 'I donno' in wingspeed }}" | ||
|
||
color_essays: | ||
type: input | ||
message: Please tell me how much you like the color {{item}}? | ||
default: Oh color {{item}}, you are so frickin cool... | ||
loop: "{{ colors }}" | ||
when: "{{ colors|length > 0 }}" | ||
``` |
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,43 @@ | ||
--- | ||
|
||
aws_enable: | ||
type: confirm | ||
message: | | ||
You can route various AWS Calls that are common. Right now | ||
we have some basic helpers that wrap boto commands. | ||
regions: | ||
type: aws_regions | ||
|
||
regions_blurb: | ||
type: confirm | ||
message: | | ||
Here is an example of the regions hook: | ||
regions: | ||
type: aws_regions | ||
It outputs a list per this output: | ||
{% raw %} | ||
{{ regions }} = {% endraw %}{{ aws.regions }} | ||
azs: | ||
type: aws_azs | ||
regions: | ||
- us-east-1 | ||
- us-east-2 | ||
|
||
azs_blurb: | ||
type: confirm | ||
message: | | ||
Here is an example of the regions hook: | ||
azs: | ||
type: aws_azs | ||
regions: | ||
- us-east-1 | ||
- us-east-2 | ||
It outputs a list per this output: | ||
{% raw %} | ||
{{ azs }} = {% endraw %}{{ aws.azs }} |
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 @@ | ||
checkbox: | ||
type: checkbox | ||
choices: | ||
- stuff | ||
- things | ||
message: | | ||
This is an example of a checkbox hook. It takes in a number of options | ||
with a list input and outputs a list. | ||
Basic example: | ||
type: checkbox | ||
message: Some message... | ||
choices: | ||
- stuff | ||
- things | ||
Returns list |
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,11 @@ | ||
confirm: | ||
type: confirm | ||
message: | | ||
This is an example of a basic confirm hook. | ||
Example: | ||
confirm: | ||
type: confirm | ||
message: Some message... | ||
Returns boolean |
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,11 @@ | ||
input: | ||
type: input | ||
default: stuff and things | ||
message: | | ||
This is an example of a input hook. It takes in a string. | ||
Basic example: | ||
type: input | ||
message: Some message... | ||
Returns string |
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,16 @@ | ||
select: | ||
type: select | ||
choices: | ||
- stuff | ||
- things | ||
message: | | ||
This is an example of a list hook. It takes in a list and returns on item. | ||
Basic example: | ||
type: input | ||
choices: | ||
- stuff | ||
- things | ||
message: Some message... | ||
Returns string |
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,15 @@ | ||
--- | ||
|
||
ops: | ||
type: stat | ||
input: | ||
- confirm | ||
- input | ||
- list | ||
- checkbox | ||
|
||
hook_run: | ||
type: tackle | ||
template: . | ||
context_file: "{{ item }}.yaml" | ||
loop: "{{ ops }}" |
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 @@ | ||
command: | ||
type: command | ||
command: pwd | ||
|
||
confirm_command: | ||
type: confirm | ||
message: | | ||
This is an example of a command hook. It runs arbitrary system commands | ||
and returns the value of stdout to the variable. | ||
command: | ||
type: command | ||
command: pwd | ||
It outputs a string per: | ||
{% raw %} | ||
{{ command }} = {% endraw %}{{ command }} |
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,19 @@ | ||
demos_dir: | ||
type: find_in_parent | ||
target: demos | ||
|
||
confirm_command: | ||
type: confirm | ||
message: | | ||
This is an example of a find_in_parent hook. It finds the absolute path | ||
to whatever target directory that you need to find in the parent directories. | ||
It is useful for setting absolute references to files and folders while | ||
switching contexts in and out of other tackle boxes. | ||
demos_dir: | ||
type: find_in_parent | ||
target: demos | ||
It outputs a string per: | ||
{% raw %} | ||
{{ demos_dir }} = {% endraw %}{{ demos_dir }} |
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,34 @@ | ||
hold: | ||
type: confirm | ||
message: hold jinja | ||
|
||
render_var: | ||
type: var | ||
input: 42 | ||
|
||
jinja: | ||
type: jinja | ||
template_path: templates/things.py.j2 | ||
output_path: testing.py | ||
|
||
confirm: | ||
type: path_exists | ||
path: testing.py | ||
|
||
confirm_jinja: | ||
type: confirm | ||
message: | | ||
This is an example of a jinja hook. It renders arbitrary templates | ||
with the context dictionary that we are building. | ||
jinja: | ||
type: jinja | ||
command: pwd | ||
It outputs a string per: | ||
{% raw %} | ||
{{ jinja }} = {% endraw %}{{ jinja }} | ||
remove: | ||
type: remove | ||
path: testing.py |
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,21 @@ | ||
hold: | ||
type: confirm | ||
message: hold listdir | ||
|
||
listdir: | ||
type: listdir | ||
path: . | ||
|
||
confirm_listdir: | ||
type: confirm | ||
message: | | ||
This is an example of a listdir hook. It outputs a list of files and folders | ||
based on a given path. Has a few options per below. | ||
listdir: | ||
type: listdir | ||
path: {{ cwd }} # We have special variables too! | ||
It outputs a string per: | ||
{% raw %} | ||
{{ listdir }} = {% endraw %}{{ listdir }} |
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,14 @@ | ||
--- | ||
|
||
ops: | ||
type: stat | ||
input: | ||
- command | ||
- listdir | ||
- jinja | ||
|
||
hook_run: | ||
type: tackle | ||
template: . | ||
context_file: "{{ item }}.yaml" | ||
loop: "{{ ops }}" |
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 @@ | ||
x = {{ render_var }} |
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,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = python -msphinx | ||
SPHINXPROJ = python_boilerplate | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
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 @@ | ||
.. include:: ../AUTHORS.rst |
Oops, something went wrong.