Skip to content
Browse files

Fix 677449 - Removes existing directories if present.

Since the script now always rebuild everything, rebuild.sh is not needed anymore.
  • Loading branch information...
1 parent 961445d commit ee38423b4b06a018aa0835403a47a16855d99431 @rik rik committed with tofumatt Oct 3, 2011
Showing with 7 additions and 12 deletions.
  1. +0 −3 README.markdown
  2. +0 −7 rebuild.sh
  3. +7 −2 scrape.py
View
3 README.markdown
@@ -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]:
View
7 rebuild.sh
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-mkdir -p html
-rm -rf ./html/*
-./scrape.py --output-dir html
-
-echo 'Rebuilt nightly site.'
View
9 scrape.py
@@ -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'] +
@@ -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}))

0 comments on commit ee38423

Please sign in to comment.
Something went wrong with that request. Please try again.