コード例 #1
0
def bake_js(source_dir="js5", dest_file="script5.js"):
    create_baked_directory()
    fn = os.path.join(
        os.path.dirname(__file__),
        "..",
        "static",
        "baked",
        str(get_build_number()),
        dest_file,
    )
    if not os.path.exists(fn):
        js_content = ""
        for sfn in get_js_file_list(source_dir):
            jsfile = open(os.path.join(os.path.dirname(__file__), "..", sfn))
            js_content += jsfile.read() + "\n"
            jsfile.close()

        o = open(fn, "w")
        # Pylint disabled for next line because pylint is buggy about the es5 function
        o.write(minify_print(es5(js_content))) # pylint: disable=not-callable
        if config.has("sentry_frontend_dsn"):
            sentry_frontend_dsn = config.get("sentry_frontend_dsn")
            o.write(
                'if (window.Sentry) {'
                    'window.Sentry.init({'
                        f'dsn: "{ sentry_frontend_dsn }",'
                        'tunnel: "/sentry_tunnel",'
                    '});'
                '}'
            )
        o.close()
コード例 #2
0
def create_baked_directory():
    d = os.path.join(
        os.path.dirname(__file__), "../static/baked/", str(get_build_number())
    )
    if not os.path.exists(d):
        os.makedirs(d)
    return False
コード例 #3
0
ファイル: buildtools.py プロジェクト: mauved/rainwave
def copy_woff():
    d = os.path.join(os.path.dirname(__file__), "../static/baked/",
                     str(get_build_number()))
    # Copying the minimized font files has to go somewhere.
    for fontfile in glob.glob(
            os.path.join(os.path.dirname(__file__),
                         "../static/fonts/*.min.woff")):
        shutil.copy(fontfile, d)
コード例 #4
0
ファイル: buildtools.py プロジェクト: nv043/rainwave
def bake_beta_css():
    create_baked_directory()
    wfn = os.path.join(os.path.dirname(__file__), "..", "static", "baked",
                       str(get_build_number()), "style5b.css")
    incl_path = Path(
        os.path.join(os.path.dirname(__file__), "..", "static",
                     "style5")).resolve()
    _bake_css_file("r5.scss", wfn, incl_path)
コード例 #5
0
ファイル: buildtools.py プロジェクト: Abchrisabc/rainwave
def create_baked_directory():
	d = os.path.join(os.path.dirname(__file__), "../static/baked/", str(get_build_number()))
	if not os.path.exists(d):
		os.makedirs(d)
		if os.name != "nt" and os.getuid() == 0:	#pylint: disable=E1101
			subprocess.call(["chown", "-R", "%s:%s" % (config.get("api_user"), config.get("api_group")), d ])
		return True
	return False
コード例 #6
0
ファイル: buildtools.py プロジェクト: nv043/rainwave
def create_baked_directory():
    d = os.path.join(os.path.dirname(__file__), "../static/baked/",
                     str(get_build_number()))
    if not os.path.exists(d):
        os.makedirs(d)
        if os.name != "nt" and os.getuid() == 0:  #pylint: disable=E1101
            subprocess.call([
                "chown", "-R",
                "%s:%s" % (config.get("api_user"), config.get("api_group")), d
            ])
        return True
    return False
コード例 #7
0
ファイル: buildtools.py プロジェクト: mauved/rainwave
def create_baked_directory():
    d = os.path.join(os.path.dirname(__file__), "../static/baked/",
                     str(get_build_number()))
    if not os.path.exists(d):
        os.makedirs(d)
        subprocess.call([
            "chown",
            "-R",
            "%s:%s" % (config.get("api_user"), config.get("api_group")),
            d,
        ])
        return True
    return False
コード例 #8
0
ファイル: buildtools.py プロジェクト: Abchrisabc/rainwave
def bake_js(source_dir="js5", dest_file="script5.js"):
	create_baked_directory()
	fn = os.path.join(os.path.dirname(__file__), "..", "static", "baked", str(get_build_number()), dest_file)
	if not os.path.exists(fn):
		js_content = ""
		for sfn in get_js_file_list(source_dir):
			jsfile = open(os.path.join(os.path.dirname(__file__), "..", sfn))
			js_content += minify(jsfile.read()) + "\n"
			jsfile.close()

		o = open(fn, "w")
		o.write(minify(js_content, mangle=True, mangle_toplevel=False))
		o.close()
