diff options
| author | Igor Minar | 2012-08-20 08:28:04 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-08-24 15:00:36 -0700 |
| commit | 60a12b416104697d48a465bffbcfefbec35f06ea (patch) | |
| tree | 90ef6410ab0bcd569a7d746e6d55f36eb6020308 /docs/src/templates/docs-scenario.html | |
| parent | cd7e58ba41eb886be2195e886f57521c568cb0a4 (diff) | |
| download | angular.js-60a12b416104697d48a465bffbcfefbec35f06ea.tar.bz2 | |
chore(docs): use GAE and Google CDN for docs
Short summary: if you use local node server everything should work as before,
if you use GAE, everything should work now as well, but we pull assets from CDN.
- GAE doesn't support ':' in filenames, so I had to replace it with '_'
but only in the filename, all servers were reconfigured to rewrite the
urls from : to _ when doing file lookup
- We now pull angular assets from google CDN when deployed on GAE (locally
or in production). When running on a non GAE server we pull assets from
../ directory as before
- Since only certain versions of Angular are available on CDN and we want
to be able to autodeploy docs, I had to pin down the Angular files
to a "stable" version when running on GAE
Diffstat (limited to 'docs/src/templates/docs-scenario.html')
| -rw-r--r-- | docs/src/templates/docs-scenario.html | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/docs/src/templates/docs-scenario.html b/docs/src/templates/docs-scenario.html index 49b9bf89..f1816947 100644 --- a/docs/src/templates/docs-scenario.html +++ b/docs/src/templates/docs-scenario.html @@ -2,8 +2,43 @@ <html xmlns:ng="http://angularjs.org"> <head> <title>AngularJS Docs E2E Test Runner</title> - <script type="text/javascript" src="../angular-scenario.js" ng:autotest></script> - <script type="text/javascript" src="docs-scenario.js"></script> + <script> + var gae = (location.pathname.split('/').length == 2), + headEl = document.head, + angularVersion = { + current: '"NG_VERSION_FULL"', // rewrite during build + stable: '"NG_VERSION_STABLE"' + }; + + addTag('script', {src: path('angular-scenario.js')}, function() { + addTag('script', {src: 'docs-scenario.js'}, function() { + angular.scenario.setUpAndRun(); + }); + }); + + function addTag(name, attributes, callback) { + var el = document.createElement(name), + attrName; + + for (attrName in attributes) { + el.setAttribute(attrName, attributes[attrName]); + } + + if (callback) { + el.onload = callback; + } + + headEl.appendChild(el); + } + + + function path(name) { + return gae + ? 'http://code.angularjs.org/' + angularVersion.stable + '/' + + name.replace(/\.js$/, '-' + angularVersion.stable + '.js') + : '../' + name; + } + </script> </head> <body> </body> |
