Skip to content

Commit 6c51db4

Browse files
author
guylabs
committed
Restructure source and test files. Update the package.json. Update the grunt and the karma configs.
1 parent fc04569 commit 6c51db4

17 files changed

+419
-394
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
build/
1+
dist/
22
node_modules/
33
.idea
44
*.iml

Gruntfile.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,29 @@ module.exports = function (grunt) {
22

33
grunt.initConfig({
44
pkg: grunt.file.readJSON("package.json"),
5+
concat: {
6+
options: {
7+
separator: '\n'
8+
},
9+
dist: {
10+
src: [
11+
'src/angular-spring-data-rest-module.js',
12+
'src/angular-spring-data-rest-provider.js',
13+
'src/angular-spring-data-rest-interceptor-provider.js',
14+
'src/angular-spring-data-rest-utils.js',
15+
],
16+
dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.js'
17+
}
18+
},
519
uglify: {
620
options: {
721
banner: "/*!\n * <%= pkg.name %> <%= pkg.version %>\n * Copyright <%= grunt.template.today('yyyy') %> Guy Brûlé (@guy_labs)\n * https://github.com/guylabs/angular-spring-data-rest\n */\n"
822
},
9-
build: {
10-
src: "src/<%= pkg.name %>.js",
11-
dest: "build/<%= pkg.name %>.<%= pkg.version %>.min.js"
12-
}
23+
dist: {
24+
files: {
25+
'dist/<%= pkg.name %>.<%= pkg.version %>.min.js': ['<%= concat.dist.dest %>']
26+
}
27+
}
1328
},
1429
karma: {
1530
unit: {
@@ -22,10 +37,11 @@ module.exports = function (grunt) {
2237
}
2338
});
2439

40+
grunt.loadNpmTasks("grunt-contrib-concat");
2541
grunt.loadNpmTasks("grunt-contrib-uglify");
2642
grunt.loadNpmTasks("grunt-karma");
2743

28-
grunt.registerTask("default", ["karma:continuous", "uglify"]);
44+
grunt.registerTask("default", ["karma:continuous", "concat", "uglify"]);
2945

3046
grunt.registerTask("startTestServer", ["karma:unit:start"]);
3147
grunt.registerTask("runTests", ["karma:unit:run"]);

bower.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"angular",
1010
"resource",
1111
"spring",
12+
"spring data",
1213
"spring data rest",
1314
"rest",
1415
"api"
@@ -19,6 +20,9 @@
1920
"ignore": [
2021
"**/.*",
2122
"node_modules",
22-
"bower_components"
23+
"bower_components",
24+
"dist",
25+
".idea",
26+
"*.iml"
2327
]
2428
}

karma.conf.js

Lines changed: 59 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,60 @@
1-
module.exports = function(config) {
2-
config.set({
3-
4-
// base path, that will be used to resolve files and exclude
5-
basePath: '',
6-
7-
8-
// frameworks to use
9-
frameworks: ['jasmine'],
10-
11-
12-
// list of files / patterns to load in the browser
13-
files: [
14-
'lib/angular/angular.js',
15-
'lib/angular/angular-mocks.js',
16-
'lib/angular/angular-resource.js',
17-
'src/*.js',
18-
'test/*.js'
19-
],
20-
21-
22-
// list of files to exclude
23-
exclude: [
24-
25-
],
26-
27-
28-
// test results reporter to use
29-
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
30-
reporters: ['progress'],
31-
32-
33-
// web server port
34-
port: 9876,
35-
36-
37-
// enable / disable colors in the output (reporters and logs)
38-
colors: true,
39-
40-
41-
// level of logging
42-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
43-
logLevel: config.LOG_INFO,
44-
45-
46-
// enable / disable watching file and executing tests whenever any file changes
47-
autoWatch: false,
48-
49-
50-
// Start these browsers, currently available:
51-
// - Chrome
52-
// - ChromeCanary
53-
// - Firefox
54-
// - Opera
55-
// - Safari (only Mac)
56-
// - PhantomJS
57-
// - IE (only Windows)
58-
browsers: ['PhantomJS'],
59-
60-
61-
// If browser does not capture in given timeout [ms], kill it
62-
captureTimeout: 60000,
63-
64-
65-
// Continuous Integration mode
66-
// if true, it capture browsers, run tests and exit
67-
singleRun: false
68-
});
1+
module.exports = function (config) {
2+
config.set({
3+
4+
// base path, that will be used to resolve files and exclude
5+
basePath: '',
6+
7+
// frameworks to use
8+
frameworks: ['jasmine'],
9+
10+
// list of files / patterns to load in the browser
11+
files: [
12+
'lib/angular/angular.js',
13+
'lib/angular/angular-mocks.js',
14+
'lib/angular/angular-resource.js',
15+
'src/angular-spring-data-rest-module.js',
16+
'src/angular-spring-data-rest-provider.js',
17+
'src/angular-spring-data-rest-interceptor-provider.js',
18+
'src/angular-spring-data-rest-utils.js',
19+
'test/angular-spring-data-rest.helper.spec.js',
20+
'test/*.spec.js'
21+
],
22+
23+
// list of files to exclude
24+
exclude: [ ],
25+
26+
// test results reporter to use
27+
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
28+
reporters: ['progress'],
29+
30+
// web server port
31+
port: 9876,
32+
33+
// enable / disable colors in the output (reporters and logs)
34+
colors: true,
35+
36+
// level of logging
37+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
38+
logLevel: config.LOG_INFO,
39+
40+
// enable / disable watching file and executing tests whenever any file changes
41+
autoWatch: false,
42+
43+
// Start these browsers, currently available:
44+
// - Chrome
45+
// - ChromeCanary
46+
// - Firefox
47+
// - Opera
48+
// - Safari (only Mac)
49+
// - PhantomJS
50+
// - IE (only Windows)
51+
browsers: ['PhantomJS'],
52+
53+
// If browser does not capture in given timeout [ms], kill it
54+
captureTimeout: 60000,
55+
56+
// Continuous Integration mode
57+
// if true, it capture browsers, run tests and exit
58+
singleRun: false
59+
});
6960
};

package.json

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
{
2-
"name": "angular-spring-data-rest",
3-
"version": "0.1.0",
4-
"repository": {
5-
"type": "git",
6-
"url": "https://github.com/guylabs/angular-spring-data-rest.git"
7-
},
8-
"devDependencies": {
9-
"grunt": "0.4.5",
10-
"grunt-contrib-uglify": "0.5.1",
11-
"grunt-karma": "0.8.3",
12-
"karma": "0.12.22",
13-
"karma-chrome-launcher": "0.1.4",
14-
"karma-coffee-preprocessor": "0.2.1",
15-
"karma-firefox-launcher": "0.1.3",
16-
"karma-jasmine": "0.1.5",
17-
"karma-phantomjs-launcher": "0.1.3",
18-
"karma-requirejs": "0.2.2",
19-
"requirejs": "2.1.14"
20-
},
21-
"dependencies": {},
22-
"license": {
23-
"type": "MIT",
24-
"url": "https://github.com/guylabs/angular-spring-data-rest/blob/master/LICENSE"
25-
}
2+
"name": "angular-spring-data-rest",
3+
"version": "0.1.0",
4+
"description": "An AngularJS module for a Spring Data REST backend.",
5+
"keywords": ["AngularJS", "angular", "Spring", "Spring Data", "REST", "Spring Data REST"],
6+
"homepage": "https://github.com/guylabs/angular-spring-data-rest",
7+
"bugs": "https://github.com/guylabs/angular-spring-data-rest/issues",
8+
"author": {
9+
"name": "Guy Brûlé",
10+
"email": "adming@guylabs.org",
11+
"url": "http://guylabs.ch"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/guylabs/angular-spring-data-rest.git"
16+
},
17+
"devDependencies": {
18+
"grunt": "0.4.5",
19+
"grunt-contrib-uglify": "0.5.1",
20+
"grunt-contrib-concat": "0.5.0",
21+
"grunt-karma": "0.8.3",
22+
"karma": "0.12.22",
23+
"karma-chrome-launcher": "0.1.4",
24+
"karma-coffee-preprocessor": "0.2.1",
25+
"karma-firefox-launcher": "0.1.3",
26+
"karma-jasmine": "0.1.5",
27+
"karma-phantomjs-launcher": "0.1.3",
28+
"karma-requirejs": "0.2.2",
29+
"requirejs": "2.1.14"
30+
},
31+
"dependencies": {},
32+
"license": {
33+
"type": "MIT",
34+
"url": "https://github.com/guylabs/angular-spring-data-rest/blob/master/LICENSE"
35+
}
2636
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* @module spring-data-rest
3+
* @version 0.1.0
4+
*
5+
* Provider for the interceptor which wraps the SpringDataRestAdapter around the response object.
6+
*/
7+
angular.module("spring-data-rest").provider("SpringDataRestInterceptor",
8+
["$httpProvider", "SpringDataRestAdapterProvider",
9+
function ($httpProvider) {
10+
return {
11+
12+
apply: function () {
13+
$httpProvider.interceptors.push("SpringDataRestInterceptor");
14+
},
15+
16+
$get: ["SpringDataRestAdapter", "$q", function (SpringDataRestAdapter, $q) {
17+
18+
return {
19+
response: function (response) {
20+
if (response && angular.isObject(response.data)) {
21+
response.data = new SpringDataRestAdapter(response.data);
22+
}
23+
return response || $q.when(response);
24+
}
25+
};
26+
}]
27+
28+
};
29+
30+
}]
31+
);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @module spring-data-rest
3+
* @version 0.1.0
4+
*
5+
* An AngularJS module for using `$resource` with a Spring Data REST backend.
6+
*/
7+
angular.module("spring-data-rest", ["ngResource"]);

0 commit comments

Comments
 (0)