Merge branch 'master' of less.ly:kraken-ui
authordsc <dsc@less.ly>
Tue, 8 May 2012 21:42:43 +0000 (14:42 -0700)
committerdsc <dsc@less.ly>
Tue, 8 May 2012 21:42:43 +0000 (14:42 -0700)
Conflicts:
fabfile.py

1  2 
fabfile.py

diff --cc fabfile.py
@@@ -1,52 -1,42 +1,80 @@@
 +#!/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'],
- }
 -
 -
+ env.use_ssh_config = True # this is not working for me!
+ env.colors = True
  
  
+ # defaults
+ # Hm.
+ env.local_dist_directory = 'tmp/dist'
+ env.dist_directory = 'dist'
+ # There should be a way to do this using stages.
+ # See: http://tav.espians.com/fabric-python-with-cleaner-api-and-parallel-deployment-support.html
+ # env.config_file = False
+ # env.stages = ['production', 'staging']
+ # environments
+ @task(alias='prod')
+ def production():
+     """Set production environment variables"""
+     env.hosts = ['reportcard2.pmtpa.wmflabs']
+     env.directory = '/srv/reportcard/kraken-ui'
+     env.owner = 'www-data'
+     env.group = 'www'
+ @task
+ def staging():
+     """Set staging environment variables"""
+     env.hosts = ['less.ly']
+     env.directory = '/home/wmf/projects/kraken-ui'
+     env.user = 'wmf'
+     env.owner = 'wmf'
+     env.group = 'www'
 +@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():
@@@ -76,5 -75,9 +113,10 @@@ def restart_server()
  @task
  def deploy():
      """Full deployment of latest project"""
 -    
 +    pass
 +
+ @task
+ def test():
+     puts("user: %(user)s" % env)
 -    run('whoami')
++    run('whoami')