• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mergejs.run函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mergejs.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了run函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main():
  web_dev_dir = "../web_dev"
  web_dir = "../web"
  web_temp_dir = "../web.tmp"

  proSoar_merge = "merge_proSoar.conf"
  proSoar_javascript = "proSoar.js"

  mooTools_merge = "merge_mooTools.conf"
  mooTools_javascript = "mooTools.js"

  OpenLayers_merge = "merge_OpenLayers.conf"
  OpenLayers_javascript = "OpenLayers.js"

  print "Depolying proSoar from " + web_dev_dir + " to " + web_dir

  if os.path.exists(web_temp_dir):
    shutil.rmtree(web_temp_dir)

  os.mkdir(web_temp_dir)
  os.mkdir(os.path.join(web_temp_dir, 'LC_MESSAGES'))
  os.mkdir(os.path.join(web_temp_dir, 'js'))
  os.mkdir(os.path.join(web_temp_dir, 'js', 'OpenLayers'))
  os.mkdir(os.path.join(web_temp_dir, 'js', 'MooTools'))

# merge proSoar javascript files
  print "Merging proSoar javascript files"
  try:
    proSoar_merged = mergejs.run(os.path.join(web_dev_dir, 'js'), None, proSoar_merge)
  except mergejs.MissingImport, E:
    print "\nAbnormal termination."
    sys.exit("ERROR: %s" % E)
开发者ID:ubx,项目名称:proSoar,代码行数:32,代码来源:deploy.py


示例2: minify_from_cfg

def minify_from_cfg(minimize, name, source_dir, cfg_name, out_filename, extra_params=None):
    """
        Merge+minify JS files from a JS config file (DRY helper for dojs)
    """

    info("Compressing %s" % name)

    # Merge + minify
    merged = mergejs.run(source_dir, None, cfg_name)
    if extra_params:
        try:
            # Assume closure
            minimized = minimize(merged, extra_params=extra_params)
        except:
            # No, not closure
            minimized = minimize(merged)
    else:
        minimized = minimize(merged)

    # Write minified file
    with open(out_filename, "w") as outFile:
        outFile.write(minimized)

    # Replace target file
    move_to(out_filename, "%s/S3" % source_dir)
开发者ID:sahana,项目名称:SAMBRO,代码行数:25,代码来源:build.sahana.py


示例3: len

#!/usr/bin/env python

import sys
sys.path.append("tools")

import jsmin, mergejs

sourceDirectory = "../js"
configFilename = "ors.cfg"
outputFilename = "ORS.js"

if len(sys.argv) > 1:
    configFilename = sys.argv[1] + ".cfg"
if len(sys.argv) > 2:
    outputFilename = sys.argv[2]

print "Merging libraries."
merged = mergejs.run(sourceDirectory, None, configFilename)
print "Adding license file."
merged = file("license.txt").read() + merged

print "Writing to %s." % outputFilename
file(outputFilename, "w").write(merged)

print "Done."
开发者ID:Oli90,项目名称:openrouteservice,代码行数:25,代码来源:buildUncompressed.py


示例4: minimize

    if use_compressor == "closure":
        if not warnings:
            closure.extra_params = "--warning_level QUIET"
        minimize = closure.minimize
    elif use_compressor == "closure_ws":
        minimize = closure_ws.minimize
    elif use_compressor == "jsmin":
        minimize = jsmin.jsmin

    sourceDirectory = ".."
    configFilename = "sahana.js.cfg"
    outputFilename = "S3.min.js"

    # Merge JS files
    print "Merging Core libraries."
    merged = mergejs.run(sourceDirectory, None, configFilename)

    # Compress JS files
    print "Compressing - JS"
    minimized = minimize(merged)

    # Add license
    print "Adding license file."
    minimized = open("license.txt").read() + minimized

    # Print to output files
    print "Writing to %s." % outputFilename
    open(outputFilename, "w").write(minimized)

    # Remove old JS files
    print "Deleting %s." % outputFilename
开发者ID:Akanksha18,项目名称:eden,代码行数:31,代码来源:build.sahana.py


示例5: dojs

