From 64f3d1c51ce2cad82eb76c975b8f8d46874ae884 Mon Sep 17 00:00:00 2001 From: David Haglund Date: Wed, 18 Jul 2012 16:59:09 +0200 Subject: [PATCH] changing the app name to githubContributors (costing 2 more lines) --- README.md | 2 +- app/index-e2e.html | 2 +- app/index.html | 2 +- app/js/app.js | 2 +- app/js/services.js | 32 +++++++++++++++++--------------- scripts/create-e2e-html.sh | 2 +- test/e2e/app-e2e.js | 2 +- test/e2e/scenarios.js | 1 - test/unit/controllersSpec.js | 2 +- 9 files changed, 24 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 903630f..36a3f9d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Known differenses between this port and the original app: * No pluralization of the word _contributor_ in the on hover title, of the contributors thumbs. * One more json query to GitHub, 4 instead of 3. -* Fewer lines of javascript code, 91 compared to 387, excluding lines +* Fewer lines of javascript code, 93 compared to 387, excluding lines with comments and empty lines! Demo diff --git a/app/index-e2e.html b/app/index-e2e.html index 76c4697..e15e49c 100644 --- a/app/index-e2e.html +++ b/app/index-e2e.html @@ -1,5 +1,5 @@ - + diff --git a/app/index.html b/app/index.html index faa59d2..a2d4c49 100644 --- a/app/index.html +++ b/app/index.html @@ -1,5 +1,5 @@ - + diff --git a/app/js/app.js b/app/js/app.js index d0f158e..7e3c859 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -34,7 +34,7 @@ /*globals angular,SearchCtrl */ // Declare app level module which depends on filters, and services -angular.module('ghContrib', ['ghContrib.services']). +angular.module('githubContributors', ['githubContributors.services']). config(['$routeProvider', function ($routeProvider) { 'use strict'; $routeProvider.when('/', { diff --git a/app/js/services.js b/app/js/services.js index 150a76d..d58d9ee 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -33,20 +33,22 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. /*globals angular */ -angular.module('ghContrib.services', ['ngResource'], function ($provide) { - 'use strict'; - $provide.factory('githubResource', function ($resource) { - return $resource('https://api.github.com/:query/:user/:repo/:spec', { - 'query': 'users', - 'user': 'angular', - 'repo': 'repos', - 'spec': '', - 'callback': 'JSON_CALLBACK', - 'per_page': 100 - }, { - 'get': { - 'method': 'JSONP' - } +angular.module('githubContributors.services', ['ngResource'], + function ($provide) { + 'use strict'; + $provide.factory('githubResource', function ($resource) { + return $resource('https://api.github.com/:query/:user/:repo/:spec', + { + 'query': 'users', + 'user': 'angular', + 'repo': 'repos', + 'spec': '', + 'callback': 'JSON_CALLBACK', + 'per_page': 100 + }, { + 'get': { + 'method': 'JSONP' + } + }); }); }); -}); diff --git a/scripts/create-e2e-html.sh b/scripts/create-e2e-html.sh index 709312d..cd1e3a9 100755 --- a/scripts/create-e2e-html.sh +++ b/scripts/create-e2e-html.sh @@ -4,7 +4,7 @@ infile=$1 dir=`dirname $infile` outfile=$dir/index-e2e.html -sed -e 's/ng-app="ghContrib"/ng-app="ghContribE2E"/' \ +sed -e 's/ng-app="githubContributors"/ng-app="githubContributorsE2E"/' \ -e '/lib\/angular\/angular.js/a \ ' -e '/js\/app.js/a \ diff --git a/test/e2e/app-e2e.js b/test/e2e/app-e2e.js index 8252ae2..df8aeb2 100644 --- a/test/e2e/app-e2e.js +++ b/test/e2e/app-e2e.js @@ -1,6 +1,6 @@ /*globals angular,githubResponses */ -angular.module('ghContribE2E', ['ghContrib', 'ngMockE2E']) +angular.module('githubContributorsE2E', ['githubContributors', 'ngMockE2E']) .run(function ($httpBackend) { 'use strict'; $httpBackend.whenGET(/^partials\/[\s]*/).passThrough(); diff --git a/test/e2e/scenarios.js b/test/e2e/scenarios.js index 728322c..a043aca 100644 --- a/test/e2e/scenarios.js +++ b/test/e2e/scenarios.js @@ -141,7 +141,6 @@ describe('GitHub Contributors with mocked data', function () { expect(element('li:nth-child(3) .repo-forks').text()) .toMatch(/\bFork\b/); }); - }); describe('user bar (no name, and 1 repo and 1 follower)', function () { diff --git a/test/unit/controllersSpec.js b/test/unit/controllersSpec.js index 39517ab..c28d562 100644 --- a/test/unit/controllersSpec.js +++ b/test/unit/controllersSpec.js @@ -45,7 +45,7 @@ describe('GitHub Contributors controllers', function () { expect(scope[model].other).toEqual(other); } - beforeEach(module('ghContrib.services')); + beforeEach(module('githubContributors.services')); beforeEach(inject( function ($rootScope, $controller, $routeParams, $httpBackend) { rootScope = $rootScope;