Skip to content

Commit 03e61f7

Browse files
author
Yoshifumi Kohata
committed
Merge pull request #2 from appirio-tech/dev
Merged with the release branch COR-2015-11-16-PRE1
2 parents 24f14a5 + 5082a48 commit 03e61f7

Some content is hidden

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

82 files changed

+10843
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dist
2+
node_modules
3+
bower_components
4+
src/app/config.js
5+
.tmp
6+
.idea
7+
.awspublish*
8+
.DS_Store
9+
/.project
10+
/.settings

bower.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "support-admin-app",
3+
"version": "2.3.0",
4+
"dependencies": {
5+
"jquery": "~2.1.1",
6+
"angular-animate": "~1.4.4",
7+
"angular-cookies": "~1.4.4",
8+
"angular-touch": "~1.4.4",
9+
"angular-sanitize": "~1.4.4",
10+
"angular-resource": "~1.4.4",
11+
"angular-ui-router": "~0.2.13",
12+
"bootstrap": "~3.3.5",
13+
"angular-bootstrap": "0.12.x",
14+
"angular": "~1.4.4",
15+
"PACE": "https://github.com/HubSpot/pace.git#~1.0.2",
16+
"metisMenu": "~2.0.2",
17+
"font-awesome": "~4.3.0",
18+
"footable": "~2.0.3",
19+
"icheck": "1.0.2",
20+
"auth0-lock": "~7.6.2",
21+
"auth0.js": "~6.4.2",
22+
"auth0-angular": "~4.0.5",
23+
"a0-angular-storage": "~0.0.11",
24+
"angular-jwt": "~0.0.9",
25+
"angular-footable": "~1.0.3",
26+
"appirio-tech-ng-auth": "3.x.x",
27+
"appirio-tech-ng-login-reg": "0.x.x",
28+
"appirio-tech-ng-api-services": "0.x.x"
29+
},
30+
"devDependencies": {
31+
"angular-mocks": "~1.4.4"
32+
},
33+
"resolutions": {
34+
"jquery": "~2.1.1",
35+
"angular": "1.4.x",
36+
"angular-resource": "1.4.x"
37+
}
38+
}

config.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"local": {
3+
"API_URL" : "http://localhost:8080",
4+
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
5+
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
6+
"AUTH0_TOKEN_NAME" : "userJWTToken",
7+
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
8+
},
9+
"dev": {
10+
"API_URL" : "https://api.topcoder-dev.com",
11+
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
12+
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
13+
"AUTH0_TOKEN_NAME" : "userJWTToken",
14+
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
15+
},
16+
"qa": {
17+
"API_URL" : "https://api.topcoder-qa.com",
18+
"AUTH0_CLIENT_ID" : "EVOgWZlCtIFlbehkq02treuRRoJk12UR",
19+
"AUTH0_DOMAIN" : "topcoder-qa.auth0.com",
20+
"AUTH0_TOKEN_NAME" : "userJWTToken",
21+
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
22+
},
23+
"prod": {
24+
"API_URL" : "https://api.topcoder.com",
25+
"AUTH0_CLIENT_ID" : "6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P",
26+
"AUTH0_DOMAIN" : "topcoder.auth0.com",
27+
"AUTH0_TOKEN_NAME" : "userJWTToken",
28+
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
29+
}
30+
}

e2e/main.po.js

Lines changed: 15 additions & 0 deletions
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 awesomeThings'));
13+
};
14+
15+
module.exports = new MainPage();

e2e/main.spec.js

Lines changed: 21 additions & 0 deletions
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('http://localhost:3000/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('list more than 5 awesome things', function () {
18+
expect(page.thumbnailEls.count()).toBeGreaterThan(5);
19+
});
20+
21+
});