def dojs(dogis = False):
    """ Minifies the js"""
    # Define which files we want to include
    # also need to amend sahana.js.cfg
    configDictCore = {
        "web2py":                       "..",
        "T2":                           "..",
        "S3":                           ".."
    }


    configFilename = "sahana.js.cfg"
    outputFilename = "S3.min.js"

    # Merge JS files
    print "Merging Core libraries."
    (files, order) = mergejs.getFiles(configDictCore, configFilename)
    merged = mergejs.run(files, order)

    # Compress JS files
    print "Compressing - JS"
    minimized = jsmin.jsmin(merged)

    # Add license
    print "Adding license file."
    minimized = file("license.txt").read() + minimized

    # Print to output files
    print "Writing to %s." % outputFilename
    file(outputFilename, "w").write(minimized)

    # Remove old JS files
    print "Deleting %s." % outputFilename
    try:
        os.remove("../S3/%s" % outputFilename)
    except:
        pass

    # Move new JS files
    print "Moving new JS files"
    shutil.move("S3.min.js", "../S3")

    if dogis:

        # also need to amend sahana.js.gis.cfg
        configDictGIS = {
            "gis":                          ".."
        }
        configDictGeoExt = {
            "GeoExt.js":                "../gis/GeoExt/lib",
            "GeoExt":                   "../gis/GeoExt/lib",
            "ux":                       "../gis/GeoExt"
        }
        configDictOpenLayers = {
            "OpenLayers.js":                "../gis/openlayers/lib",
            "OpenLayers":                   "../gis/openlayers/lib",
            "Rico":                         "../gis/openlayers/lib",
            "Gears":                        "../gis/openlayers/lib"
        }
        configDictGlobalGIS = {}
        configDictGlobalGIS.update(configDictOpenLayers)
        configDictGlobalGIS.update(configDictGIS)
        configFilenameGIS = "sahana.js.gis.cfg"
        configFilenameGeoExt = "geoext.js.gis.cfg"
        outputFilenameGIS = "OpenLayers.js"
        outputFilenameGeoExt = "GeoExt.js"
        
        # Merge GIS JS Files
        print "Merging GIS libraries."
        (files, order) = mergejs.getFiles(configDictGlobalGIS, configFilenameGIS)
        mergedGIS = mergejs.run(files, order)

        print "Merging GeoExt libraries."
        (files, order) = mergejs.getFiles(configDictGeoExt, configFilenameGeoExt)
        mergedGeoExt = mergejs.run(files, order)

        # Compress JS files
        print "Compressing - GIS JS"
        minimizedGIS = jsmin.jsmin(mergedGIS)

        print "Compressing - GeoExt JS"
        minimizedGeoExt = jsmin.jsmin(mergedGeoExt)

        # Add license
        minimizedGIS = file("license.gis.txt").read() + minimizedGIS

        # Print to output files
        print "Writing to %s." % outputFilenameGIS
        file(outputFilenameGIS, "w").write(minimizedGIS)

        print "Writing to %s." % outputFilenameGeoExt
        file(outputFilenameGeoExt, "w").write(minimizedGeoExt)

        # Move new JS files
        print "Deleting %s." % outputFilenameGIS
        try:
            os.remove("../gis/%s" % outputFilenameGIS)
        except:
            pass
        print "Moving new GIS JS files"
#.........这里部分代码省略.........
开发者ID:avtromba,项目名称:Sahana-Eden,代码行数:101,代码来源:build.sahana.py


示例6: file

        if keep:
            newfiles[f] = files[f]
    for o in order:
        keep = False
        for k in configDictMapFish:
            if o.startswith(k):
                keep = True
                break
        if keep:
            neworder.append(o)

#
# Merge files
#
print "Merging libraries."
merged = mergejs.run(newfiles, neworder)

#
# Compress files
#
if debug:
    minimized = merged
else:
    print "Compressing."
    minimized = jsmin.jsmin(merged)

#
# Add license
#
print "Adding license file."
minimized = file("license.txt").read() + minimized
开发者ID:AbhishekJain1,项目名称:testing-spagobi,代码行数:31,代码来源:build.py


示例7: build

