Permalink
Browse files

chore(build): refactor update angular and run tests

  • Loading branch information...
1 parent eb20057 commit b4e286767396e670dd2c0f8d496f2a6a4a992fed @tbosch tbosch committed Jan 7, 2014
Showing with 102 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +52 −0 app/index-async.html.template
  3. +32 −0 scripts/test-all.sh
  4. +16 −0 { → scripts}/update-angular.sh
View
@@ -2,4 +2,5 @@ logs/*
!.gitkeep
node_modules/
tmp
-.DS_Store
+.DS_Store
+.idea
@@ -0,0 +1,52 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <style>
+ [ng-cloak] {
+ display: none;
+ }
+ </style>
+ <script>
+ // include angular loader, which allows the files to load in any order
+ @@NG_LOADER@@
+
+ // include a third-party async loader library
+ /*!
+ * $script.js v1.3
+ * https://github.com/ded/script.js
+ * Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
+ * Follow our software http://twitter.com/dedfat
+ * License: MIT
+ */
+ !function(a,b,c){function t(a,c){var e=b.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){e[m]&&!/^c|loade/.test(e[m])||f||(e.onload=e[o]=null,f=1,c())},e.async=1,e.src=a,d.insertBefore(e,d.firstChild)}function q(a,b){p(a,function(a){return!b(a)})}var d=b.getElementsByTagName("head")[0],e={},f={},g={},h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange",p=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1};!b[m]&&b[n]&&(b[n](l,function r(){b.removeEventListener(l,r,j),b[m]="complete"},j),b[m]="loading");var s=function(a,b,d){function o(){if(!--m){e[l]=1,j&&j();for(var a in g)p(a.split("|"),n)&&!q(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[k]?a:[a];var i=b&&b.call,j=i?b:d,l=i?a.join(""):b,m=a.length;c(function(){q(a,function(a){h[a]?(l&&(f[l]=1),o()):(h[a]=1,l&&(f[l]=1),t(s.path?s.path+a+".js":a,o))})},0);return s};s.get=t,s.ready=function(a,b,c){a=a[k]?a:[a];var d=[];!q(a,function(a){e[a]||d[k](a)})&&p(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][k](b),c&&c(d)}(a.join("|"));return s};var u=a.$script;s.noConflict=function(){a.$script=u;return this},typeof module!="undefined"&&module.exports?module.exports=s:a.$script=s}(this,document,setTimeout)
+
+ // load all of the dependencies asynchronously.
+ $script([
+ 'lib/angular/angular.js',
+ 'lib/angular/angular-route.js',
+ 'js/app.js',
+ 'js/services.js',
+ 'js/controllers.js',
+ 'js/filters.js',
+ 'js/directives.js'
+ ], function() {
+ // when all is done, execute bootstrap angular application
+ angular.bootstrap(document, ['myApp']);
+ });
+ </script>
+ <title>My AngularJS App</title>
+ <link rel="stylesheet" href="css/app.css">
+</head>
+<body ng-cloak>
+ <ul class="menu">
+ <li><a href="#/view1">view1</a></li>
+ <li><a href="#/view2">view2</a></li>
+ </ul>
+
+ <div ng-view></div>
+
+ <div>Angular seed app: v<span app-version></span></div>
+
+</body>
+</html>
View
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -ex
+
+function cleanUp() {
+ kill $WEBSERVER_PID
+}
+
+trap cleanUp EXIT
+
+# Define reasonable set of browsers in case we are running manually from commandline
+if [[ -z "$BROWSERS" ]]
+then
+ BROWSERS="Chrome"
+fi
+
+if [[ -z "$BROWSERS_E2E" ]]
+then
+ BROWSERS_E2E="Chrome"
+fi
+
+ROOT_DIR=`dirname $0`/..
+
+cd $ROOT_DIR
+npm install
+
+./scripts/web-server.js > /dev/null &
+WEBSERVER_PID=$!
+
+
+./node_modules/karma/bin/karma start config/karma.conf.js --single-run --browsers $BROWSERS --reporters=dots --no-colors --no-color
+./node_modules/karma/bin/karma start config/karma-e2e.conf.js --browsers $BROWSERS_E2E --reporters=dots --no-colors --no-color
@@ -5,6 +5,12 @@ if [[ ! -e "$NG_BUILD_DIR/angular.js" ]]; then
exit 1
fi
+SCRIPT_DIR=$(dirname $0)
+ROOT_DIR=$SCRIPT_DIR/../
+VERSION=$(cat $NG_BUILD_DIR/version.txt)
+
+cd $ROOT_DIR
+
rm -fr app/lib/angular
mkdir app/lib/angular
cp -r $NG_BUILD_DIR/* app/lib/angular
@@ -13,3 +19,13 @@ rm app/lib/angular/*.zip
mv app/lib/angular/angular-mocks.js test/lib/angular
mv app/lib/angular/angular-scenario.js test/lib/angular
cp app/lib/angular/version.txt test/lib/angular
+
+# Update the inlined angular-loader in app/index-async.html
+sed '/@@NG_LOADER@@/{
+ s/@@NG_LOADER@@//g
+ r app/lib/angular/angular-loader.min.js
+}' app/index-async.html.template > app/index-async.html
+
+git add $ROOT_DIR/app
+git add $ROOT_DIR/test
+git commit -m "update(angular): bump to $VERSION"

0 comments on commit b4e2867

Please sign in to comment.