Esempio n. 1
0
    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
Esempio n. 2
0
    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):
Esempio n. 3
0
    '''
    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)
Esempio n. 4
0
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)
Esempio n. 5
0
        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):
Esempio n. 6
0
    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)
Esempio n. 7
0
    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 = ''