checkpoint
authordsc <dsc@less.ly>
Tue, 8 May 2012 21:37:53 +0000 (14:37 -0700)
committerdsc <dsc@less.ly>
Tue, 8 May 2012 21:37:53 +0000 (14:37 -0700)
fabfile.py

index eae72de..710f5d7 100644 (file)
@@ -1,13 +1,52 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 from fabric.api import *
+from fabric.colors import white, blue, cyan, green, yellow, red, magenta
 
 env.project_name = 'kraken-ui'
-
 env.roledefs = {
     'test': ['less.ly'],
     'production': ['reportcard2.pmtpa.wmflabs'],
 }
 
 
+@task
+def update_version():
+    """ Updates `lib/version.js`.
+    """
+    local('coke update_version')
+
+@task
+def collapse_trees():
+    """ 
+        # Ensure gitrev is up to date
+        coke update_version
+        
+        # Ensure clean dist directory
+        [ -e "tmp/dist" ] && rm -rf tmp/dist
+        mkdir -p tmp/dist
+        
+        ### Collapse the serve trees into one directory
+        log "Collapsing serve trees..."
+        
+        # Copy the static files, derived files, and the whole data directory (bc lack of trailing /)
+        # into dist. Note that you will need to load all the site pages in your browser to populate var
+        # with the derived files.
+        rsync -Ca static/ var/ data tmp/dist/
+        
+        # We copy lib (which contains .co source files) to src to make it easy to link source content
+        # to each other. Finding it in gitweb is a pain. Finding it in gerrit is almost impossible. 
+        # But this could go away when we move to github.
+        rsync -Ca lib/ tmp/dist/src/
+        
+        # For some reason, the shell tool does not generate a file identical to the middleware. So whatever.
+        # We curl here because we know that version works.
+        curl --silent --fail --url http://$DEV_HOST/vendor/browserify.js > tmp/dist/vendor/browserify.js
+        # browserify -o tmp/dist/vendor/browserify.js -r events -r seq
+    """
+    update_version()
+    
 
 @task
 def bundle():
@@ -37,4 +76,5 @@ def restart_server():
 @task
 def deploy():
     """Full deployment of latest project"""
-    pass
\ No newline at end of file
+    pass
+