Created
August 1, 2011 13:27
-
-
Save AdrienLemaire/1118115 to your computer and use it in GitHub Desktop.
Pip-like tool to keep js modules up to date from github
This file contains 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 | |
import default_settings as settings | |
class jip(object): | |
""" | |
Pip-like tool to manage all the static modules | |
""" | |
def __init__(self, action="help"): | |
"""Call the correct function, and call help() if the user mistyped the | |
function""" | |
if hasattr(self, action): | |
getattr(self, action)() | |
else: | |
self.help(action) | |
def help(self, error=""): | |
if error: | |
print("%s is not a good argument\n" % error) | |
print(""" | |
Usage: fab jip:COMMAND | |
Commands available: | |
help: print this help | |
upgrade: upgrade packages""") | |
def upgrade(self): | |
"""Go and upgrade all plugins in /static/bundle, can be js or css""" | |
bundle_dir = os.path.join(settings.HOME, "static", "bundle") | |
for project in os.listdir(bundle_dir): | |
with lcd(os.path.join(bundle_dir, project)): | |
local("git pull") | |
print("%s updated" % project) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment