Exemplo n.º 1
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_all = options['test_all']
        self.to_file = options.get('jslint_file_output', True)
        self.with_static_dirs = options.get('jslint-with-staticdirs', False)
        self.jslint_with_minjs = options.get('jslint_with-minjs', False)

        root_dir = os.path.normpath(os.path.dirname(__file__))

        self.interpreter = options['jslint_interpreter'] or \
                          getattr(settings, 'JSLINT_INTERPRETER', None)
        if not self.interpreter:
            self.interpreter = find_first_existing_executable(
                [('node', '--help'), ('rhino', '--help')])
            if not self.interpreter:
                raise ValueError('No suitable js interpreter found. Please install nodejs or rhino')

        self.implementation = options['jslint_implementation']
        if not self.implementation:
            self.implementation = os.path.join(root_dir, 'jslint', 'jslint.js')

        if self.to_file:
            output_dir = options['output_dir']
            if not os.path.exists(output_dir):
                os.makedirs(output_dir)
            self.output = open(os.path.join(output_dir, 'jslint.xml'), 'w')
        else:
            self.output = sys.stdout

        self.runner = os.path.join(root_dir, 'jslint_runner.js')
        self.exclude = options['jslint_exclude'].split(',')
Exemplo n.º 2
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_all = options['test_all']
        self.to_file = options.get('jslint_file_output', True)
        self.with_static_dirs = options.get('jslint-with-staticdirs', False)
        self.jslint_with_minjs = options.get('jslint_with-minjs', False)

        root_dir = os.path.normpath(os.path.dirname(__file__))

        self.interpreter = options['jslint_interpreter'] or \
                          getattr(settings, 'JSLINT_INTERPRETER', None)
        if not self.interpreter:
            self.interpreter = find_first_existing_executable([
                ('node', '--help'), ('rhino', '--help')
            ])
            if not self.interpreter:
                raise ValueError(
                    'No sutable js interpreter found. Please install nodejs or rhino'
                )

        self.implementation = options['jslint_implementation']
        if not self.implementation:
            self.implementation = os.path.join(root_dir, 'jslint', 'jslint.js')

        if self.to_file:
            output_dir = options['output_dir']
            if not os.path.exists(output_dir):
                os.makedirs(output_dir)
            self.output = open(os.path.join(output_dir, 'jslint.xml'), 'w')
        else:
            self.output = sys.stdout

        self.runner = os.path.join(root_dir, 'jslint_runner.js')
        self.exclude = options['jslint_exclude'].split(',')
Exemplo n.º 3
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_all = options["test_all"]
        self.to_file = options.get("csslint_file_output", True)
        self.with_static_dirs = options.get("csslint_with-staticdirs", False)
        self.csslint_with_minjs = options.get("csslint_with_mincss", False)
        root_dir = os.path.normpath(os.path.dirname(__file__))

        self.interpreter = options["csslint_interpreter"] or getattr(settings, "CSSLINT_INTERPRETER", None)
        if not self.interpreter:
            self.interpreter = find_first_existing_executable([("node", "--help"), ("rhino", "--help")])
            if not self.interpreter:
                raise ValueError("No sutable js interpreter found. " "Please install nodejs or rhino")

        self.implementation = options["csslint_implementation"]
        if not self.implementation:
            runner = os.path.basename(self.interpreter)
            if "rhino" in runner:
                self.implementation = os.path.join(root_dir, "csslint", "release", "csslint-rhino.js")
            elif "node" in runner:
                self.implementation = os.path.join(root_dir, "csslint", "release", "npm", "cli.js")
            else:
                raise ValueError("No sutable css lint runner found for %s" % self.interpreter)

        if self.to_file:
            output_dir = options["output_dir"]
            if not os.path.exists(output_dir):
                os.makedirs(output_dir)
            self.output = codecs.open(os.path.join(output_dir, "csslint.report"), "w", "utf-8")
        else:
            self.output = sys.stdout

        self.exclude = options["csslint_exclude"].split(",")