More updates to allow for static snapshotting.
This commit is contained in:
parent
785995b473
commit
da29da5c66
5 changed files with 25 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
venv
|
venv
|
||||||
.elasticbeanstalk/
|
.elasticbeanstalk/
|
||||||
|
static/snapshots/
|
|
@ -1,18 +1,30 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib
|
import urllib
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
BASE_URL = 'http://localhost:5000'
|
logger = logging.getLogger(__name__)
|
||||||
OUTPUT_PATH = 'snapshots/'
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
BASE_URL = 'http://localhost:5000/'
|
||||||
|
OUTPUT_PATH = '../static/snapshots/'
|
||||||
|
|
||||||
URLS = [
|
URLS = [
|
||||||
('/', 'index.html')
|
'',
|
||||||
|
'guide/',
|
||||||
|
'plans/',
|
||||||
|
'repository/',
|
||||||
]
|
]
|
||||||
|
|
||||||
for url, output in URLS:
|
for url in URLS:
|
||||||
final_url = BASE_URL + url
|
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',
|
out_html = subprocess.check_output(['phantomjs', 'phantomjs-runner.js',
|
||||||
final_url])
|
final_url])
|
||||||
|
@ -23,7 +35,10 @@ for url, output in URLS:
|
||||||
for item in to_extract:
|
for item in to_extract:
|
||||||
item.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:
|
with open(to_write, 'w') as output_file:
|
||||||
output_file.write(soup.prettify())
|
output_file.write(soup.prettify())
|
|
@ -91,6 +91,8 @@ function PlansCtrl($scope, UserService, PlanService) {
|
||||||
$('#signinModal').modal({});
|
$('#signinModal').modal({});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.status = 'ready';
|
||||||
}
|
}
|
||||||
|
|
||||||
function GuideCtrl($scope) {
|
function GuideCtrl($scope) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="container plans">
|
<div class="container plans ready-indicator" data-status="{{ status }}">
|
||||||
<div class="callout">
|
<div class="callout">
|
||||||
Plans & Pricing
|
Plans & Pricing
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<i class="icon-spinner icon-spin icon-3x"></i>
|
<i class="icon-spinner icon-spin icon-3x"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container" ng-show="!loading">
|
<div class="container ready-indicator" ng-show="!loading" data-status="{{ loading ? '' : 'ready' }}">
|
||||||
<div class="repo-list" ng-show="!user.anonymous">
|
<div class="repo-list" ng-show="!user.anonymous">
|
||||||
<h3>Your Repositories</h3>
|
<h3>Your Repositories</h3>
|
||||||
<div ng-show="private_repositories.length > 0">
|
<div ng-show="private_repositories.length > 0">
|
||||||
|
|
Reference in a new issue