Builds the static files directory as well as robots.txt and favicon.ico
197190
def build_static(self, *args, **options):
        
        logger.debug("Building static directory")
        if self.verbosity > 1:
            self.stdout.write("Building static directory")
        management.call_command(
            "collectstatic",
            interactive=False,
            verbosity=0
        )

        # Set the target directory inside the filesystem.
        target_dir = path.join(
            self.build_dir,
            settings.STATIC_URL.lstrip('/')
        )
        target_dir = smart_text(target_dir)

        if os.path.exists(self.static_root) and settings.STATIC_URL:
            if getattr(settings, 'BAKERY_GZIP', False):
                self.copytree_and_gzip(self.static_root, target_dir)
            # if gzip isn't enabled, just copy the tree straight over
            else:
                logger.debug("Copying {}{} to {}{}".format("osfs://", self.static_root, self.fs_name, target_dir))
                copy.copy_dir("osfs:///", self.static_root, self.fs, target_dir)

        # If they exist in the static directory, copy the robots.txt
        # and favicon.ico files down to the root so they will work
        # on the live website.
        robots_src = path.join(target_dir, 'robots.txt')
        if self.fs.exists(robots_src):
            robots_target = path.join(self.build_dir, 'robots.txt')
            logger.debug("Copying {}{} to {}{}".format(self.fs_name, robots_src, self.fs_name, robots_target))
            self.fs.copy(robots_src, robots_target)

        favicon_src = path.join(target_dir, 'favicon.ico')
        if self.fs.exists(favicon_src):
            favicon_target = path.join(self.build_dir, 'favicon.ico')
            logger.debug("Copying {}{} to {}{}".format(self.fs_name, favicon_src, self.fs_name, favicon_target))
            self.fs.copy(favicon_src, favicon_target)
55790
def build(self, paths, tags=None, wheel_version=None):
        
        if tags is None:
            tags = {}

        libkey = list(filter(lambda o: o in paths, ('purelib', 'platlib')))[0]
        if libkey == 'platlib':
            is_pure = 'false'
            default_pyver = [IMPVER]
            default_abi = [ABI]
            default_arch = [ARCH]
        else:
            is_pure = 'true'
            default_pyver = [PYVER]
            default_abi = ['none']
            default_arch = ['any']

        self.pyver = tags.get('pyver', default_pyver)
        self.abi = tags.get('abi', default_abi)
        self.arch = tags.get('arch', default_arch)

        libdir = paths[libkey]

        name_ver = '%s-%s' % (self.name, self.version)
        data_dir = '%s.data' % name_ver
        info_dir = '%s.dist-info' % name_ver

        archive_paths = []

        # First, stuff which is not in site-packages
        for key in ('data', 'headers', 'scripts'):
            if key not in paths:
                continue
            path = paths[key]
            if os.path.isdir(path):
                for root, dirs, files in os.walk(path):
                    for fn in files:
                        p = fsdecode(os.path.join(root, fn))
                        rp = os.path.relpath(p, path)
                        ap = to_posix(os.path.join(data_dir, key, rp))
                        archive_paths.append((ap, p))
                        if key == 'scripts' and not p.endswith('.exe'):
                            with open(p, 'rb') as f:
                                data = f.read()
                            data = self.process_shebang(data)
                            with open(p, 'wb') as f:
                                f.write(data)

        # Now, stuff which is in site-packages, other than the
        # distinfo stuff.
        path = libdir
        distinfo = None
        for root, dirs, files in os.walk(path):
            if root == path:
                # At the top level only, save distinfo for later
                # and skip it for now
                for i, dn in enumerate(dirs):
                    dn = fsdecode(dn)
                    if dn.endswith('.dist-info'):
                        distinfo = os.path.join(root, dn)
                        del dirs[i]
                        break
                assert distinfo, '.dist-info directory expected, not found'

            for fn in files:
                # comment out next suite to leave .pyc files in
                if fsdecode(fn).endswith(('.pyc', '.pyo')):
                    continue
                p = os.path.join(root, fn)
                rp = to_posix(os.path.relpath(p, path))
                archive_paths.append((rp, p))

        # Now distinfo. Assumed to be flat, i.e. os.listdir is enough.
        files = os.listdir(distinfo)
        for fn in files:
            if fn not in ('RECORD', 'INSTALLER', 'SHARED', 'WHEEL'):
                p = fsdecode(os.path.join(distinfo, fn))
                ap = to_posix(os.path.join(info_dir, fn))
                archive_paths.append((ap, p))

        wheel_metadata = [
            'Wheel-Version: %d.%d' % (wheel_version or self.wheel_version),
            'Generator: distlib %s' % __version__,
            'Root-Is-Purelib: %s' % is_pure,
        ]
        for pyver, abi, arch in self.tags:
            wheel_metadata.append('Tag: %s-%s-%s' % (pyver, abi, arch))
        p = os.path.join(distinfo, 'WHEEL')
        with open(p, 'w') as f:
            f.write('\n'.join(wheel_metadata))
        ap = to_posix(os.path.join(info_dir, 'WHEEL'))
        archive_paths.append((ap, p))

        # Now, at last, RECORD.
        # Paths in here are archive paths - nothing else makes sense.
        self.write_records((distinfo, info_dir), libdir, archive_paths)
        # Now, ready to build the zip file
        pathname = os.path.join(self.dirname, self.filename)
        self.build_zip(pathname, archive_paths)
        return pathname
