Commits

Michel Albert committed 07a17e8

Makefile removed in favor of fabfile.py

  • Participants
  • Parent commits 490b605

Comments (0)

Files changed (5)

File Makefile

-#
-# Template Makefile. Running ``make`` will:
-#
-# * Compile the JS file
-# * Compile the example template
-#
-
-PLOVR=~/work/__libs__/plovr/build/plovr.jar
-
-.PHONY: js html
-
-all: js html
-	echo done
-
-js:
-	(cd js && PLOVR=${PLOVR} make)
-
-html:
-	(cd example && make html)
+from os.path import join
 import fabric.api as fab
 
 
+PLOVR_FILE = 'plovr-eba786b34df9.jar'
+PLOVR_PATH = join('dev', PLOVR_FILE)
+
+
 @fab.task
 def develop():
+    """
+    Sets up a development environment.
+    """
     fab.local('[ -d dev ] || mkdir dev')
-    fab.local('[ -f dev/plovr-81ed862.jar ] || wget -O dev/plovr-81ed862.jar '
-              'https://plovr.googlecode.com/files/plovr-81ed862.jar')
+    fab.local('[ -f {1} ] || wget -O {1} '
+              'https://plovr.googlecode.com/files/{0}'.format(
+                  PLOVR_FILE, PLOVR_PATH))
     fab.local('[ -d env ] || virtualenv env')
     fab.local('./env/bin/pip install sphinx')
+
+
+@fab.task
+def js():
+    """
+    Compile the JS source into the target JS file.
+    """
+    fab.local('java -jar {0} build plovr-config.js'.format(PLOVR_PATH))
+
+
+@fab.task
+def html():
+    """
+    Compile the example document.
+    """
+    with fab.lcd('example'):
+        fab.local('make html')
+
+
+@fab.task
+def all():
+    """
+    Compile both JS and HTML
+    """
+    fab.execute(js)
+    fab.execute(html)
+
+
+@fab.task
+def clean():
+    """
+    Remove compiled files
+    """
+    fab.local('rm -rf example/_build')
+    fab.local('rm -rf foldable/static/foldable.js')

File js/Makefile

-#
-# To run this Makefile, the environment variable "PLOVR" must be set to the
-# plovr jar file
-#
-# The global Makefile in the project root takes care of this.
-#
-
-all:
-	java -jar ${PLOVR} build plovr-config.js

File js/plovr-config.js

-{
-    "id": "dev",
-    "inputs": "sphinx-folding.js",
-    "mode": "SIMPLE",
-    "level": "VERBOSE",
-    "output-file": "../foldable/static/foldable.js",
-    "define": {
-        "goog.DEBUG": false
-    }
-}

File plovr-config.js

+{
+    "id": "dev",
+    "inputs": "js/sphinx-folding.js",
+    "mode": "RAW",
+    "level": "VERBOSE",
+    "output-file": "foldable/static/foldable.js",
+    "define": {
+        "goog.DEBUG": true
+    }
+}