Пример #1
0
    def handle(self, *args, **options):
        if len(args) == 0:
            raise CommandError('You need to specify a subcommand')
        elif len(args) > 1:
            raise CommandError('Invalid number of subcommands passed: %s' %
                               ", ".join(args))
        else:
            command = args[0]

        options['verbosity'] = int(options['verbosity'])

        if command == 'rebuild':
            # Start with the bundles that are defined in code.
            if options.get('verbosity') > 1:
                print "Looking for bundles defined in code..."
            registry.autoload()
            bundles = [v for k, v in registry.iter()]

            # If requested, search the templates too.
            if options.get('parse_templates'):
                bundles += self._parse_templates(options)
            else:
                if not bundles:
                    raise CommandError(
                        'No asset bundles were found. '
                        'If you are defining assets directly within your '
                        'templates, you want to use the --parse-templates '
                        'option.')

            self._rebuild_assets(options, bundles)
        else:
            raise CommandError('Unknown subcommand: %s' % command)
Пример #2
0
    def handle(self, *args, **options):
        if len(args) == 0:
            raise CommandError('You need to specify a subcommand: rebuild')
        elif len(args) > 1:
            raise CommandError('Invalid number of subcommands passed: %s' %
                ", ".join(args))
        else:
            command = args[0]

        options['verbosity'] = int(options.get('verbosity', 1))

        if command == 'rebuild':
            # Start with the bundles that are defined in code.
            if options.get('verbosity') > 1:
                print "Looking for bundles defined in code..."
            registry.autoload()
            bundles = [v for k, v in registry.iter()]

            # If requested, search the templates too.
            if options.get('parse_templates'):
                bundles += self._parse_templates(options)
            else:
                if not bundles:
                    raise CommandError('No asset bundles were found. '
                        'If you are defining assets directly within your '
                        'templates, you want to use the --parse-templates '
                        'option.')

            self._rebuild_assets(options, bundles)
        else:
            raise CommandError('Unknown subcommand: %s' % command)
Пример #3
0
    def handle(self, *args, **options):
        valid_commands = ['rebuild', 'watch', 'clean',]
        if len(args) > 1:
            raise CommandError('Invalid number of subcommands passed: %s' %
                ", ".join(args))
        elif len(args) == 0:
            raise CommandError('You need to specify a subcommand: %s' %
                               ', '.join(valid_commands))
        else:
            command = args[0]
            if not command in valid_commands:
                raise CommandError(('Not a supported subcommand: %s. Valid '+
                                   'choices are: %s') % (
                                       command, ', '.join(valid_commands)))
            command = getattr(self, 'CMD_%s' % command)

        options['verbosity'] = int(options.get('verbosity', 1))

        # Find the user's assets.
        # Start with the bundles that are defined in code.
        if options.get('verbosity') > 1:
            print "Looking for bundles defined in code..."
        registry.autoload()
        bundles = [v for k, v in registry.iter()]

        # If requested, search the templates too.
        if options.get('parse_templates'):
            bundles += self._parse_templates(options)
        else:
            if not bundles:
                raise CommandError('No asset bundles were found. '
                    'If you are defining assets directly within your '
                    'templates, you want to use the --parse-templates '
                    'option.')

        # Run the correct subcommand
        command(options, bundles)
Пример #4
0
    def handle(self, *args, **options):
        valid_commands = ['rebuild', 'watch', 'clean',]
        if len(args) > 1:
            raise CommandError('Invalid number of subcommands passed: %s' %
                ", ".join(args))
        elif len(args) == 0:
            raise CommandError('You need to specify a subcommand: %s' %
                               ', '.join(valid_commands))
        else:
            command = args[0]
            if not command in valid_commands:
                raise CommandError(('Not a supported subcommand: %s. Valid '+
                                   'choices are: %s') % (
                                       command, ', '.join(valid_commands)))
            command = getattr(self, 'CMD_%s' % command)

        options['verbosity'] = int(options.get('verbosity', 1))

        # Find the user's assets.
        # Start with the bundles that are defined in code.
        if options.get('verbosity') > 1:
            print "Looking for bundles defined in code..."
        registry.autoload()
        bundles = [v for k, v in registry.iter()]

        # If requested, search the templates too.
        if options.get('parse_templates'):
            bundles += self._parse_templates(options)
        else:
            if not bundles:
                raise CommandError('No asset bundles were found. '
                    'If you are defining assets directly within your '
                    'templates, you want to use the --parse-templates '
                    'option.')

        # Run the correct subcommand
        command(options, bundles)