def execute(self): if self.cwd == self.root: self.raise_exists() else: print "Creating .pin directory structure..." alias = None if self.options.alias: alias = self.options.alias[0] registry.initialize_project(self.cwd, alias=alias) self.root = self.cwd return True def done(self): print "pin project initialized in: %s" % self.cwd command.register(PinInitCommand) class PinDestroyCommand(command.PinCommand): '''Destroy and unregister the project from pin.''' command = 'destroy' def is_relevant(self): return self.root def raise_no_project(self): msg = "No pin project found. (aborted)" print msg
command = 'pip-requires' def setup_parser(self, parser): parser.usage = "pin pip requires" def execute(self): self.script = '' requirements_file = os.path.join(self.root, 'requirements.txt') if os.path.isfile(requirements_file): self.script = "cat %s;" % requirements_file return True def write_script(self, file): file.write(self.script) command.register(PinPipRequiresCommand) class PinPipMeetCommand(command.PinSubCommand): '''Process project's requirements.txt file. (VirtualEnv aware)''' command = 'pip-meet' def setup_parser(self, parser): parser.usage = "pin pip meet" def execute(self): self.script = '' requirements_file = os.path.join(self.root, 'requirements.txt') if os.path.isfile(requirements_file): envpath = os.path.join(self.root, 'env') venvopt = '' if os.path.isdir(envpath):
''' command = 'paver' @classmethod def get_subcommands(cls): cwd = os.getcwd() root = get_project_root(cwd) try: sys.path.append(root) mod = __import__('pavement') env = Environment(mod) tasks = env.get_tasks() maxlen, tasklist = _group_by_module(tasks) for name, group in tasklist: if name == 'pavement': return dict((t.shortname, t) for t in group) except ImportError: return dict() def setup_parser(self, parser): parser.add_argument('paverargs', nargs='*') def execute(self): if self.root: os.chdir(self.root) print "echo %s" % self.options.paverargs main(self.options.paverargs) return True command.register(PinPaverCommand)
from argparse import ArgumentParser from fabric.main import main, load_fabfile from pin import * from pin.util import * from pin import command, registry class PinFabCommand(command.PinBaseCommandDelegator): """ Commands inside your fabfile. """ command = "fab" @classmethod def get_subcommands(cls): cwd = os.getcwd() root = get_project_root(cwd) doc, tasks = load_fabfile(os.path.join(root, "fabfile.py")) return tasks def execute(self, cwd, root): os.chdir(root) sys.argv[1:] = sys.argv[2:] main() command.register(PinFabCommand)
if self.cwd == self.root: self.raise_exists() else: print "Creating .pin directory structure..." alias = None if self.options.alias: alias = self.options.alias[0] registry.initialize_project(self.cwd, alias=alias) self.root = self.cwd return True def done(self): print "pin project initialized in: %s" % self.cwd command.register(PinInitCommand) class PinDestroyCommand(command.PinCommand): '''Destroy and unregister the project from pin.''' command = 'destroy' def is_relevant(self): return self.root def raise_no_project(self): msg = "No pin project found. (aborted)" print msg def execute(self):
command = 'paver' @classmethod def get_subcommands(cls): cwd = os.getcwd() root = get_project_root(cwd) try: sys.path.append(root) mod = __import__('pavement') env = Environment(mod) tasks = env.get_tasks() maxlen, tasklist = _group_by_module(tasks) for name, group in tasklist: if name == 'pavement': return dict((t.shortname, t) for t in group) except ImportError: return dict() def setup_parser(self, parser): parser.add_argument('paverargs', nargs='*') def execute(self): if self.root: os.chdir(self.root) print "echo %s" % self.options.paverargs main(self.options.paverargs) return True command.register(PinPaverCommand)
def setup_parser(self, parser): parser.usage = "pin pip requires" def execute(self): self.script = '' requirements_file = os.path.join(self.root, 'requirements.txt') if os.path.isfile(requirements_file): self.script = "cat %s;" % requirements_file return True def write_script(self, file): file.write(self.script) command.register(PinPipRequiresCommand) class PinPipMeetCommand(command.PinSubCommand): '''Process project's requirements.txt file. (VirtualEnv aware)''' command = 'pip-meet' def setup_parser(self, parser): parser.usage = "pin pip meet" def execute(self): self.script = '' requirements_file = os.path.join(self.root, 'requirements.txt') if os.path.isfile(requirements_file): envpath = os.path.join(self.root, 'env') venvopt = ''