Skip to content

Commit 55ffd03

Browse files
committed
initial commit
1 parent 7b00837 commit 55ffd03

12 files changed

+902
-2
lines changed

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@
178178
APPENDIX: How to apply the Apache License to your work.
179179

180180
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
181+
boilerplate notice, with the fields enclosed by brackets "{}"
182182
replaced with your own identifying information. (Don't include
183183
the brackets!) The text should be enclosed in the appropriate
184184
comment syntax for the file format. We also recommend that a
185185
file or class name and description of purpose be included on the
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright {yyyy} {name of copyright owner}
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO

bower.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "rico-angularjs",
3+
"version": "1.0.0-CR.7",
4+
"main": "./dist/rico-angular.js",
5+
"homepage": "https://github.com/rico-project/rico",
6+
"authors": [
7+
"Michael Heinrichs <[email protected]>",
8+
"Hendrik Ebbers <[email protected]>",
9+
"Kunal Singh <[email protected]>",
10+
"Timo Brandstätter <[email protected]>"
11+
],
12+
"description": "The AngularJS client of Rico.",
13+
"keywords": [
14+
"Rico"
15+
],
16+
"licenses": [
17+
{
18+
"type": "Apache-2.0",
19+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
20+
}
21+
],
22+
"ignore": [
23+
"**/.*",
24+
"node_modules",
25+
"bower_components",
26+
"test",
27+
"tests",
28+
"demo",
29+
"src",
30+
"gulpfile.js",
31+
"package.json",
32+
"sonar-project.properties"
33+
],
34+
"dependencies": {
35+
"angular": "1.6.9",
36+
"rico-js": "1.0.0-CR.7",
37+
"core.js": "2.4.1"
38+
}
39+
}

demo/index.html

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<script src="../bower_components/angular/angular.js"></script>
4+
<script src="../dist/rico-angular.js"></script>
5+
6+
<body>
7+
<script>
8+
var app = angular.module("MyApplication", ["Rico"]).config(function ($RicoConfigProvider) {
9+
$dolphinConfigProvider.configure({
10+
RICO_URL: "http://localhost:8080/todo-app/remoting"
11+
});
12+
});
13+
</script>
14+
15+
16+
17+
<div ng-app="MyApplication" ng-controller="MyController">
18+
<input type="text" name="input" ng-model="model.newItemText" ng-trim="false">
19+
<button ng-click="add()">add</button>
20+
<div ng-repeat="item in model.items">
21+
{{item.text}}<input type="checkbox" ng-model="item.completed" ng-change="stateChanged(item.text)">
22+
</div>
23+
</div>
24+
25+
<script>
26+
app.controller("MyController", function ($scope, clientContext) {
27+
clientContext.connect();
28+
clientContext.createController($scope, 'ToDoController').then(function (controllerProxy) {
29+
30+
$scope.$apply(function () {
31+
$scope.model.newItemText = 'angular';
32+
});
33+
34+
$scope.add = function () {
35+
controllerProxy.invoke('add');
36+
};
37+
38+
$scope.stateChanged = function (name) {
39+
controllerProxy.invoke('change', {'item': name});
40+
};
41+
42+
});
43+
});
44+
</script>
45+
46+
</body>
47+
</html>
48+

gulpfile.js

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
"use strict";
2+
3+
require('babel-register');
4+
var gulp = require('gulp');
5+
var $ = require('gulp-load-plugins')();
6+
7+
var browserify = require('browserify');
8+
var del = require('del');
9+
var assign = require('lodash.assign');
10+
var buffer = require('vinyl-buffer');
11+
var glob = require('glob');
12+
var source = require('vinyl-source-stream');
13+
var watchify = require('watchify');
14+
15+
gulp.task('clean', function() {
16+
del(['dist']);
17+
});
18+
19+
gulp.task('lint', function() {
20+
return gulp.src(['./src/**/*.js'])
21+
.pipe($.jshint())
22+
.pipe($.jshint.reporter('default'))
23+
.pipe($.jshint.reporter('fail'));
24+
});
25+
26+
gulp.task('verify', ['lint']);
27+
28+
var mainBundler = browserify(assign({}, watchify.args, {
29+
entries: './src/rico-angular.js',
30+
debug: true
31+
}));
32+
33+
function rebundle(bundler) {
34+
return bundler
35+
.transform('babelify')
36+
.bundle()
37+
.on('error', $.util.log.bind($.util, 'Browserify Error'))
38+
.pipe(source('rico-angular.js'))
39+
.pipe($.derequire())
40+
.pipe(gulp.dest('./dist'))
41+
.pipe(buffer())
42+
.pipe($.rename({extname: '.min.js'}))
43+
.pipe($.sourcemaps.init({loadMaps: true}))
44+
.pipe($.uglify())
45+
.pipe($.sourcemaps.write('./'))
46+
.pipe(gulp.dest('./dist'));
47+
}
48+
49+
gulp.task('build', ['clean','verify'], function() {
50+
return rebundle(mainBundler);
51+
});
52+
53+
var Server = require('karma').Server;
54+
55+
gulp.task('watch', function() {
56+
gulp.watch(['src/**'], ['lint']);
57+
58+
var watchedMainBundler = watchify(mainBundler);
59+
watchedMainBundler.on('update', function() {rebundle(watchedMainBundler)});
60+
});
61+
62+
gulp.task('default', ['verify', 'build', 'watch']);
63+
64+
function rebundleTest(bundler) {
65+
return bundler
66+
.transform('babelify')
67+
.bundle()
68+
.on('error', $.util.log.bind($.util, 'Browserify Error'))
69+
.pipe(source('test-bundle.js'))
70+
.pipe(buffer())
71+
.pipe($.sourcemaps.init({loadMaps: true}))
72+
.pipe($.sourcemaps.write('./'))
73+
.pipe(gulp.dest('./test/build'))
74+
}
75+
76+
var testBundler = browserify(assign({}, watchify.args, {
77+
entries: glob.sync('./test/src/**/test-*.js'),
78+
debug: true
79+
}));
80+
81+
gulp.task('build-test', function () {
82+
return rebundleTest(testBundler);
83+
});
84+
85+
gulp.task('ci-test', ['build-test'], function (done) {
86+
new Server({
87+
configFile: __dirname + '/karma.conf.js',
88+
reporters: ['coverage'],
89+
coverageReporter: {
90+
reporters: [
91+
{type: 'lcovonly', subdir: '.'}
92+
]
93+
},
94+
singleRun: true
95+
}, done).start();
96+
});
97+
98+
gulp.task('ci', ['ci-test']);
99+
100+
// START: Saucelabs
101+
102+
function createSauceLabsTestStep(customLaunchers, browsers, done) {
103+
return function () {
104+
new Server({
105+
configFile: __dirname + '/karma.conf.js',
106+
customLaunchers: customLaunchers,
107+
browsers: browsers,
108+
reporters: ['saucelabs'],
109+
singleRun: true
110+
}
111+
,function(result){
112+
if(result === 0){
113+
done();
114+
} else {
115+
done('Karma test failed: '+result);
116+
}
117+
}).start();
118+
}
119+
}
120+
121+
function createSauceLabsTestPipe(customLaunchers, step) {
122+
// We cannot run too many instances at Sauce Labs in parallel, thus we need to run it several times
123+
// with only a few environments set
124+
var numSauceLabsVMs = 5;
125+
var allBrowsers = Object.keys(customLaunchers);
126+
127+
while (allBrowsers.length > 0) {
128+
var browsers = [];
129+
for (var i = 0; i < numSauceLabsVMs && allBrowsers.length > 0; i++) {
130+
browsers.push(allBrowsers.shift());
131+
}
132+
133+
step = createSauceLabsTestStep(customLaunchers, browsers, step);
134+
}
135+
136+
step();
137+
}
138+
139+
gulp.task('saucelabs', ['build-test'], function (done) {
140+
var customLaunchers = require('./sauce.launchers.js').browsers;
141+
return createSauceLabsTestPipe(customLaunchers, done);
142+
});

