Created
June 4, 2013 13:48
-
-
Save pferreir/5706056 to your computer and use it in GitHub Desktop.
Installing compass and jquery in indico (dev)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from fabric.api import local, lcd | |
from fabric.context_managers import prefix | |
EXT_DIR = os.path.join(os.path.dirname(__file__), '../', 'ext_modules') | |
TARGET_DIR = os.path.join(os.path.dirname(__file__), '../', 'indico/htdocs') | |
NODE_VERSION = '0.10.9' | |
# Generated vars - do not change! | |
NODE_ENV = os.path.join(EXT_DIR, 'node_env') | |
def lib_dir(dtype): | |
return os.path.join(TARGET_DIR, dtype, 'lib') | |
def node_env(path=NODE_ENV): | |
return prefix('source {0}'.format(os.path.join(path, 'bin/activate'))) | |
def create_node_env(version=NODE_VERSION, path=NODE_ENV): | |
local('nodeenv -n {0} {1}'.format(version, path)) | |
def _fetch_submodule(name): | |
local('git submodule init {0}'.format(os.path.join(EXT_DIR, name))) | |
local('git submodule update {0}'.format(os.path.join(EXT_DIR, name))) | |
def _install_dependencies(mod_name, sub_path, dtype): | |
dest_dir = os.path.join(lib_dir(dtype), mod_name) | |
local('mkdir -p {0}'.format(dest_dir)) | |
local('cp -R {0} {1}/'.format( | |
os.path.join(EXT_DIR, mod_name, sub_path), | |
dest_dir)) | |
def install_compass(): | |
_install_dependencies('compass', 'frameworks/compass/stylesheets', 'scss') | |
def install_jquery(): | |
with node_env(NODE_ENV): | |
local('npm install -g grunt-cli') | |
with lcd(os.path.join(EXT_DIR, 'jquery')): | |
local('npm install') | |
local('grunt') | |
dest_dir = lib_dir('js') | |
local('mkdir -p {0}'.format(dest_dir)) | |
local('mv dist/jquery.js {0}/'.format(dest_dir)) | |
def fetch_asset_dependencies(): | |
_fetch_submodule('compass') | |
install_compass() | |
_fetch_submodule('jquery') | |
install_jquery() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment