Skip to content

Commit 1a17725

Browse files
committed
initial commit
0 parents  commit 1a17725

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+969
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "bower_components"
3+
}

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
bower_components/
3+
.sass-cache/
4+
.idea/
5+
.tmp/
6+
dist/

.jshintrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"strict": true,
3+
"bitwise": true,
4+
"curly": true,
5+
"eqeqeq": true,
6+
"latedef": false,
7+
"noarg": true,
8+
"undef": true,
9+
"unused": true,
10+
"validthis": true,
11+
"jasmine": true,
12+
"globals": {
13+
"angular": false,
14+
"inject": false,
15+
"module": false
16+
}
17+
}

.yo-rc.json

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"generator-gulp-angular": {
3+
"version": "0.12.1",
4+
"props": {
5+
"angularVersion": "~1.4.0",
6+
"angularModules": [
7+
{
8+
"key": "animate",
9+
"module": "ngAnimate"
10+
},
11+
{
12+
"key": "cookies",
13+
"module": "ngCookies"
14+
},
15+
{
16+
"key": "touch",
17+
"module": "ngTouch"
18+
},
19+
{
20+
"key": "sanitize",
21+
"module": "ngSanitize"
22+
}
23+
],
24+
"jQuery": {
25+
"key": "none"
26+
},
27+
"resource": {
28+
"key": "none",
29+
"module": null
30+
},
31+
"router": {
32+
"key": "ui-router",
33+
"module": "ui.router"
34+
},
35+
"ui": {
36+
"key": "bootstrap",
37+
"module": null
38+
},
39+
"bootstrapComponents": {
40+
"key": "ui-bootstrap",
41+
"module": "ui.bootstrap"
42+
},
43+
"cssPreprocessor": {
44+
"key": "less",
45+
"extension": "less"
46+
},
47+
"jsPreprocessor": {
48+
"key": "none",
49+
"extension": "js",
50+
"srcExtension": "js"
51+
},
52+
"htmlPreprocessor": {
53+
"key": "none",
54+
"extension": "html"
55+
},
56+
"foundationComponents": {
57+
"name": null,
58+
"version": null,
59+
"key": null,
60+
"module": null
61+
},
62+
"paths": {
63+
"src": "src",
64+
"dist": "dist",
65+
"e2e": "e2e",
66+
"tmp": ".tmp"
67+
}
68+
}
69+
}
70+
}

bower.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "hyperdeckUi",
3+
"version": "0.0.0",
4+
"dependencies": {
5+
"angular-animate": "~1.4.0",
6+
"angular-cookies": "~1.4.0",
7+
"angular-touch": "~1.4.0",
8+
"angular-sanitize": "~1.4.0",
9+
"angular-ui-router": "~0.2.15",
10+
"bootstrap": "~3.3.4",
11+
"angular-bootstrap": "~0.13.0",
12+
"malarkey": "yuanqing/malarkey#~1.3.0",
13+
"toastr": "~2.1.1",
14+
"moment": "~2.10.3",
15+
"animate.css": "~3.3.0",
16+
"angular": "~1.4.0"
17+
},
18+
"devDependencies": {
19+
"angular-mocks": "~1.4.0"
20+
},
21+
"resolutions": {
22+
"angular": "~1.4.0"
23+
}
24+
}

e2e/.jshintrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../.jshintrc",
3+
"globals": {
4+
"browser": false,
5+
"element": false,
6+
"by": false,
7+
"$": false,
8+
"$$": false
9+
}
10+
}

e2e/main.po.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* This file uses the Page Object pattern to define the main page for tests
3+
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
4+
*/
5+
6+
'use strict';
7+
8+
var MainPage = function() {
9+
this.jumbEl = element(by.css('.jumbotron'));
10+
this.h1El = this.jumbEl.element(by.css('h1'));
11+
this.imgEl = this.jumbEl.element(by.css('img'));
12+
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in main.awesomeThings'));
13+
};
14+
15+
module.exports = new MainPage();

e2e/main.spec.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
describe('The main view', function () {
4+
var page;
5+
6+
beforeEach(function () {
7+
browser.get('/index.html');
8+
page = require('./main.po');
9+
});
10+
11+
it('should include jumbotron with correct data', function() {
12+
expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
13+
expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
14+
expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
15+
});
16+
17+
it('should list more than 5 awesome things', function () {
18+
expect(page.thumbnailEls.count()).toBeGreaterThan(5);
19+
});
20+
21+
});

gulp/.jshintrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../.jshintrc",
3+
"node": true
4+
}