78803
def _build_tarball(src_repo) -> str:
    
    run = partial(subprocess.run, cwd=src_repo, check=True)
    run(['git', 'clean', '-xdff'])
    src_repo = Path(src_repo)
    if os.path.exists(src_repo / 'es' / 'upstream'):
        run(['git', 'submodule', 'update', '--init', '--', 'es/upstream'])
    run(['./gradlew', '--no-daemon', 'clean', 'distTar'])
    distributions = Path(src_repo) / 'app' / 'build' / 'distributions'
    return next(distributions.glob('crate-*.tar.gz'))
328883
def bootstrap():
    ""
    # Link files shared by subprojects
    debian = path("debian")
    debian.exists() or debian.makedirs()

    for shared in ("debian/changelog", "LICENSE"):
        path(shared).exists() or (path("..") / shared).link(shared)

    build()
1306153
function(){
		STATIC_FILES.forEach(function(file){
			addFile(fs.createReadStream(__dirname + '/templates/' + file), { name: file });
		});
	}
1327161
def build_files(outdir):
    """"""
    # Make sure there is actually a configuration file
    config_file_dir = os.path.join(cwd, "config.py")
    if not os.path.exists(config_file_dir):
        sys.exit(
            "There dosen't seem to be a configuration file. Have you run the init command?")
    else:
        sys.path.insert(0, cwd)
        try:
            from config import website_name, website_description, website_language, home_page_list
        except:
            sys.exit(
                "ERROR: Some of the crucial configuration values could not be found! Maybe your config.py is too old. Run 'blended init' to fix.")
        try:
            from config import website_description_long, website_license, website_url, author_name, author_bio, plugins, minify_css, minify_js, custom_variables
        except:
            website_description_long = ""
            website_license = ""
            website_url = ""
            author_name = ""
            author_bio = ""
            plugins = []
            custom_variables = {}
            minify_css = False
            minify_js = False
            print("WARNING: Some of the optional configuration values could not be found! Maybe your config.py is too old. Run 'blended init' to fix.\n")

    # Create the build folder
    build_dir = os.path.join(cwd, outdir)
    if "." not in outdir and ".." not in outdir and "..." not in outdir and "...." not in outdir and "....." not in outdir:
        replace_folder(build_dir)

    # Make sure there is actually a header template file
    header_file_dir = os.path.join(cwd, "templates", "header.html")
    if not os.path.exists(header_file_dir):
        sys.exit(
            "There dosen't seem to be a header template file. You need one to generate.")

    # Make sure there is actually a footer template file
    footer_file_dir = os.path.join(cwd, "templates", "footer.html")
    if not os.path.exists(footer_file_dir):
        sys.exit(
            "There dosen't seem to be a footer template file. You need one to generate.")

    # Open the header and footer files for reading
    header_file = open(header_file_dir, "r")
    footer_file = open(footer_file_dir, "r")

    # Create the HTML page listing
    page_list_item_file = os.path.join(cwd, "templates", "page_list_item.html")
    if not os.path.exists(page_list_item_file):
        page_list = '<ul class="page-list">\n'
        for root, dirs, files in os.walk(os.path.join(cwd, "content")):
            for filename in files:
                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, "content"), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)

                if subfolder == "":
                    subfolder_link = ""
                else:
                    subfolder_link = subfolder + "/"
                file_modified = time.ctime(
                    os.path.getmtime(os.path.join(root, filename)))
                newFilename = get_html_filename(filename)
                newFilename2 = get_html_clear_filename(filename)
                page_list = page_list + '<li class="page-list-item"><a href="' + subfolder_link + newFilename + \
                    '">' + newFilename2 + '</a><span class="page-list-item-time"> - ' + \
                    str(file_modified) + '</span></li>\n'
        page_list = page_list + '</ul>'
    else:
        with open(page_list_item_file, 'r') as f:
            page_list_item = f.read()

        page_list = ""
        for root, dirs, files in os.walk(os.path.join(cwd, "content")):
            dirs[:] = [d for d in dirs if "_" not in d]
            for filename in files:
                p_content = convert_text(os.path.join(root, filename))
                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, "content"), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)

                if subfolder == "":
                    subfolder_link = ""
                else:
                    subfolder_link = subfolder + "/"
                file_modified = time.ctime(
                    os.path.getmtime(os.path.join(root, filename)))
                file_modified_day = str(datetime.strptime(
                file_modified, "%a %b %d %H:%M:%S %Y"))[8:10]
                file_modified_year = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[:4]
                file_modified_month = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[5:7]
                month_name = calendar.month_name[int(file_modified_month)]
                newFilename = get_html_filename(filename)
                newFilename2 = get_html_clear_filename(filename)

                page_list = page_list + page_list_item.replace("{path}", subfolder_link + newFilename).replace("{name}", newFilename2).replace(
                    "{date}", str(file_modified)).replace("{content}", p_content).replace("{content_short}", p_content[:250] + "...").replace("{day}", file_modified_day).replace("{month}", file_modified_month).replace("{month_name}", month_name).replace("{year}", file_modified_year)

    if home_page_list == "yes" or home_page_list:
        # Open the home page file (index.html) for writing
        home_working_file = open(os.path.join(cwd, outdir, "index.html"), "w")

        home_working_file.write(header_file.read())

        # Make sure there is actually a home page template file
        home_templ_dir = os.path.join(cwd, "templates", "home_page.html")
        if os.path.exists(home_templ_dir):
            home_templ_file = open(home_templ_dir, "r")
            home_working_file.write(home_templ_file.read())
        else:
            print("\nNo home page template file found. Writing page list to index.html")
            home_working_file.write(page_list)

        home_working_file.write(footer_file.read())

        home_working_file.close()

    for root, dirs, files in os.walk(os.path.join(cwd, "content")):
        dirs[:] = [d for d in dirs if "_" not in d]
        for filename in files:
            if not filename.startswith("_"):
                header_file = open(header_file_dir, "r")
                footer_file = open(footer_file_dir, "r")
                newFilename = get_html_filename(filename)

                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, "content"), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)

                if subfolder == "":
                    currents_working_file = open(
                        os.path.join(cwd, outdir, newFilename), "w")
                else:
                    create_folder(os.path.join(cwd, outdir, subfolder))
                    currents_working_file = open(os.path.join(
                        cwd, outdir, subfolder, newFilename), "w")

                # Write the header
                currents_working_file.write(header_file.read())

                text_cont1 = convert_text(os.path.join(root, filename))

                if "+++++" in text_cont1.splitlines()[1]:
                    page_template_file = text_cont1.splitlines()[0]
                    text_cont1 = text_cont1.replace(
                        text_cont1.splitlines()[0], "")
                    text_cont1 = text_cont1.replace(
                        text_cont1.splitlines()[1], "")
                else:
                    page_template_file = "content_page"

                # Write the text content into the content template and onto the
                # build file
                content_templ_dir = os.path.join(
                    cwd, "templates", page_template_file + ".html")
                if os.path.exists(content_templ_dir):
                    content_templ_file = open(content_templ_dir, "r")
                    content_templ_file1 = content_templ_file.read()
                    content_templ_file2 = content_templ_file1.replace(
                        "{page_content}", text_cont1)
                    currents_working_file.write(content_templ_file2)
                else:
                    currents_working_file.write(text_cont1)

                # Write the footer to the build file
                currents_working_file.write("\n" + footer_file.read())

                # Close the build file
                currents_working_file.close()

    # Find all the nav(something) templates in the `templates` folder and
    # Read their content to the dict
    navs = {}

    for file in os.listdir(os.path.join(cwd, "templates")):
        if "nav" in file:
            nav_cont = open(os.path.join(cwd, "templates", file), "r")
            navs[file.replace(".html", "")] = nav_cont.read()
            nav_cont.close()

    forbidden_dirs = set(["assets", "templates"])
    blended_version_message = "Built with Blended v" + \
        str(app_version)
    build_date = str(datetime.now().date())
    build_time = str(datetime.now().time())
    build_datetime = str(datetime.now())

    # Replace global variables such as site name and language
    for root, dirs, files in os.walk(os.path.join(cwd, outdir)):
        dirs[:] = [d for d in dirs if d not in forbidden_dirs]
        for filename in files:
            if filename != "config.pyc" and filename != "config.py":
                newFilename = get_html_clear_filename(filename)
                page_file = filename.replace(".html", "")
                page_folder = os.path.basename(os.path.dirname(os.path.join(
                    root, filename))).replace("-", "").replace("_", "").title()
                page_folder_orig = os.path.basename(
                    os.path.dirname(os.path.join(root, filename)))
                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, outdir), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)
                if subfolder == "":
                    subfolder_folder = os.path.join(cwd, outdir, filename)
                else:
                    subfolder_folder = os.path.join(
                        cwd, outdir, subfolder, filename)
                file_modified = time.ctime(
                    os.path.getmtime(os.path.join(root, filename)))
                file_modified_day = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[8:10]
                file_modified_year = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[:4]
                file_modified_month = str(datetime.strptime(
                file_modified, "%a %b %d %H:%M:%S %Y"))[5:7]
                month_name = calendar.month_name[int(file_modified_month)]

                # The Loop!
                for line in fileinput.input(subfolder_folder, inplace=1):
                    for var in custom_variables:
                        line = line.replace(
                            "{" + var + "}", custom_variables[var])
                    if len(plugins) != 0:
                        for i in range(len(plugins)):
                            if sys.version_info[0] < 2:
                                main = importlib.import_module(plugins[i])
                            elif sys.version_info[0] < 3:
                                main = __import__(plugins[i])
                            content = main.main()
                            line = line.replace(
                                "{" + plugins[i] + "}", content)
                    if "{nav" in line:
                        navname = line.split("{")[1].split("}")[0]
                        line = line.replace(
                            "{" + navname + "}", navs[(line.split("{"))[1].split("}")[0]])
                    line = line.replace(
                        "{website_description}", website_description)
                    line = line.replace(
                        "{website_description_long}", website_description_long)
                    line = line.replace("{website_license}", website_license)
                    line = line.replace("{website_language}", website_language)
                    line = line.replace("{website_url}", website_url)
                    line = line.replace("{author_name}", author_name)
                    line = line.replace("{author_bio}", author_bio)
                    line = line.replace("{random_number}",
                                        str(randint(0, 100000000)))
                    line = line.replace("{build_date}", build_date)
                    line = line.replace("{build_time}", build_time)
                    line = line.replace("{build_datetime}", build_datetime)
                    line = line.replace("{page_list}", page_list)
                    line = line.replace("{page_name}", newFilename)
                    line = line.replace("{page_filename}", page_file)
                    line = line.replace("{page_file}", filename)
                    line = line.replace("{" + filename + "_active}", "active")
                    if page_folder != outdir.title():
                        line = line.replace("{page_folder}", page_folder)
                    else:
                        line = line.replace("{page_folder}", "")
                    if page_folder_orig != outdir:
                        line = line.replace(
                            "{page_folder_orig}", page_folder_orig)
                    else:
                        line = line.replace("{page_folder_orig}", "")
                    line = line.replace("{page_date}", str(file_modified))
                    line = line.replace("{page_day}", str(file_modified_day))
                    line = line.replace("{page_year}", str(file_modified_year))
                    line = line.replace(
                        "{page_month}", str(file_modified_month))
                    line = line.replace(
                        "{page_month_name}", str(month_name))
                    line = line.replace("{blended_version}", str(app_version))
                    line = line.replace(
                        "{blended_version_message}", blended_version_message)
                    line = line.replace("{website_name}", website_name)
                    top = os.path.join(cwd, outdir)
                    startinglevel = top.count(os.sep)
                    relative_path = ""
                    level = root.count(os.sep) - startinglevel
                    for i in range(level):
                        relative_path = relative_path + "../"
                    line = line.replace("{relative_root}", relative_path)
                    print(line.rstrip('\n'))
                fileinput.close()

    # Copy the asset folder to the build folder
    if os.path.exists(os.path.join(cwd, "templates", "assets")):
        if os.path.exists(os.path.join(cwd, outdir, "assets")):
            shutil.rmtree(os.path.join(cwd, outdir, "assets"))
        shutil.copytree(os.path.join(cwd, "templates", "assets"),
                        os.path.join(cwd, outdir, "assets"))

    for root, dirs, files in os.walk(os.path.join(cwd, outdir, "assets")):
        for file in files:
            if not file.startswith("_"):
                if (file.endswith(".sass")) or (file.endswith(".scss")):
                    sass_text = open(os.path.join(root, file)).read()
                    text_file = open(os.path.join(
                        root, file[:-4] + "css"), "w")
                    if sass_text != "":
                        text_file.write(sass.compile(string=sass_text))
                    else:
                        print(file + " is empty! Not compiling Sass.")
                    text_file.close()
                if file.endswith(".less"):
                    less_text = open(os.path.join(root, file)).read()
                    text_file = open(os.path.join(
                        root, file[:-4] + "css"), "w")
                    if less_text != "":
                        text_file.write(lesscpy.compile(StringIO(less_text)))
                    else:
                        print(file + " is empty! Not compiling Less.")
                    text_file.close()
                if file.endswith(".styl"):
                    try:
                        styl_text = open(os.path.join(root, file)).read()
                        text_file = open(os.path.join(
                            root, file[:-4] + "css"), "w")
                        if styl_text != "":
                            text_file.write(Stylus().compile(styl_text))
                        else:
                            print(file + " is empty! Not compiling Styl.")
                        text_file.close()
                    except:
                        print("Not able to build with Stylus! Is it installed?")
                        try:
                            subprocess.call["npm", "install", "-g", "stylus"]
                        except:
                            print("NPM (NodeJS) not working. Is it installed?")
                if file.endswith(".coffee"):
                    coffee_text = open(os.path.join(root, file)).read()
                    text_file = open(os.path.join(root, file[:-6] + "js"), "w")
                    if coffee_text != "":
                        text_file.write(coffeescript.compile(coffee_text))
                    else:
                        print(file + " is empty! Not compiling CoffeeScript.")
                    text_file.close()
                if minify_css:
                    if file.endswith(".css"):
                        css_text = open(os.path.join(root, file)).read()
                        text_file = open(os.path.join(root, file), "w")
                        if css_text != "":
                            text_file.write(cssmin(css_text))
                        text_file.close()
                if minify_js:
                    if file.endswith(".js"):
                        js_text = open(os.path.join(root, file)).read()
                        text_file = open(os.path.join(root, file), "w")
                        if js_text != "":
                            text_file.write(jsmin(js_text))
                        text_file.close()
