Exemplo n.º 1
0
    def print_subtemplate_notice(self, output_dir=None):
            """Print a notice about local commands being availabe (if this is
            indeed the case).

            Unfortunately for us, at this stage in the process, the
            egg_info directory has not yet been created (and won't be
            within the scope of this template running [see
            paste.script.create_distro.py]), so we cannot show which
            subtemplates are available.
            """
            plugins = pluginlib.resolve_plugins(['ZopeSkel'])
            commands = pluginlib.load_commands_from_plugins(plugins)
            if not commands:
                return
            commands = commands.items()
            commands.sort()
            longest = max([len(n) for n, c in commands])
            print_commands = []
            for name, command in commands:
                name = name + ' ' * (longest - len(name))
                print_commands.append('  %s  %s' % (name,
                                                    command.load().summary))
            print_commands = '\n'.join(print_commands)
            print '-' * 78
            print """\
The project you just created has local commands. These can be used from within
the product.

usage: paster COMMAND

Commands:
%s

For more information: paster help COMMAND""" % print_commands
            print '-' * 78
Exemplo n.º 2
0
    def print_subtemplate_notice(self, output_dir=None):
        """Print a notice about local commands being available (if this is
            indeed the case).

            Unfortunately for us, at this stage in the process, the
            egg_info directory has not yet been created (and won't be
            within the scope of this template running [see
            paste.script.create_distro.py]), so we cannot show which
            subtemplates are available.

            ^^^ this appears not to be completely true.  The point where
                this method is run we are in a template which has subcommands
                and so I believe that it might actually be possible to print
                a list of those subtemplates which belong to me, since
                self.name is the same as the template name used in
                command._list_sub_templates
            """
        plugins = pluginlib.resolve_plugins(['templer.localcommands'])
        commands = pluginlib.load_commands_from_plugins(plugins)
        if not commands:
            return
        commands = commands.items()
        commands.sort()
        longest = max([len(n) for n, c in commands])
        print_commands = []
        for name, this_command in commands:
            name = name + ' ' * (longest - len(name))
            print_commands.append('  %s  %s' %
                                  (name, this_command.load().summary))
        print_commands = '\n'.join(print_commands)
        print '-' * 78
        print """\
The project you just created has local commands. These can be used from within
the product.

usage: paster COMMAND

Commands:
%s

For more information: paster help COMMAND""" % print_commands
        print '-' * 78
Exemplo n.º 3
0
    def print_subtemplate_notice(self, output_dir=None):
            """Print a notice about local commands being available (if this is
            indeed the case).

            Unfortunately for us, at this stage in the process, the
            egg_info directory has not yet been created (and won't be
            within the scope of this template running [see
            paste.script.create_distro.py]), so we cannot show which
            subtemplates are available.

            ^^^ this appears not to be completely true.  The point where
                this method is run we are in a template which has subcommands
                and so I believe that it might actually be possible to print
                a list of those subtemplates which belong to me, since
                self.name is the same as the template name used in
                command._list_sub_templates
            """
            plugins = pluginlib.resolve_plugins(['templer.localcommands'])
            commands = pluginlib.load_commands_from_plugins(plugins)
            if not commands:
                return
            commands = commands.items()
            commands.sort()
            longest = max([len(n) for n, c in commands])
            print_commands = []
            for name, this_command in commands:
                name = name + ' ' * (longest - len(name))
                print_commands.append('  %s  %s' %
                                        (name, this_command.load().summary))
            print_commands = '\n'.join(print_commands)
            print '-' * 78
            print """\
The project you just created has local commands. These can be used from within
the product.

usage: paster COMMAND

Commands:
%s

For more information: paster help COMMAND""" % print_commands
            print '-' * 78
Exemplo n.º 4
0
def test_find_commands():
    all = pluginlib.resolve_plugins(['PasteScript', 'FakePlugin'])
    commands = pluginlib.load_commands_from_plugins(all)
    print commands
    assert 'testcom' in commands
Exemplo n.º 5
0
def test_resolve_plugins():
    plugins = ['FakePlugin']
    all = pluginlib.resolve_plugins(plugins)
    assert all
    assert len(all) == 2
Exemplo n.º 6
0
def test_find_commands():
    all = pluginlib.resolve_plugins(['PasteScript', 'FakePlugin'])
    commands = pluginlib.load_commands_from_plugins(all)
    print(commands)
    assert 'testcom' in commands
Exemplo n.º 7
0
def test_resolve_plugins():
    plugins = ['FakePlugin']
    all = pluginlib.resolve_plugins(plugins)
    assert all
    assert len(all) == 2