Skip to content

Commit

Permalink
Updated dependencies.
Browse files Browse the repository at this point in the history
Updated dependencies. Major change: update to angular v3.
Needed to resolve breaking changes concerning interceptors.

Also, the new vendorServices fuctionality does to work for the unit tests (since the unit tests use files from the /src dir).
WIP: started reconfiguring karma so that tests are run on files in the /build dir (i.e. processed files!)
  • Loading branch information
atruskie committed Oct 29, 2014
1 parent 95875df commit 7f3d10e
Show file tree
Hide file tree
Showing 13 changed files with 316 additions and 336 deletions.
37 changes: 18 additions & 19 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@
"name": "ng-boilerplate",
"version": "0.0.18",
"devDependencies": {
"angular": "1.2.x",
"angular-mocks": "~1.2.x",
"angular-route": "~1.2.x",
"angular-resource": "~1.2.x",
"angular": "1.3.x",
"angular-bootstrap": "~0.11.0",
"angular-ui-router": "~0.2.x",
"angular-growl-v2": "~0.7.0",
"angular-local-storage": "~0.1.x",
"angular-mocks": "~1.3.x",
"angular-resource": "~1.3.x",
"angular-route": "~1.3.x",
"angular-sanitize": "~1.3.x",
"angular-tags": "git://github.com/boneskull/angular-tags.git#master",
"angular-ui-utils": "latest",
"sass-bootstrap": "3.0.2",
"bowser": "0.7.x",
"draggabilly": "~1.1.x",
"hint.css": "https://github.com/chinchang/hint.css.git",
"modernizr": "~2.8.x",
"jquery-ui": "~1.10.3",
"momentjs": "~2.7.x",
"humanize-duration": "~2.0.0",
"jasmine-expect": "1.x",
"objectdiff": "https://github.com/NV/objectDiff.js.git",
"jquery-ui": "~1.11.x",
"lodash": "~2.4.x",
"angular-tags": "git://github.com/boneskull/angular-tags.git#master",
"angular-sanitize": "~1.2.x",
"draggabilly": "~1.1.x",
"bowser": "0.7.x",
"angular-growl-v2": "~0.7.0",
"angular-local-storage": "~0.0.7",
"humanize-duration": "~2.0.0"
"modernizr": "~2.8.x",
"momentjs": "~2.8.x",
"objectdiff": "https://github.com/NV/objectDiff.js.git",
"sass-bootstrap": "3.0.2"
},
"dependencies": {},
"private": true,
"resolutions": {
"angular": "1.2.24"
"angular": "1.3.0"
}
}
}
4 changes: 2 additions & 2 deletions buildConfig/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = {


// TODO: THIS IS TERRIBLE! REMOVE UI ASAP... OR AT LEAST ONLY INCLUDE RELEVANT COMPONENTS
'vendor/jquery-ui/ui/jquery-ui.js',
'vendor/jquery-ui/jquery-ui.js',

// NOTE: bootstrap css imported in application.tpl.scss
'vendor/sass-bootstrap/dist/js/bootstrap.js',
Expand Down Expand Up @@ -135,7 +135,7 @@ module.exports = {

'vendor/bowser/bowser.js',
'vendor/angular-growl-v2/build/angular-growl.js',
'vendor/angular-local-storage/angular-local-storage.js',
'vendor/angular-local-storage/dist/angular-local-storage.js',
'vendor/humanize-duration/humanize-duration.js'

],
Expand Down
4 changes: 2 additions & 2 deletions karma/karma-unit.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function (config) {
/**
* From where to look for files, starting with the location of this file.
*/
configObject.basePath = '../';
configObject.basePath = '../build';

/**
* This is the list of file patterns to load into the browser during testing.
Expand All @@ -22,7 +22,7 @@ module.exports = function (config) {
"vendor/jasmine-expect/dist/jasmine-matchers.js"
].concat(JSON.parse(fileJson).concat([
'src/**/*.js',
'src/**/*.spec.js'
'../src/**/*.spec.js'
]));