102090
function buildTree(directory, depth) {
  const files = fs.readdirSync(directory);
  const max_index = files.length - 1
  const color = chalk[colors[depth % colors.length]]

  for (let i = 0; i <= max_index; i++) {
    const file = files[i]
    depths[depth] = max_index - i
    const fullPath = path.resolve(directory, file)
    const prefix = buildPrefix(depth, i === max_index, directory)
    const stats = fs.statSync(fullPath)
    const isDirectory = stats.isDirectory()
    const size = prettybytes(stats.size)

    if (isDirectory) {
      directoryCount++
    } else {
      fileCount++
      totalFileSize += stats.size
    }

    if (!isDirectory && !shouldBeIncluded(file)) {
      return
    }

    const filename = useColors ? color(file) : file
    output += prefix + filename + (!isDirectory && showSize ? ` (${size})` : '') + '\n';
    if (isDirectory && (depth + 1 < maxDepth)) {
      buildTree(path.resolve(directory, file), depth + 1)
    }
    --depths[depth]
  }
}
351692
def build(ctx, builder="html", options=""):
    """"""
    sourcedir = ctx.config.sphinx.sourcedir
    destdir = Path(ctx.config.sphinx.destdir or "build")/builder
    destdir = destdir.abspath()
    with cd(sourcedir):
        destdir_relative = Path(".").relpathto(destdir)
        command = "sphinx-build {opts} -b {builder} {sourcedir} {destdir}" \
                    .format(builder=builder, sourcedir=".",
                            destdir=destdir_relative, opts=options)
        ctx.run(command)
536833
public static function build() {
		// We need a working directory early.
		static::make_working_dir();
		$skel_dir = \BOB_ROOT_DIR . 'skel/';

		// Install composer.
		io::composer_install(static::$_working_dir, "{$skel_dir}composer.json", true);

		// Use local blob-common instead of pulling from Git?
		if (log::confirm('Use local copy of blob-common?')) {
			log::print('Replacing remote with local lib…');
			$working = static::$_working_dir . 'vendor/blobfolio/blob-common/lib/blobfolio/';
			v_file::rmdir($working);
			v_file::copy(\dirname(\BOB_ROOT_DIR) . '/lib/blobfolio/', $working);
		}

		log::print('Parsing classmap…');

		// We don't want all the Composer stuff, so we'll be copying
		// bits over as needed.
		$vendor_old = static::$_working_dir . 'vendor/';
		$vendor_new = static::$_working_dir . 'lib/';
		v_file::mkdir($vendor_new, 0755);

		// Parse the map.
		$raw = \file_get_contents("{$vendor_old}composer/autoload_static.php");
		if (
			(false === ($start = \strpos($raw, '$classMap ='))) ||
			(false === ($end = \strpos($raw, ');', $start)))
		) {
			log::error('Could not parse classmap.');
		}

		$map = \substr($raw, $start, ($end - $start + 2));
		$map = \str_replace("__DIR__ . '/..' . ", '', $map);
		// phpcs:disable
		eval($map);
		//phpcs:enable

		// Run through each entry, moving the source and generating a
		// new map entry.
		$out = array();
		foreach ($classMap as $k=>$v) {
			// Move the files out of the original location.
			$subdir = \explode('/', \ltrim($v, '/'));
			$subdir = \array_shift($subdir);
			if (\file_exists("{$vendor_old}{$subdir}")) {
				\rename("{$vendor_old}{$subdir}", "{$vendor_new}{$subdir}");
			}

			$classMap[$k] = '/lib/' . \ltrim($v, '/');
			$out[] = "'" . \addslashes($k) . "'=>'phar://' . \$blobcommon_phar . '/" . \addslashes(\ltrim($classMap[$k], '/')) . "'";
		}

		log::print('Cleaning up…');

		// Don't need the old vendor directory any more.
		v_file::rmdir($vendor_old);

		// We also don't need any shitlist files.
		$files = v_file::scandir(static::$_working_dir);
		$shitlist = io::SHITLIST;
		$shitlist[] = '#/LICENSE$#';
		foreach ($files as $v) {
			if (io::is_shitlist($v, $shitlist)) {
				if (\is_dir($v)) {
					v_file::rmdir($v);
				}
				else {
					\unlink($v);
				}
			}
		}

		log::print('Compressing PHP…');

		$files = v_file::scandir($vendor_new);
		foreach ($files as $v) {
			if (
				('.php' === \substr($v, -4)) ||
				// Remember blob-phone stores its classes with a .txt
				// extension to avoid bloating an optimized classmap
				// file.
				\preg_match('#/data[A-Z]{2}.txt$#', $v)
			) {
				\file_put_contents($v, \php_strip_whitespace($v));
			}
		}

		log::print('Compiling stubs…');

		// The main one first.
		static::$stub_common = \file_get_contents("{$skel_dir}common_index.template");
		static::$stub_common = \str_replace(
			'CLASSMAP',
			"\n\t" . \implode(",\n\t", $out) . "\n",
			static::$stub_common
		);

		// Our test file.
		static::$stub_test = \file_get_contents("{$skel_dir}test_index.template");
	}
155480
protected function addFavicon()
	{
		// Get the default value in config file if not manually defined
		$favicon = ($this->favicon) ? $this->favicon : $this->getConfig('favicon');

		// Check if value is not empty
		if ($favicon)
		{
			// Check if .ico file exists
			if (File::exists(public_path($favicon.'.ico')))
			{
				$this->addOneLink('shortcut icon', asset($favicon.'.ico'));
				$this->addOneLink('icon', asset($favicon.'.ico'), 'image/x-icon');
			}

			// Check if .png file exists
			if (File::exists(public_path($favicon.'.png')))
			{
				$this->addOneLink('icon', asset($favicon.'.png'), 'image/png');
			}
		}
	}
1012411
def generate_static_site(self, output_root=None, extra_context=None):
        
        self.app.config['BUILD_PATH'] = output_root

        # use this hook for registering URLs to freeze
        self.call_hook("generate", self, output_root, extra_context)

        if output_root is not None:
            # realpath or this gets generated relative to the tarbell package
            self.app.config['FREEZER_DESTINATION'] = os.path.realpath(output_root)

        self.freezer.freeze()
1064550
def _construct_pillar(top_dir,
                      follow_dir_links,
                      keep_newline=False,
                      render_default=None,
                      renderer_blacklist=None,
                      renderer_whitelist=None,
                      template=False):
    '''
    
    '''
    pillar = {}
    renderers = salt.loader.render(__opts__, __salt__)

    norm_top_dir = os.path.normpath(top_dir)
    for dir_path, dir_names, file_names in salt.utils.path.os_walk(
            top_dir, topdown=True, onerror=_on_walk_error,
            followlinks=follow_dir_links):
        # Find current path in pillar tree
        pillar_node = pillar
        norm_dir_path = os.path.normpath(dir_path)
        prefix = os.path.relpath(norm_dir_path, norm_top_dir)
        if norm_dir_path != norm_top_dir:
            path_parts = []
            head = prefix
            while head:
                head, tail = os.path.split(head)
                path_parts.insert(0, tail)
            while path_parts:
                pillar_node = pillar_node[path_parts.pop(0)]

        # Create dicts for subdirectories
        for dir_name in dir_names:
            pillar_node[dir_name] = {}

        # Add files
        for file_name in file_names:
            file_path = os.path.join(dir_path, file_name)
            if not os.path.isfile(file_path):
                log.error('file_tree: %s: not a regular file', file_path)
                continue

            contents = b''
            try:
                with salt.utils.files.fopen(file_path, 'rb') as fhr:
                    buf = fhr.read(__opts__['file_buffer_size'])
                    while buf:
                        contents += buf
                        buf = fhr.read(__opts__['file_buffer_size'])
                    if contents.endswith(b'\n') \
                            and _check_newline(prefix,
                                               file_name,
                                               keep_newline):
                        contents = contents[:-1]
            except (IOError, OSError) as exc:
                log.error('file_tree: Error reading %s: %s',
                          file_path,
                          exc.strerror)
            else:
                data = contents
                if template is True:
                    data = salt.template.compile_template_str(template=salt.utils.stringutils.to_unicode(contents),
                                                              renderers=renderers,
                                                              default=render_default,
                                                              blacklist=renderer_blacklist,
                                                              whitelist=renderer_whitelist)
                if salt.utils.stringio.is_readable(data):
                    pillar_node[file_name] = data.getvalue()
                else:
                    pillar_node[file_name] = data

    return pillar
