Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dist
node_modules
bower_components
src/app/config.js
.tmp
.idea
.awspublish*
.DS_Store
/.project
/.settings
38 changes: 38 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "support-admin-app",
"version": "2.3.0",
"dependencies": {
"jquery": "~2.1.1",
"angular-animate": "~1.4.4",
"angular-cookies": "~1.4.4",
"angular-touch": "~1.4.4",
"angular-sanitize": "~1.4.4",
"angular-resource": "~1.4.4",
"angular-ui-router": "~0.2.13",
"bootstrap": "~3.3.5",
"angular-bootstrap": "0.12.x",
"angular": "~1.4.4",
"PACE": "https://github.com/HubSpot/pace.git#~1.0.2",
"metisMenu": "~2.0.2",
"font-awesome": "~4.3.0",
"footable": "~2.0.3",
"icheck": "1.0.2",
"auth0-lock": "~7.6.2",
"auth0.js": "~6.4.2",
"auth0-angular": "~4.0.5",
"a0-angular-storage": "~0.0.11",
"angular-jwt": "~0.0.9",
"angular-footable": "~1.0.3",
"appirio-tech-ng-auth": "3.x.x",
"appirio-tech-ng-login-reg": "0.x.x",
"appirio-tech-ng-api-services": "0.x.x"
},
"devDependencies": {
"angular-mocks": "~1.4.4"
},
"resolutions": {
"jquery": "~2.1.1",
"angular": "1.4.x",
"angular-resource": "1.4.x"
}
}
30 changes: 30 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"local": {
"API_URL" : "http://localhost:8080",
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
"AUTH0_TOKEN_NAME" : "userJWTToken",
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
},
"dev": {
"API_URL" : "https://api.topcoder-dev.com",
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
"AUTH0_TOKEN_NAME" : "userJWTToken",
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
},
"qa": {
"API_URL" : "https://api.topcoder-qa.com",
"AUTH0_CLIENT_ID" : "EVOgWZlCtIFlbehkq02treuRRoJk12UR",
"AUTH0_DOMAIN" : "topcoder-qa.auth0.com",
"AUTH0_TOKEN_NAME" : "userJWTToken",
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
},
"prod": {
"API_URL" : "https://api.topcoder.com",
"AUTH0_CLIENT_ID" : "6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P",
"AUTH0_DOMAIN" : "topcoder.auth0.com",
"AUTH0_TOKEN_NAME" : "userJWTToken",
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
}
}
15 changes: 15 additions & 0 deletions e2e/main.po.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
*/

'use strict';

var MainPage = function() {
this.jumbEl = element(by.css('.jumbotron'));
this.h1El = this.jumbEl.element(by.css('h1'));
this.imgEl = this.jumbEl.element(by.css('img'));
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));
};

module.exports = new MainPage();
21 changes: 21 additions & 0 deletions e2e/main.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

describe('The main view', function () {
var page;

beforeEach(function () {
browser.get('http://localhost:3000/index.html');
page = require('./main.po');
});

it('should include jumbotron with correct data', function() {
expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
});

it('list more than 5 awesome things', function () {
expect(page.thumbnailEls.count()).toBeGreaterThan(5);
});

});
92 changes: 92 additions & 0 deletions gulp/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
'use strict';

var gulp = require('gulp');

var paths = gulp.paths;

var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
});

gulp.task('partials', function () {
return gulp.src([
paths.src + '/{app,components}/**/*.html',
paths.tmp + '/{app,components}/**/*.html'
])
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe($.angularTemplatecache('templateCacheHtml.js', {
module: 'supportAdminApp'
}))
.pipe(gulp.dest(paths.tmp + '/partials/'));
});

gulp.task('html', ['inject', 'partials'], function () {
var partialsInjectFile = gulp.src(paths.tmp + '/partials/templateCacheHtml.js', { read: false });
var partialsInjectOptions = {
starttag: '<!-- inject:partials -->',
ignorePath: paths.tmp + '/partials',
addRootSlash: false
};

var htmlFilter = $.filter('*.html');
var jsFilter = $.filter('**/*.js');
var cssFilter = $.filter('**/*.css');
var assets;

return gulp.src(paths.tmp + '/serve/*.html')
.pipe($.inject(partialsInjectFile, partialsInjectOptions))
.pipe(assets = $.useref.assets())
.pipe($.rev())
.pipe(jsFilter)
.pipe($.ngAnnotate())
.pipe($.uglify({preserveComments: $.uglifySaveLicense}))
.pipe(jsFilter.restore())
.pipe(cssFilter)
.pipe($.replace('../bootstrap/fonts', 'fonts'))
.pipe($.csso())
.pipe(cssFilter.restore())
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe(htmlFilter.restore())
.pipe(gulp.dest(paths.dist + '/'))
.pipe($.size({ title: paths.dist + '/', showFiles: true }));
});

gulp.task('images', function () {
return gulp.src(paths.src + '/assets/images/**/*')
.pipe(gulp.dest(paths.dist + '/assets/images/'));
});