configObject.exclude = [
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
],
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-copy": "0.7.x",
"grunt-contrib-jshint": "0.10.x",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-watch": "~0.6.x",
"grunt-contrib-uglify": "0.5.x",
"grunt-karma": "0.8.x",
"grunt-contrib-uglify": "0.6.x",
"grunt-karma": "0.9.x",
"karma-chrome-launcher": "~0.1.1",
"grunt-ngmin": "0.0.3",
"grunt-html2js": "~0.2.3",
"grunt-conventional-changelog": "~1.1",
"grunt-changelog": "~0.2.x",
"grunt-bump": "0.0.14",
"grunt-bump": "0.0.16",
"grunt-contrib-connect": "0.8.x",
"connect-modrewrite": "0.7.x",
"grunt-sass": "0.14.x",
"grunt-sass": "0.16.x",
"lodash": "~2.4.1",
"karma-phantomjs-launcher": "~0.1.1",
"karma-jasmine": "~0.2.x",
Expand Down
8 changes: 4 additions & 4 deletions src/app/listen/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead'])
$scope.model.media = new Media(value.data);

var // moment works by reference - need to parse the date twice - sigh
absoluteStartChunk = moment($scope.model.media.recordedDate).add('s', parseFloat($scope.model.media.startOffset)),
absoluteEndChunk = moment($scope.model.media.recordedDate).add('s', parseFloat($scope.model.media.endOffset));
absoluteStartChunk = moment($scope.model.media.recordedDate).add(parseFloat($scope.model.media.startOffset), 's'),
absoluteEndChunk = moment($scope.model.media.recordedDate).add(parseFloat($scope.model.media.endOffset), 's');

$scope.startOffsetAbsolute = absoluteStartChunk.format("HH:mm:ss");
$scope.endOffsetAbsolute = absoluteEndChunk.format("HH:mm:ss");
Expand Down Expand Up @@ -342,7 +342,7 @@ angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead'])
if (!$scope.model.audioRecording) {
return undefined;
}
return moment($scope.model.audioRecording.recordedDate).add('s', $scope.model.audioRecording.durationSeconds).format("YYYY-MMM-DD, HH:mm:ss");
return moment($scope.model.audioRecording.recordedDate).add($scope.model.audioRecording.durationSeconds, 's').format("YYYY-MMM-DD, HH:mm:ss");
};


Expand Down Expand Up @@ -401,7 +401,7 @@ angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead'])
return undefined;
}

return moment($scope.model.media.recordedDate).add('m', $scope.jumpToMinute).format("YYYY-MMM-DD, HH:mm:ss");
return moment($scope.model.media.recordedDate).add($scope.jumpToMinute, 'm').format("YYYY-MMM-DD, HH:mm:ss");
};


Expand Down
95 changes: 0 additions & 95 deletions src/common/angular-http-auth.js

This file was deleted.

79 changes: 79 additions & 0 deletions src/components/services/angularHttpAuth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* @license HTTP Auth Interceptor Module for AngularJS
* (c) 2012 Witold Szczerba
* License: MIT
* https://github.com/witoldsz/angular-http-auth/tree/gh-pages
*/
angular.module('http-auth-interceptor', [])

.provider('authService', function () {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
var buffer = [];

/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
this.pushToBuffer = function (config, deferred) {
buffer.push({
config: config,
deferred: deferred
});
};

this.$get = ['$rootScope', '$injector', function ($rootScope, $injector) {
var $http; // initialized later because of circular dependency problem
function retry(config, deferred) {
$http = $http || $injector.get('$http');
$http(config).then(function (response) {
deferred.resolve(response);
});
}

function retryAll() {
for (var i = 0; i < buffer.length; ++i) {
retry(buffer[i].config, buffer[i].deferred);
}
buffer = [];
}

return {
loginConfirmed: function () {
console.info("authService::event:auth-loginConfirmed");
$rootScope.$broadcast('event:auth-loginConfirmed');

retryAll();
}
};
}];
})
/**
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.factory("authHttpInterceptor",
["authService", "$rootScope", "$q",
function (authServiceProvider, $rootScope, $q) {
return {
'responseError': function error(response) {
if (response.status === 401) {
var deferred = $q.defer();
authServiceProvider.pushToBuffer(response.config, deferred);

console.info("authService::event:auth-loginRequired");
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
}
// otherwise
return $q.reject(response);
}
};
}])


.config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push("authHttpInterceptor");
}]);
Loading

0 comments on commit 7f3d10e

Please sign in to comment.