karma.conf.js

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Karma configuration
2+
// Generated on Wed May 27 2015 21:40:46 GMT+0200 (CEST)
3+
4+
module.exports = function (config) {
5+
6+
config.set({
7+
8+
// base path that will be used to resolve all patterns (eg. files, exclude)
9+
basePath: '',
10+
11+
12+
// frameworks to use
13+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
14+
frameworks: ['mocha'],
15+
16+
17+
// list of files / patterns to load in the browser
18+
files: [
19+
'./test/build/**/test-*.js'
20+
],
21+
22+
23+
// list of files to exclude
24+
exclude: [],
25+
26+
client: {
27+
mocha: {
28+
timeout: 20000 // 20 seconds
29+
}
30+
},
31+
// preprocess matching files before serving them to the browser
32+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
33+
preprocessors: {},
34+
35+
36+
// test results reporter to use
37+
// possible values: 'dots', 'progress'
38+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
39+
reporters: ['progress', 'coverage'],
40+
41+
42+
// web server port
43+
port: 9876,
44+
45+
46+
// enable / disable colors in the output (reporters and logs)
47+
colors: true,
48+
49+
50+
// level of logging
51+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
52+
logLevel: config.LOG_INFO,
53+
54+
55+
// start these browsers
56+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
57+
browsers: ['PhantomJS'],
58+
59+
60+
// Sauce Labs configuration
61+
sauceLabs: {
62+
testName: 'rico-angularjs Unit Tests',
63+
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
64+
recordScreenshots: true,
65+
recordVideo: false,
66+
startConnect: false
67+
},
68+
captureTimeout: 5 * 60 * 1000,
69+
browserDisconnectTimeout: 20 * 1000,
70+
browserDisconnectTolerance: 3,
71+
browserNoActivityTimeout: 5 * 60 * 1000,
72+
73+
74+
// Coverage configuration
75+
coverageReporter: {
76+
subdir: '.'
77+
}
78+
});
79+
};

package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "rico-angularjs",
3+
"version": "1.0.0-CR.7",
4+
"description": "The AngularJS client of Rico.",
5+
"main": "./dist/rico-angular.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/canoo/rico-angularjs.git"
9+
},
10+
"author": "Hendrik Ebbers <[email protected]>",
11+
"license": "Apache-2.0",
12+
"devDependencies": {
13+
"babel": "6.5.2",
14+
"babel-core": "6.26.0",
15+
"babel-preset-es2015": "6.9.0",
16+
"babel-register": "6.26.0",
17+
"babelify": "8.0.0",
18+
"bower": "1.8.2",
19+
"browserify": "16.1.0",
20+
"chai": "4.1.2",
21+
"del": "3.0.0",
22+
"glob": "7.1.2",
23+
"gulp": "3.9.1",
24+
"gulp-derequire": "2.1.0",
25+
"gulp-jshint": "2.1.0",
26+
"gulp-load-plugins": "1.5.0",
27+
"gulp-mocha": "5.0.0",
28+
"gulp-rename": "1.2.2",
29+
"gulp-sourcemaps": "2.6.4",
30+
"gulp-uglify": "3.0.0",
31+
"gulp-util": "3.0.8",
32+
"jshint": "2.9.5",
33+
"jshint-teamcity": "1.1.1",
34+
"karma": "2.0.0",
35+
"karma-coverage": "1.1.1",
36+
"karma-mocha": "1.3.0",
37+
"karma-phantomjs-launcher": "1.0.4",
38+
"karma-sauce-launcher": "1.2.0",
39+
"lodash": "4.17.5",
40+
"lodash.assign": "4.2.0",
41+
"mocha": "5.0.1",
42+
"phantomjs": "2.1.7",
43+
"sinon": "4.3.0",
44+
"vinyl-buffer": "1.0.1",
45+
"vinyl-source-stream": "2.0.0",
46+
"watchify": "3.10.0"
47+
}
48+
}

0 commit comments

Comments
 (0)