Skip to content

Commit

Permalink
Update docs and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
brendandburns committed Dec 18, 2019
1 parent 2db69e4 commit dd18189
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 27 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ Configula is a configuration generation language and processor. It's goal is to
definition of declarative configuration easy and intuitive.

### Inspiration
Configula is inspired by the JSX language in React that combines Javascript and HTML tags. Configula
defines a similar pattern for Python and YAML.
Configula is inspired by the [JSX language](https://reactjs.org/docs/introducing-jsx.html) in [React](https://reactjs.org) that combines Javascript and HTML tags. Configula
defines a similar pattern for Python and YAML (for now).

Consider this declaration:
```
my_object = foo: bar
```

This is neither Python, nor YAML, it combines the syntax of both. Instead of being a templating language like Jinja or others, or a DSL like HCL, it combines the power of
a full programming language with the ease of a declarative syntax like YAML.

### Example

Expand Down
24 changes: 12 additions & 12 deletions examples/namespaces-alternate.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Simple example of creating 3 Kubernetes namespaces
users = [ 'bob', 'sue', 'sally']

# Our users in need of namespaces
users = ['jim', 'sally', 'sue']
# This Python object is defined by inline YAML
namespace = <
apiVersion: v1
kind: Namespace
metadata:
# The !~ syntax enables python substitution, in this case a variable named `userName`
name: !~ user
>

# The namespaces objects from YAML
namespaces = map(lambda user: <
apiVersion: v1
kind: Namespace
metadata:
name: !~ user
>, users)

# Output
render(namespaces)
for user in users:
namespace.render()
print("---")
26 changes: 13 additions & 13 deletions examples/namespaces.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Simple example of creating 5 Kubernetes namespaces
users = [ 'bob', 'sue', 'sally', 'jim']
# Simple example of creating 3 Kubernetes namespaces

# This Python object is defined by inline YAML
namespace = <
apiVersion: v1
kind: Namespace
metadata:
# The !~ syntax enables python substitution, in this case a variable named `userName`
name: !~ user
>
# Our users in need of namespaces
users = ['jim', 'sally', 'sue']

for user in users:
namespace.render()
print("---")
# The namespaces objects from YAML
namespaces = map(lambda user: <
apiVersion: v1
kind: Namespace
metadata:
name: !~ user
>, users)

# Output
render(namespaces)

0 comments on commit dd18189

Please sign in to comment.