コード例 #9
0
ファイル: buildtools.py プロジェクト: nv043/rainwave
def bake_js(source_dir="js5", dest_file="script5.js"):
    create_baked_directory()
    fn = os.path.join(os.path.dirname(__file__), "..", "static", "baked",
                      str(get_build_number()), dest_file)
    if not os.path.exists(fn):
        js_content = ""
        for sfn in get_js_file_list(source_dir):
            jsfile = open(os.path.join(os.path.dirname(__file__), "..", sfn))
            js_content += minify(jsfile.read()) + "\n"
            jsfile.close()

        o = open(fn, "w")
        o.write(minify(js_content, mangle=True, mangle_toplevel=False))
        o.close()
コード例 #10
0
ファイル: buildtools.py プロジェクト: mauved/rainwave
def bake_css():
    create_baked_directory()
    wfn = os.path.join(
        os.path.dirname(__file__),
        "..",
        "static",
        "baked",
        str(get_build_number()),
        "style5.css",
    )
    incl_path = str(
        Path(os.path.join(os.path.dirname(__file__), "..", "static",
                          "style5")).resolve())
    if not os.path.exists(wfn):
        _bake_css_file("r5.scss", wfn, incl_path)
コード例 #11
0
ファイル: buildtools.py プロジェクト: nv043/rainwave
def bake_templates(source_dir="templates5",
                   dest_file="templates5.js",
                   always_write=False,
                   **kwargs):
    create_baked_directory()
    source_dir = os.path.join(os.path.dirname(__file__), "..", "static",
                              source_dir)
    dest_file = os.path.join(os.path.dirname(__file__), "..", "static",
                             "baked", str(get_build_number()), dest_file)
    if not os.path.exists(dest_file) or always_write:
        RWTemplates.compile_templates(source_dir,
                                      dest_file,
                                      helpers=False,
                                      inline_templates=('fave', 'rating',
                                                        'rating_album'),
                                      **kwargs)
コード例 #12
0
ファイル: buildtools.py プロジェクト: mauved/rainwave
def bake_js(source_dir="js5", dest_file="script5.js"):
    create_baked_directory()
    fn = os.path.join(
        os.path.dirname(__file__),
        "..",
        "static",
        "baked",
        str(get_build_number()),
        dest_file,
    )
    if not os.path.exists(fn):
        js_content = ""
        for sfn in get_js_file_list(source_dir):
            jsfile = open(os.path.join(os.path.dirname(__file__), "..", sfn))
            js_content += jsfile.read() + "\n"
            jsfile.close()

        o = open(fn, "w")
        # Pylint disabled for next line because pylint is buggy about the es5 function
        o.write(minify_print(es5(js_content), obfuscate=True))  # pylint: disable=not-callable
        o.close()
コード例 #13
0
ファイル: buildtools.py プロジェクト: MagnusVortex/rainwave
def bake_beta_css():
	create_baked_directory()
	wfn = os.path.join(os.path.dirname(__file__), "..", "static", "baked", str(get_build_number()), "style4b.css")
	_bake_css_file(os.path.join(os.path.dirname(__file__), "..", "static", "style4", "_sass.scss"), wfn)
コード例 #14
0
ファイル: buildtools.py プロジェクト: MagnusVortex/rainwave
def increment_build_number():
	bn = get_build_number()	+ 1
	bnf = open(os.path.join(os.path.dirname(__file__), "../etc/buildnum"), 'w')
	bnf.write(bn)
	bnf.close()
	return bn
コード例 #15
0
ファイル: buildtools.py プロジェクト: Abchrisabc/rainwave
def bake_beta_css():
	create_baked_directory()
	wfn = os.path.join(os.path.dirname(__file__), "..", "static", "baked", str(get_build_number()), "style5b.css")
	incl_path = Path(os.path.join(os.path.dirname(__file__), "..", "static", "style5")).resolve()
	_bake_css_file("r5.scss", wfn, incl_path)
コード例 #16
0
ファイル: buildtools.py プロジェクト: Abchrisabc/rainwave
def copy_woff():
	d = os.path.join(os.path.dirname(__file__), "../static/baked/", str(get_build_number()))
	# Copying the minimized font files has to go somewhere.
	for fontfile in glob.glob(os.path.join(os.path.dirname(__file__), "../static/fonts/*.min.woff")):
		shutil.copy(fontfile, d)
コード例 #17
0
ファイル: buildtools.py プロジェクト: Abchrisabc/rainwave
def bake_templates(source_dir="templates5", dest_file="templates5.js", always_write=False, **kwargs):
	create_baked_directory()
	source_dir = os.path.join(os.path.dirname(__file__), "..", "static", source_dir)
	dest_file = os.path.join(os.path.dirname(__file__), "..", "static", "baked", str(get_build_number()), dest_file)
	if not os.path.exists(dest_file) or always_write:
		RWTemplates.compile_templates(source_dir, dest_file, helpers=False, inline_templates=('fave', 'rating', 'rating_album'), **kwargs)