gulp/build.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
var paths = gulp.paths;
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+
paths.src + '/{app,components}/**/*.html',
14+
paths.tmp + '/{app,components}/**/*.html'
15+
])
16+
.pipe($.minifyHtml({
17+
empty: true,
18+
spare: true,
19+
quotes: true
20+
}))
21+
.pipe($.angularTemplatecache('templateCacheHtml.js', {
22+
module: 'supportAdminApp'
23+
}))
24+
.pipe(gulp.dest(paths.tmp + '/partials/'));
25+
});
26+
27+
gulp.task('html', ['inject', 'partials'], function () {
28+
var partialsInjectFile = gulp.src(paths.tmp + '/partials/templateCacheHtml.js', { read: false });
29+
var partialsInjectOptions = {
30+
starttag: '<!-- inject:partials -->',
31+
ignorePath: paths.tmp + '/partials',
32+
addRootSlash: false
33+
};
34+
35+
var htmlFilter = $.filter('*.html');
36+
var jsFilter = $.filter('**/*.js');
37+
var cssFilter = $.filter('**/*.css');
38+
var assets;
39+
40+
return gulp.src(paths.tmp + '/serve/*.html')
41+
.pipe($.inject(partialsInjectFile, partialsInjectOptions))
42+
.pipe(assets = $.useref.assets())
43+
.pipe($.rev())
44+
.pipe(jsFilter)
45+
.pipe($.ngAnnotate())
46+
.pipe($.uglify({preserveComments: $.uglifySaveLicense}))
47+
.pipe(jsFilter.restore())
48+
.pipe(cssFilter)
49+
.pipe($.replace('../bootstrap/fonts', 'fonts'))
50+
.pipe($.csso())
51+
.pipe(cssFilter.restore())
52+
.pipe(assets.restore())
53+
.pipe($.useref())
54+
.pipe($.revReplace())
55+
.pipe(htmlFilter)
56+
.pipe($.minifyHtml({
57+
empty: true,
58+
spare: true,
59+
quotes: true
60+
}))
61+
.pipe(htmlFilter.restore())
62+
.pipe(gulp.dest(paths.dist + '/'))
63+
.pipe($.size({ title: paths.dist + '/', showFiles: true }));
64+
});
65+
66+
gulp.task('images', function () {
67+
return gulp.src(paths.src + '/assets/images/**/*')
68+
.pipe(gulp.dest(paths.dist + '/assets/images/'));
69+
});
70+
71+
gulp.task('fonts', function () {
72+
return gulp.src($.mainBowerFiles())
73+
.pipe($.filter('**/*.{eot,svg,ttf,woff}'))
74+
.pipe($.flatten())
75+
.pipe(gulp.dest(paths.dist + '/fonts/'));
76+
});
77+
78+
gulp.task('fontawesome', function () {
79+
return gulp.src('bower_components/font-awesome/fonts/*.{eot,svg,ttf,woff}')
80+
.pipe(gulp.dest(paths.dist + '/fonts/'));
81+
});
82+
83+
gulp.task('misc', function () {
84+
return gulp.src(paths.src + '/**/*.ico')
85+
.pipe(gulp.dest(paths.dist + '/'));
86+
});
87+
88+
gulp.task('clean', function (done) {
89+
$.del([paths.dist + '/', paths.tmp + '/'], done);
90+
});
91+
92+
gulp.task('build', ['ng-config', 'html', 'images', 'fonts', 'fontawesome', 'misc']);

gulp/e2e-tests.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
var $ = require('gulp-load-plugins')();
6+
7+
var browserSync = require('browser-sync');
8+
9+
var paths = gulp.paths;
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+
18+
gulp.src(paths.e2e + '/**/*.js')
19+
.pipe($.protractor.protractor({
20+
configFile: 'protractor.conf.js',
21+
}))
22+
.on('error', function (err) {
23+
// Make sure failed tests cause gulp to exit non-zero
24+
throw err;
25+
})
26+
.on('end', function () {
27+
// Close browser sync server
28+
browserSync.exit();
29+
done();
30+
});
31+
}
32+
33+
gulp.task('protractor', ['protractor:src']);
34+
gulp.task('protractor:src', ['serve:e2e', 'webdriver-update'], runProtractor);
35+
gulp.task('protractor:dist', ['serve:e2e-dist', 'webdriver-update'], runProtractor);