def build(config_file = None, output_file = None, options = None):
    have_compressor = []
    try:
        import jsmin
        have_compressor.append("jsmin")
    except ImportError:
        print("No jsmin")
    try:
        # tools/closure_library_jscompiler.py from: 
        #       http://code.google.com/p/closure-library/source/browse/trunk/closure/bin/build/jscompiler.py
        import closure_library_jscompiler as closureCompiler
        have_compressor.append("closure")
    except Exception as E:
        print("No closure (%s)" % E)
    try:
        import closure_ws
        have_compressor.append("closure_ws")
    except ImportError:
        print("No closure_ws")
    
    try:
        import minimize
        have_compressor.append("minimize")
    except ImportError:
        print("No minimize")

    use_compressor = None
    if options.compressor and options.compressor in have_compressor:
        use_compressor = options.compressor

    sourceDirectory = "../lib"
    configFilename = "full.cfg"
    outputFilename = "OpenLayers.js"

    if config_file:
        configFilename = config_file
        extension = configFilename[-4:]

        if extension  != ".cfg":
            configFilename = config_file + ".cfg"

    if output_file:
        outputFilename = output_file

    print("Merging libraries.")
    try:
        if use_compressor == "closure":
            sourceFiles = mergejs.getNames(sourceDirectory, configFilename)
        else:
            merged = mergejs.run(sourceDirectory, None, configFilename)
    except mergejs.MissingImport as E:
        print("\nAbnormal termination.")
        sys.exit("ERROR: %s" % E)

    if options.amdname:
        options.amdname = "'" + options.amdname + "',"
    else:
        options.amdname = ""
        
    if options.amd == 'pre':
        print("\nAdding AMD function.")
        merged = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, merged)
    
    print("Compressing using %s" % use_compressor)
    if use_compressor == "jsmin":
        minimized = jsmin.jsmin(merged)
    elif use_compressor == "minimize":
        minimized = minimize.minimize(merged)
    elif use_compressor == "closure_ws":
        if len(merged) > 1000000: # The maximum file size for this web service is 1000 KB.
            print("\nPre-compressing using jsmin")
            merged = jsmin.jsmin(merged)
        print("\nIs being compressed using Closure Compiler Service.")
        try:
            minimized = closure_ws.minimize(merged)
        except Exception as E:
            print("\nAbnormal termination.")
            sys.exit("ERROR: Closure Compilation using Web service failed!\n%s" % E)
        if len(minimized) <= 2:
            print("\nAbnormal termination due to compilation errors.")
            sys.exit("ERROR: Closure Compilation using Web service failed!")
        else:
            print("Closure Compilation using Web service has completed successfully.")
    elif use_compressor == "closure":
        jscompilerJar = "../tools/closure-compiler.jar"
        if not os.path.isfile(jscompilerJar):
            print("\nNo closure-compiler.jar; read README.txt!")
            sys.exit("ERROR: Closure Compiler \"%s\" does not exist! Read README.txt" % jscompilerJar)
        minimized = closureCompiler.Compile(
            jscompilerJar, 
            sourceFiles, [
                "--externs", "closure-compiler/Externs.js",
                "--jscomp_warning", "checkVars",   # To enable "undefinedVars"
                "--jscomp_error",   "checkRegExp", # Also necessary to enable "undefinedVars"
                "--jscomp_error",   "undefinedVars"
            ]
        )
        if minimized is None:
            print("\nAbnormal termination due to compilation errors.")
            sys.exit("ERROR: Closure Compilation failed! See compilation errors.") 
#.........这里部分代码省略.........
开发者ID:WayTo,项目名称:openlayers,代码行数:101,代码来源:build.py


示例8: minimize

            print "No closure_ws"
    
    if use_compressor == "closure":
        minimize = closure.minimize
    elif use_compressor == "closure_ws":
        minimize = closure_ws.minimize
    elif use_compressor == "jsmin":
        minimize = jsmin.jsmin

    sourceDirectory = ".."
    configFilename = "sahana.js.cfg"
    outputFilename = "S3.min.js"

    # Merge JS files
    print "Merging Core libraries."
    merged = mergejs.run(sourceDirectory, None, configFilename)

    # Compress JS files
    print "Compressing - JS"
    minimized = minimize(merged)

    # Add license
    print "Adding license file."
    minimized = file("license.txt").read() + minimized

    # Print to output files
    print "Writing to %s." % outputFilename
    file(outputFilename, "w").write(minimized)

    # Remove old JS files
    print "Deleting %s." % outputFilename
开发者ID:sinsai,项目名称:Sahana_eden,代码行数:31,代码来源:build.sahana.py


示例9: file

# merge proSoar javascript files
  print "Merging proSoar javascript files"
  try:
    proSoar_merged = mergejs.run(os.path.join(web_dev_dir, 'js'), None, proSoar_merge)
  except mergejs.MissingImport, E:
    print "\nAbnormal termination."
    sys.exit("ERROR: %s" % E)

  print "Writing merged proSoar javascript to " + os.path.join(web_temp_dir, 'js', proSoar_javascript)
  file(os.path.join(web_temp_dir, 'js', proSoar_javascript), 'w').write(minify(proSoar_merged))

# merge mooTools javascript files
  print "Merging mooTools javascript files"
  try:
    mooTools_merged = mergejs.run(os.path.join(web_dev_dir, 'js'), None, mooTools_merge)
  except mergejs.MissingImport, E:
    print "\nAbnormal termination."
    sys.exit("ERROR: %s" % E)

  print "Writing merged mooTools javascript to " + os.path.join(web_temp_dir, 'js', mooTools_javascript)
  file(os.path.join(web_temp_dir, 'js', mooTools_javascript), 'w').write(minify(mooTools_merged))

# merge OpenLayers javascript files
  print "Merging OpenLayers javascript files"
  try:
    OpenLayers_merged = mergejs.run(os.path.join(web_dev_dir, 'js', 'OpenLayers', 'lib'), None, OpenLayers_merge)
  except mergejs.MissingImport, E:
    print "\nAbnormal termination."
    sys.exit("ERROR: %s" % E)
开发者ID:ubx,项目名称:proSoar,代码行数:29,代码来源:deploy.py



注:本文中的mergejs.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python datacollection.DataCollector类代码示例发布时间:2022-05-27
下一篇:
Python merge_sort.merge_sort函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap