Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Fix 677449 - Removes existing directories if present.
Browse files Browse the repository at this point in the history
Since the script now always rebuild everything, rebuild.sh is not needed anymore.
  • Loading branch information
rik authored and tofumatt committed Oct 3, 2011
1 parent 961445d commit ee38423
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
3 changes: 0 additions & 3 deletions README.markdown
Expand Up @@ -15,9 +15,6 @@ server.

./scrape.py --output-dir html

You can use `rebuild.sh` to automatically remove the `html` directory
and rebuild the site if you're developing.

License
-------
This software is licensed under the [Mozilla Tri-License][MPL]:
Expand Down
7 changes: 0 additions & 7 deletions rebuild.sh

This file was deleted.

9 changes: 7 additions & 2 deletions scrape.py
Expand Up @@ -211,6 +211,9 @@ def main():
"""Function run when script is run from the command line."""
template = ENV.get_template('index.html')

if not os.path.exists(OUTPUT_PATH):
os.makedirs(OUTPUT_PATH)

for group in files:
for build in group['builds']:
f = urllib2.urlopen(group['base_url'] + build['url'] +
Expand All @@ -231,8 +234,10 @@ def main():
buildJSON(group['builds']))

for folder in ['css', 'fonts', 'img', 'js']:
shutil.copytree(os.path.join(CURRENT_PATH, folder),
os.path.join(CURRENT_PATH, OUTPUT_PATH, folder))
folder_path = os.path.join(CURRENT_PATH, OUTPUT_PATH, folder)
if os.path.exists(folder_path):
shutil.rmtree(folder_path)
shutil.copytree(os.path.join(CURRENT_PATH, folder), folder_path)

write_output(OUTPUT_PATH, 'index.html', template.render({'files': files}))

Expand Down

0 comments on commit ee38423

Please sign in to comment.