From 60a12b416104697d48a465bffbcfefbec35f06ea Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 20 Aug 2012 08:28:04 -0700 Subject: [PATCH] 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 --- Rakefile | 13 ++++- docs/src/gen-docs.js | 7 ++- docs/src/templates/app.yaml | 66 ++++++++++++++++++++++++++ docs/src/templates/docs-scenario.html | 39 ++++++++++++++- docs/src/templates/favicon.ico | Bin 0 -> 1150 bytes docs/src/templates/index.html | 21 +++++++- docs/src/templates/index.yaml | 12 +++++ lib/nodeserver/server.js | 4 ++ version.yaml | 1 + 9 files changed, 157 insertions(+), 6 deletions(-) create mode 100644 docs/src/templates/app.yaml create mode 100644 docs/src/templates/favicon.ico create mode 100644 docs/src/templates/index.yaml diff --git a/Rakefile b/Rakefile index 9c18da9d..f887237b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,12 +19,13 @@ task :init do v = YAML::load( File.open( 'version.yaml' ) ) match = v['version'].match(/^([^-]*)(-snapshot)?$/) - NG_VERSION = Struct.new(:full, :major, :minor, :dot, :codename). + NG_VERSION = Struct.new(:full, :major, :minor, :dot, :codename, :stable). new(match[1] + (match[2] ? ('-' + %x(git rev-parse HEAD)[0..7]) : ''), match[1].split('.')[0], match[1].split('.')[1], match[1].split('.')[2].sub(/\D+.*$/, ''), - v['codename']) + v['codename'], + v['stable']) end @@ -115,6 +116,14 @@ task :docs => [:init] do rewrite_file(path_to('docs/.htaccess')) do |content| content.sub!('"NG_VERSION_FULL"', NG_VERSION.full) end + rewrite_file(path_to('docs/index.html')) do |content| + content.sub!('"NG_VERSION_FULL"', NG_VERSION.full). + sub!('"NG_VERSION_STABLE"', NG_VERSION.stable) + end + rewrite_file(path_to('docs/docs-scenario.html')) do |content| + content.sub!('"NG_VERSION_FULL"', NG_VERSION.full). + sub!('"NG_VERSION_STABLE"', NG_VERSION.stable) + end end diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js index 2f72f404..67923fbc 100755 --- a/docs/src/gen-docs.js +++ b/docs/src/gen-docs.js @@ -21,7 +21,8 @@ writer.makeDir('build/docs/syntaxhighlighter').then(function() { var fileFutures = []; docs.forEach(function(doc){ // this hack is here because on OSX angular.module and angular.Module map to the same file. - var id = doc.id.replace('angular.Module', 'angular.IModule'); + var id = doc.id.replace('angular.Module', 'angular.IModule'). + replace(':', '_'); // rewrite : to _ to be GAE-friendly fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html())); }); @@ -89,6 +90,10 @@ function writeTheRest(writesFuture) { writesFuture.push(writer.copyTpl('font/fontawesome-webfont.svgz')); writesFuture.push(writer.copyTpl('font/fontawesome-webfont.ttf')); writesFuture.push(writer.copyTpl('font/fontawesome-webfont.woff')); + + writesFuture.push(writer.copyTpl('app.yaml')); + writesFuture.push(writer.copyTpl('index.yaml')); + writesFuture.push(writer.copyTpl('favicon.ico')); } diff --git a/docs/src/templates/app.yaml b/docs/src/templates/app.yaml new file mode 100644 index 00000000..c204b150 --- /dev/null +++ b/docs/src/templates/app.yaml @@ -0,0 +1,66 @@ +application: docs-angularjs-org +version: 1 +runtime: python27 +api_version: 1 +threadsafe: yes +default_expiration: "2h" + +handlers: +- url: / + static_files: index.html + upload: index.html + +- url: /appcache.manifest + static_files: appcache.manifest + upload: appcache\.manifest + +- url: /docs-scenario.html + static_files: docs-scenario.html + upload: docs-scenario\.html + +- url: /docs-scenario.js + static_files: docs-scenario.js + upload: docs-scenario\.js + +- url: /favicon\.ico + static_files: favicon.ico + upload: favicon\.ico + +- url: /robots.txt + static_files: robots.txt + upload: robots\.txt + +- url: /sitemap.xml + static_files: sitemap.xml + upload: sitemap\.xml + +- url: /css + static_dir: css + +- url: /font + static_dir: font + +- url: /img + static_dir: img + +- url: /js + static_dir: js + +- url: /partials/(.+):(.+) + static_files: partials/\1_\2 + upload: partials/.* + +- url: /partials + static_dir: partials + +- url: /syntaxhighlighter + static_dir: syntaxhighlighter + +- url: /.* + static_files: index.html + upload: index.html + + +libraries: +- name: webapp2 + version: "2.5.1" 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 @@ AngularJS Docs E2E Test Runner - - + diff --git a/docs/src/templates/favicon.ico b/docs/src/templates/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..fe24a63a6ba4c4b4fb0e960abb60e51dc9097d43 GIT binary patch literal 1150 zcmZuxZAep57(QaqUkSemBP}6IGixM-R$2;?eQEiH)}M%sFz|;4MNX|WiYN&)b(!;H z6Y*nt*TibqTMgRG)HS!ek&a*=1h9&ehx^|5d7kq==bVdB5WYh~ z5Pn9Zl1&JOBZT5`;1tgM&*K3h{B8XO04Pv69FAiQqf%+L-x}R+cT}L7K)Hp5g#({H zs)ujg7~xW4RgiVK6Q0-0+&Z1^>C)0tWFQR5EiNv`j*gB=t1D>k=&rAj6sm=NVV@x` zw2hCPj4lwp82qEx>mRPHtc3aV7>%aNIw8HBkub*N2zEW5@azt2gMusxh+8R_*=)Y< z8=bRvJutLfX4G3b|p{YRzFR?!H&x@}p?E$;po?|kZ?qnve^}WB- z4mRsN9Ew)M*>nl7U3gmR!xE0m1>G<`JzX|FKGB*SHR01IKAcZw@!XtnuR;$E^#jn_ zB7;5QtJ(ygeY^|so_h9fSglM7om_(_976-Yz&vAx!9fa&&aBlY_#=rOpwVb3X$NB# zL~g_vWg3C__e!);o8Sd8VxX1ul+kDuzL7I*^-Y>1J_;gMx#WE_a1pONsV9-NO$>#n zBv32t<%SgRXIPfK>)nHR-y~wL8ac%ns>*5ZLYf+~Q@=oRY&%@ak;0?