コード例 #1
0
def tzjs_dump_dependencies(env, options, input_js):
    """
    Lists all the dependencies of the .js file.  We attempt to retain
    some kind of order with the leaves of the dependency tree at the
    top of the list.
    """

    # The set of files to be injected

    injects = inject_js_from_options(options)

    LOG.info("files to inject:")
    _ = [ LOG.info(" - %s" % i) for i in injects ]

    # Do a full parse with a correct context, and extract the
    # javascript includes

    context = context_from_options(options, input_js[0])

    deps = render_js_extract_includes(context, options,
                                      env_load_templates(env, input_js),
                                      injects)

    # TODO : Do we need this find_dependencies stage?  It doesn't pick
    # up any javascript tags.

    for i in input_js:
        deps += find_dependencies(i, options.templatedirs, env)

    # Write dependency data

    # LOG.info("deps are: %s" % deps)
    output_dependency_info(options.dependency_file, options.output, deps)

    return 0
コード例 #2
0
def html_dump_dependencies(env, options, input_js, input_html):
    """
    Dump the dependencies of the html file being output
    """

    # For html, dependencies are:
    # - dev: html template deps, top-level js files
    # - release: html template deps
    # - canvas_dev: html template deps, top-level js files
    # - canvas: html template deps

    outfile_name = options.dependency_file
    if outfile_name is None:
        LOG.error("No dependency output file specified")
        return 1

    # Collect html dependencies (if there are html files available)

    if 1 == len(input_html):
        try:
            deps = find_dependencies(input_html[0], options.templatedirs, env,
                                     [ 'default' ])
        except Exception, e:
            raise ToolsException("dependency error: %s" % str(e))
コード例 #3
0
def html_dump_dependencies(env, options, input_js, input_html):
    """
    Dump the dependencies of the html file being output
    """

    # For html, dependencies are:
    # - dev: html template deps, top-level js files
    # - release: html template deps
    # - canvas_dev: html template deps, top-level js files
    # - canvas: html template deps

    outfile_name = options.dependency_file
    if outfile_name is None:
        LOG.error("No dependency output file specified")
        return 1

    # Collect html dependencies (if there are html files available)

    if 1 == len(input_html):
        try:
            deps = find_dependencies(input_html[0], options.templatedirs, env,
                                     ['default'])
        except Exception, e:
            raise ToolsException("dependency error: %s" % str(e))