From da29da5c66a57b48e8baa864ecfc8cc8773a0707 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Thu, 10 Oct 2013 23:42:03 -0400 Subject: [PATCH] More updates to allow for static snapshotting. --- .gitignore | 1 + seo-snapshots/make_snapshot.py | 25 ++++++++++++++++++++----- static/js/controllers.js | 2 ++ static/partials/plans.html | 2 +- static/partials/repo-list.html | 2 +- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index beed9c400..2befc02c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc venv .elasticbeanstalk/ +static/snapshots/ \ No newline at end of file diff --git a/seo-snapshots/make_snapshot.py b/seo-snapshots/make_snapshot.py index 75ab0be9d..21ec3f7ab 100644 --- a/seo-snapshots/make_snapshot.py +++ b/seo-snapshots/make_snapshot.py @@ -1,18 +1,30 @@ import subprocess import urllib +import os +import logging from BeautifulSoup import BeautifulSoup -BASE_URL = 'http://localhost:5000' -OUTPUT_PATH = 'snapshots/' +logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.DEBUG) + + +BASE_URL = 'http://localhost:5000/' +OUTPUT_PATH = '../static/snapshots/' URLS = [ - ('/', 'index.html') + '', + 'guide/', + 'plans/', + 'repository/', ] -for url, output in URLS: +for url in URLS: final_url = BASE_URL + url + to_write = OUTPUT_PATH + url + 'index.html' + + logger.info('Snapshotting url: %s -> %s' % (final_url, to_write)) out_html = subprocess.check_output(['phantomjs', 'phantomjs-runner.js', final_url]) @@ -23,7 +35,10 @@ for url, output in URLS: for item in to_extract: item.extract() - to_write = OUTPUT_PATH + output + to_write_dir = os.path.dirname(to_write) + + if not os.path.exists(to_write_dir): + os.makedirs(to_write_dir) with open(to_write, 'w') as output_file: output_file.write(soup.prettify()) \ No newline at end of file diff --git a/static/js/controllers.js b/static/js/controllers.js index f297c9282..f84d283be 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -91,6 +91,8 @@ function PlansCtrl($scope, UserService, PlanService) { $('#signinModal').modal({}); } }; + + $scope.status = 'ready'; } function GuideCtrl($scope) { diff --git a/static/partials/plans.html b/static/partials/plans.html index b1c8c0236..5c92ad3c3 100644 --- a/static/partials/plans.html +++ b/static/partials/plans.html @@ -1,4 +1,4 @@ -
+
Plans & Pricing
diff --git a/static/partials/repo-list.html b/static/partials/repo-list.html index 7350559c0..9bb340d81 100644 --- a/static/partials/repo-list.html +++ b/static/partials/repo-list.html @@ -2,7 +2,7 @@
-
+

Your Repositories