William Pitcock avatar William Pitcock committed 37e975d

Initial proof of concept.

Comments (0)

Files changed (7)

+*.pyc
+*.pyo
+#!/usr/bin/env python
+
+from appliancekit.compiler import compile
+import json
+
+data = compile('debian-6.spec')
+tree = json.loads(data)
+
+print json.dumps(tree, indent=1)

appliancekit/__init__.py

+from jinja2 import Environment, PackageLoader
+env = Environment(loader=PackageLoader(__name__, 'specs'))
+
+import appliancekit.compiler
+

appliancekit/compiler.py

+from appliancekit import env
+
+def compile(specname):
+     tmpl = env.get_template(specname)
+     return tmpl.render()
+

appliancekit/specs/base.spec

+{% block base %}
+[
+{% block bootstrap %}
+{% endblock %}
+
+{% block custom %}
+{% endblock %}
+
+{% block cleanup %}
+{% endblock %}
+	{"operation": "noop"}
+]
+{% endblock %}

appliancekit/specs/debian-6.spec

+{% extends "debian-base.spec" %}
+{% set distribution='squeeze' %}

appliancekit/specs/debian-base.spec

+{% extends "base.spec" %}
+{% block bootstrap %}
+	{"operation": "runcmd", "chroot": false, "command": ["debootstrap", "{{ distribution }}", "$chroot"]},
+	{"operation": "runcmd", "chroot": true, "command": ["apt-get", "-y", "--force-yes", "update"]},
+	{"operation": "runcmd", "chroot": true, "command": ["apt-get", "-y", "--force-yes", "install", "openssh-server", "e2fsprogs"]},
+{% endblock %}
+{% block packages %}{% for package in packages %}{"operation": "runcmd", "chroot": true, "command": ['apt-get', '-y', '--force-yes', 'install', '{{ package }}']},{% endfor %}{% endblock %}
+{% block cleanup %}{% endblock %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.