783306
def make_app(httpd_config):
    
    #mimetypes.add_type('image/vnd.microsoft.icon', '.ico')

    # Default paths to serve static file from
    htdocs_paths = [
        os.path.realpath(os.path.join(config.config_dir, "htdocs")),
        os.path.join(os.path.dirname(config.__file__), "data", "htdocs"),
    ]

    return (Router()
        .add_route("/", controller=redirect, to="/static/index.html")
        .add_route("/favicon.ico", controller=redirect, to="/static/favicon.ico")
        .add_route("/static/{filepath:.+}", controller=StaticFolders(htdocs_paths))
        .add_route("/json/{action}", controller=JsonController(**httpd_config.json))
    )
330021
def retrieve_static_files(dir, dot_static_files)
      theme_static_files = []
      dot_static_files.each do |file|
        theme_static_files << StaticFile.new(@site, dir, "/", file)
      end
      site.static_files.concat(theme_static_files)
    end
180433
def interlink_static_files(generator):
    ''''''
    if generator.settings['STATIC_PATHS'] != []:
        return                               # customized STATIC_PATHS
    try: # minimize attr lookup
        static_content = generator.context['static_content']
    except KeyError:
        static_content = generator.context['filenames']
    relpath = relpath_to_site(generator.settings['DEFAULT_LANG'], _MAIN_LANG)
    for staticfile in _MAIN_STATIC_FILES:
        if staticfile.get_relative_source_path() not in static_content:
            staticfile = copy(staticfile) # prevent override in main site
            staticfile.override_url = posixpath.join(relpath, staticfile.url)
            try:
                generator.add_source_path(staticfile, static=True)
            except TypeError:
                generator.add_source_path(staticfile)
901064
public function createAsset()
    {
        $css    = BASE_PATH."/public/css/";
        $js     = BASE_PATH."/public/js/";
        $source = realpath(__DIR__ . '/../assets/');
        $css_file   = file_get_contents($source."/jquery.bootgrid.css");
        $js_file    = file_get_contents($source."/jquery.bootgrid.js");
        $fajs_file  = file_get_contents($source."/jquery.bootgrid.fa.js");
        $fc = fopen($css."jquery.bootgrid.css", "w");
        fwrite($fc, $css_file);
        fclose($fc);
        $fj = fopen($js."jquery.bootgrid.js", "w");
        fwrite($fj, $js_file);
        fclose($fj);
        $fa = fopen($js."jquery.bootgrid.fa.js", "w");
        fwrite($fa, $fajs_file);
        fclose($fa);
    }
548479
def static(self, uri, file_or_directory, *args, **kwargs):
        
        static = FutureStatic(uri, file_or_directory, args, kwargs)
        self.statics.append(static)