gulp/build.js

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
'use strict';
2+
3+
var path = require('path');
4+
var gulp = require('gulp');
5+
var conf = require('./conf');
6+
7+
var $ = require('gulp-load-plugins')({
8+
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
9+
});
10+
11+
gulp.task('partials', function () {
12+
return gulp.src([
13+
path.join(conf.paths.src, '/app/**/*.html'),
14+
path.join(conf.paths.tmp, '/serve/app/**/*.html')
15+
])
16+
.pipe($.minifyHtml({
17+
empty: true,
18+
spare: true,
19+
quotes: true
20+
}))
21+
.pipe($.angularTemplatecache('templateCacheHtml.js', {
22+
module: 'hyperdeckUi',
23+
root: 'app'
24+
}))
25+
.pipe(gulp.dest(conf.paths.tmp + '/partials/'));
26+
});
27+
28+
gulp.task('html', ['inject', 'partials'], function () {
29+
var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { read: false });
30+
var partialsInjectOptions = {
31+
starttag: '<!-- inject:partials -->',
32+
ignorePath: path.join(conf.paths.tmp, '/partials'),
33+
addRootSlash: false
34+
};
35+
36+
var htmlFilter = $.filter('*.html');
37+
var jsFilter = $.filter('**/*.js');
38+
var cssFilter = $.filter('**/*.css');
39+
var assets;
40+
41+
return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))
42+
.pipe($.inject(partialsInjectFile, partialsInjectOptions))
43+
.pipe(assets = $.useref.assets())
44+
.pipe($.rev())
45+
.pipe(jsFilter)
46+
.pipe($.ngAnnotate())
47+
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
48+
.pipe(jsFilter.restore())
49+
.pipe(cssFilter)
50+
.pipe($.replace('../../bower_components/bootstrap/fonts/', '../fonts/'))
51+
.pipe($.csso())
52+
.pipe(cssFilter.restore())
53+
.pipe(assets.restore())
54+
.pipe($.useref())
55+
.pipe($.revReplace())
56+
.pipe(htmlFilter)
57+
.pipe($.minifyHtml({
58+
empty: true,
59+
spare: true,
60+
quotes: true,
61+
conditionals: true
62+
}))
63+
.pipe(htmlFilter.restore())
64+
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
65+
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
66+
});
67+
68+
// Only applies for fonts from bower dependencies
69+
// Custom fonts are handled by the "other" task
70+
gulp.task('fonts', function () {
71+
return gulp.src($.mainBowerFiles())
72+
.pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
73+
.pipe($.flatten())
74+
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));
75+
});
76+
77+
gulp.task('other', function () {
78+
var fileFilter = $.filter(function (file) {
79+
return file.stat.isFile();
80+
});
81+
82+
return gulp.src([
83+
path.join(conf.paths.src, '/**/*'),
84+
path.join('!' + conf.paths.src, '/**/*.{html,css,js,less}')
85+
])
86+
.pipe(fileFilter)
87+
.pipe(gulp.dest(path.join(conf.paths.dist, '/')));
88+
});
89+
90+
gulp.task('clean', function (done) {
91+
$.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')], done);
92+
});
93+
94+
gulp.task('build', ['html', 'fonts', 'other']);

gulp/conf.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* This file contains the variables used in other gulp files
3+
* which defines tasks
4+
* By design, we only put there very generic config values
5+
* which are used in several places to keep good readability
6+
* of the tasks
7+
*/
8+
9+
var gutil = require('gulp-util');
10+
11+
/**
12+
* The main paths of your project handle these with care
13+
*/
14+
exports.paths = {
15+
src: 'src',
16+
dist: 'dist',
17+
tmp: '.tmp',
18+
e2e: 'e2e'
19+
};
20+
21+
/**
22+
* Wiredep is the lib which inject bower dependencies in your project
23+
* Mainly used to inject script tags in the index.html but also used
24+
* to inject css preprocessor deps and js files in karma
25+
*/
26+
exports.wiredep = {
27+
exclude: [/jquery/, /bootstrap.js$/, /bootstrap\.css/],
28+
directory: 'bower_components'
29+
};
30+
31+
/**
32+
* Common implementation for an error handler of a Gulp plugin
33+
*/
34+
exports.errorHandler = function(title) {
35+
'use strict';
36+
37+
return function(err) {
38+
gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
39+
this.emit('end');
40+
};
41+
};

gulp/e2e-tests.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
'use strict';
2+
3+
var path = require('path');
4+
var gulp = require('gulp');
5+
var conf = require('./conf');
6+
7+
var browserSync = require('browser-sync');
8+
9+
var $ = require('gulp-load-plugins')();
10+
11+
// Downloads the selenium webdriver
12+
gulp.task('webdriver-update', $.protractor.webdriver_update);
13+
14+
gulp.task('webdriver-standalone', $.protractor.webdriver_standalone);
15+
16+
function runProtractor (done) {
17+
var params = process.argv;
18+
var args = params.length > 3 ? [params[3], params[4]] : [];
19+
20+
gulp.src(path.join(conf.paths.e2e, '/**/*.js'))
21+
.pipe($.protractor.protractor({
22+
configFile: 'protractor.conf.js',
23+
args: args
24+
}))
25+
.on('error', function (err) {
26+
// Make sure failed tests cause gulp to exit non-zero
27+
throw err;
28+
})
29+
.on('end', function () {
30+
// Close browser sync server
31+
browserSync.exit();
32+
done();
33+
});
34+
}
35+
36+
gulp.task('protractor', ['protractor:src']);
37+
gulp.task('protractor:src', ['serve:e2e', 'webdriver-update'], runProtractor);
38+
gulp.task('protractor:dist', ['serve:e2e-dist', 'webdriver-update'], runProtractor);

0 commit comments

Comments
 (0)