gulp.task('fonts', function () {
return gulp.src($.mainBowerFiles())
.pipe($.filter('**/*.{eot,svg,ttf,woff}'))
.pipe($.flatten())
.pipe(gulp.dest(paths.dist + '/fonts/'));
});

gulp.task('fontawesome', function () {
return gulp.src('bower_components/font-awesome/fonts/*.{eot,svg,ttf,woff}')
.pipe(gulp.dest(paths.dist + '/fonts/'));
});

gulp.task('misc', function () {
return gulp.src(paths.src + '/**/*.ico')
.pipe(gulp.dest(paths.dist + '/'));
});

gulp.task('clean', function (done) {
$.del([paths.dist + '/', paths.tmp + '/'], done);
});

gulp.task('build', ['ng-config', 'html', 'images', 'fonts', 'fontawesome', 'misc']);
35 changes: 35 additions & 0 deletions gulp/e2e-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';

var gulp = require('gulp');

var $ = require('gulp-load-plugins')();

var browserSync = require('browser-sync');

var paths = gulp.paths;

// Downloads the selenium webdriver
gulp.task('webdriver-update', $.protractor.webdriver_update);

gulp.task('webdriver-standalone', $.protractor.webdriver_standalone);

function runProtractor (done) {

gulp.src(paths.e2e + '/**/*.js')
.pipe($.protractor.protractor({
configFile: 'protractor.conf.js',
}))
.on('error', function (err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
})
.on('end', function () {
// Close browser sync server
browserSync.exit();
done();
});
}

gulp.task('protractor', ['protractor:src']);
gulp.task('protractor:src', ['serve:e2e', 'webdriver-update'], runProtractor);
gulp.task('protractor:dist', ['serve:e2e-dist', 'webdriver-update'], runProtractor);
40 changes: 40 additions & 0 deletions gulp/inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';

var gulp = require('gulp');

var paths = gulp.paths;

var $ = require('gulp-load-plugins')();

var wiredep = require('wiredep').stream;

gulp.task('inject', ['styles'], function () {

var injectStyles = gulp.src([
paths.tmp + '/serve/{app,components}/**/*.css',
'!' + paths.tmp + '/serve/app/vendor.css'
], { read: false });

var injectScripts = gulp.src([
paths.src + '/{app,components}/**/*.js',
'!' + paths.src + '/{app,components}/**/*.spec.js',
'!' + paths.src + '/{app,components}/**/*.mock.js'
]).pipe($.angularFilesort());

var injectOptions = {
ignorePath: [paths.src, paths.tmp + '/serve'],
addRootSlash: false
};

var wiredepOptions = {
directory: 'bower_components',
exclude: [/bootstrap\.js/, /bootstrap\.css/, /bootstrap\.css/, /foundation\.css/]
};

return gulp.src(paths.src + '/*.html')
.pipe($.inject(injectStyles, injectOptions))
.pipe($.inject(injectScripts, injectOptions))
.pipe(wiredep(wiredepOptions))
.pipe(gulp.dest(paths.tmp + '/serve'));

});
14 changes: 14 additions & 0 deletions gulp/ng-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

var gulp = require('gulp');

var gulpNgConfig = require('gulp-ng-config');

gulp.task('ng-config', function () {
gulp.src('config.json')
.pipe(
gulpNgConfig('app.constants', {
environment: process.env.BUILD_ENV || 'dev'
}))
.pipe(gulp.dest('src/app'))
});
65 changes: 65 additions & 0 deletions gulp/proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*jshint unused:false */

/***************

This file allow to configure a proxy system plugged into BrowserSync
in order to redirect backend requests while still serving and watching
files from the web project

IMPORTANT: The proxy is disabled by default.

If you want to enable it, watch at the configuration options and finally
change the `module.exports` at the end of the file

***************/

'use strict';

var httpProxy = require('http-proxy');
var chalk = require('chalk');

/*
* Location of your backend server
*/
var proxyTarget = 'http://server/context/';

var proxy = httpProxy.createProxyServer({
target: proxyTarget
});

proxy.on('error', function(error, req, res) {
res.writeHead(500, {
'Content-Type': 'text/plain'
});

console.error(chalk.red('[Proxy]'), error);
});

/*
* The proxy middleware is an Express middleware added to BrowserSync to
* handle backend request and proxy them to your backend.
*/
function proxyMiddleware(req, res, next) {
/*
* This test is the switch of each request to determine if the request is
* for a static file to be handled by BrowserSync or a backend request to proxy.
*
* The existing test is a standard check on the files extensions but it may fail
* for your needs. If you can, you could also check on a context in the url which
* may be more reliable but can't be generic.
*/
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)) {
next();
} else {
proxy.web(req, res);
}
}

/*
* This is where you activate or not your proxy.
*
* The first line activate if and the second one ignored it
*/

//module.exports = [proxyMiddleware];
module.exports = [];
Loading