gulp/inject.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
var paths = gulp.paths;
6+
7+
var $ = require('gulp-load-plugins')();
8+
9+
var wiredep = require('wiredep').stream;
10+
11+
gulp.task('inject', ['styles'], function () {
12+
13+
var injectStyles = gulp.src([
14+
paths.tmp + '/serve/{app,components}/**/*.css',
15+
'!' + paths.tmp + '/serve/app/vendor.css'
16+
], { read: false });
17+
18+
var injectScripts = gulp.src([
19+
paths.src + '/{app,components}/**/*.js',
20+
'!' + paths.src + '/{app,components}/**/*.spec.js',
21+
'!' + paths.src + '/{app,components}/**/*.mock.js'
22+
]).pipe($.angularFilesort());
23+
24+
var injectOptions = {
25+
ignorePath: [paths.src, paths.tmp + '/serve'],
26+
addRootSlash: false
27+
};
28+
29+
var wiredepOptions = {
30+
directory: 'bower_components',
31+
exclude: [/bootstrap\.js/, /bootstrap\.css/, /bootstrap\.css/, /foundation\.css/]
32+
};
33+
34+
return gulp.src(paths.src + '/*.html')
35+
.pipe($.inject(injectStyles, injectOptions))
36+
.pipe($.inject(injectScripts, injectOptions))
37+
.pipe(wiredep(wiredepOptions))
38+
.pipe(gulp.dest(paths.tmp + '/serve'));
39+
40+
});

gulp/ng-config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
var gulpNgConfig = require('gulp-ng-config');
6+
7+
gulp.task('ng-config', function () {
8+
gulp.src('config.json')
9+
.pipe(
10+
gulpNgConfig('app.constants', {
11+
environment: process.env.BUILD_ENV || 'dev'
12+
}))
13+
.pipe(gulp.dest('src/app'))
14+
});

gulp/proxy.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*jshint unused:false */
2+
3+
/***************
4+
5+
This file allow to configure a proxy system plugged into BrowserSync
6+
in order to redirect backend requests while still serving and watching
7+
files from the web project
8+
9+
IMPORTANT: The proxy is disabled by default.
10+
11+
If you want to enable it, watch at the configuration options and finally
12+
change the `module.exports` at the end of the file
13+
14+
***************/
15+
16+
'use strict';
17+
18+
var httpProxy = require('http-proxy');
19+
var chalk = require('chalk');
20+
21+
/*
22+
* Location of your backend server
23+
*/
24+
var proxyTarget = 'http://server/context/';
25+
26+
var proxy = httpProxy.createProxyServer({
27+
target: proxyTarget
28+
});
29+
30+
proxy.on('error', function(error, req, res) {
31+
res.writeHead(500, {
32+
'Content-Type': 'text/plain'
33+
});
34+
35+
console.error(chalk.red('[Proxy]'), error);
36+
});
37+
38+
/*
39+
* The proxy middleware is an Express middleware added to BrowserSync to
40+
* handle backend request and proxy them to your backend.
41+
*/
42+
function proxyMiddleware(req, res, next) {
43+
/*
44+
* This test is the switch of each request to determine if the request is
45+
* for a static file to be handled by BrowserSync or a backend request to proxy.
46+
*
47+
* The existing test is a standard check on the files extensions but it may fail
48+
* for your needs. If you can, you could also check on a context in the url which
49+
* may be more reliable but can't be generic.
50+
*/
51+
if (/\.(html|css|js|png|jpg|jpeg|gif|ico|xml|rss|txt|eot|svg|ttf|woff|cur)(\?((r|v|rel|rev)=[\-\.\w]*)?)?$/.test(req.url)) {
52+
next();
53+
} else {
54+
proxy.web(req, res);
55+
}
56+
}
57+
58+
/*
59+
* This is where you activate or not your proxy.
60+
*
61+
* The first line activate if and the second one ignored it
62+
*/
63+
64+
//module.exports = [proxyMiddleware];
65+
module.exports = [];

0 commit comments

Comments
 (0)