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
|
||||
venv
|
||||
.elasticbeanstalk/
|
||||
static/snapshots/
|
|
@ -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())
|
|
@ -91,6 +91,8 @@ function PlansCtrl($scope, UserService, PlanService) {
|
|||
$('#signinModal').modal({});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.status = 'ready';
|
||||
}
|
||||
|
||||
function GuideCtrl($scope) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="container plans">
|
||||
<div class="container plans ready-indicator" data-status="{{ status }}">
|
||||
<div class="callout">
|
||||
Plans & Pricing
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<i class="icon-spinner icon-spin icon-3x"></i>
|
||||
</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">
|
||||
<h3>Your Repositories</h3>
|
||||
<div ng-show="private_repositories.length > 0">
|
||||
|
|
Reference in a new issue