automatic project update

This commit is contained in:
Julien Dubois 2016-03-23 16:27:37 +01:00
parent 231b2d9297
commit ed41ad9816
1822 changed files with 66055 additions and 41755 deletions

6
.eslintignore Normal file
View File

@ -0,0 +1,6 @@
# more info here - http://eslint.org/docs/user-guide/configuring.html#ignoring-files-and-directories
# node_modules ignored by default
# ignore bower_components
src/main/webapp/bower_components

29
.eslintrc.json Normal file
View File

@ -0,0 +1,29 @@
// See: http://eslint.org/
// See: https://www.npmjs.com/package/eslint-plugin-angular
{
"extends": [
"eslint:recommended",
"angular"
],
"env": {
"node": true,
"browser": true
},
// severity for a rule should be one of the following: 0 = off, 1 = warning, 2 = error
"rules": {
// coding style
"wrap-iife": [2, "inside"],
"eqeqeq": 2,
"no-use-before-define": [2, "nofunc"],
"no-unused-vars": [2, {"vars": "local", "args": "none"}],
"no-multi-str": 2,
"no-irregular-whitespace": 2,
"semi": [2, "always"],
"indent": 2,
// os/git options
// we want to run on all OSes
"linebreak-style": 0,
"eol-last": 2
}
}

7
.gitignore vendored
View File

@ -1,7 +1,7 @@
######################
# Project Specific
######################
/src/main/webapp/dist
/target/www/**
######################
# Node
@ -126,3 +126,8 @@ Desktop.ini
# Maven Wrapper
######################
!.mvn/wrapper/maven-wrapper.jar
######################
# ESLint
######################
.eslintcache

View File

@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip

View File

@ -2,9 +2,9 @@ language: node_js
node_js:
- "0.12"
sudo: false
before_install: npm install -g grunt-cli
before_install: npm install -g gulp
install: npm install
before_script: grunt build
before_script: gulp build
notifications:
webhooks:
on_success: change # options: [always|never|change] default: always

View File

@ -12,15 +12,20 @@
"prodDatabaseType": "mysql",
"useCompass": false,
"buildTool": "maven",
"frontendBuilder": "grunt",
"javaVersion": "8",
"rememberMeKey": "5c37379956bd1242f5636c8cb322c2966ad81277",
"searchEngine": "no",
"enableTranslation": true,
"useSass": false,
"applicationType": "monolith",
"testFrameworks": [
"gatling"
"gatling",
"protractor"
],
"enableSocialSignIn": false
"languages": [
"en"
],
"serverPort": 8080,
"jhipsterVersion": "3.0.0",
"enableSocialSignIn": false,
"useSass": false
}
}

View File

@ -1,362 +0,0 @@
// Generated on 2016-03-07 using generator-jhipster 2.27.2
'use strict';
var fs = require('fs');
var parseString = require('xml2js').parseString;
// Returns the second occurence of the version number
var parseVersionFromPomXml = function() {
var version;
var pomXml = fs.readFileSync('pom.xml', "utf8");
parseString(pomXml, function (err, result){
if (result.project.version && result.project.version[0]) {
version = result.project.version[0];
} else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) {
version = result.project.parent[0].version[0]
} else {
throw new Error('pom.xml is malformed. No version is defined');
}
});
return version;
};
// usemin custom step
var useminAutoprefixer = {
name: 'autoprefixer',
createConfig: function(context, block) {
if(block.src.length === 0) {
return {};
} else {
return require('grunt-usemin/lib/config/cssmin').createConfig(context, block) // Reuse cssmins createConfig
}
}
};
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'app',
dist: 'src/main/webapp/dist'
},
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
ngconstant: {
files: ['Gruntfile.js', 'pom.xml'],
tasks: ['ngconstant:dev']
}
},
autoprefixer: {
// src and dest is configured in a subtask called "generated" by usemin
},
wiredep: {
app: {
src: ['src/main/webapp/index.html'],
exclude: [
/angular-i18n/ // localizations are loaded dynamically
]
},
test: {
src: 'src/test/javascript/karma.conf.js',
exclude: [/angular-i18n/, /angular-scenario/],
ignorePath: /\.\.\/\.\.\//, // remove ../../ from paths of injected javascripts
devDependencies: true,
fileTypes: {
js: {
block: /(([\s\t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
}
},
browserSync: {
dev: {
bsFiles: {
src : [
'src/main/webapp/**/*.html',
'src/main/webapp/**/*.json',
'src/main/webapp/assets/styles/**/*.css',
'src/main/webapp/scripts/**/*.{js,html}',
'src/main/webapp/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
'tmp/**/*.{css,js}'
]
}
},
options: {
watchTask: true,
proxy: {
target: "localhost:8080",
proxyOptions: {
xfwd: true
}
}
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
},
server: '.tmp'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'src/main/webapp/scripts/app.js',
'src/main/webapp/scripts/app/**/*.js',
'src/main/webapp/scripts/components/**/*.js'
]
},
concat: {
// src and dest is configured in a subtask called "generated" by usemin
},
uglifyjs: {
// src and dest is configured in a subtask called "generated" by usemin
},
rev: {
dist: {
files: {
src: [
'<%= yeoman.dist %>/scripts/**/*.js',
'<%= yeoman.dist %>/assets/styles/**/*.css',
'<%= yeoman.dist %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/assets/fonts/*'
]
}
}
},
useminPrepare: {
html: 'src/main/webapp/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin', useminAutoprefixer] // Let cssmin concat files so it corrects relative paths to fonts and images
},
post: {}
}
}
}
},
usemin: {
html: ['<%= yeoman.dist %>/**/*.html'],
css: ['<%= yeoman.dist %>/assets/styles/**/*.css'],
js: ['<%= yeoman.dist %>/scripts/**/*.js'],
options: {
assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/assets/styles', '<%= yeoman.dist %>/assets/images', '<%= yeoman.dist %>/assets/fonts'],
patterns: {
js: [
[/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
]
},
dirs: ['<%= yeoman.dist %>']
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: 'src/main/webapp/assets/images',
src: '**/*.{jpg,jpeg}', // we don't optimize PNG files as it doesn't work on Linux. If you are not on Linux, feel free to use '**/*.{png,jpg,jpeg}'
dest: '<%= yeoman.dist %>/assets/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: 'src/main/webapp/assets/images',
src: '**/*.svg',
dest: '<%= yeoman.dist %>/assets/images'
}]
}
},
cssmin: {
// src and dest is configured in a subtask called "generated" by usemin
},
ngtemplates: {
dist: {
cwd: 'src/main/webapp',
src: ['scripts/app/**/*.html', 'scripts/components/**/*.html',],
dest: '.tmp/templates/templates.js',
options: {
module: 'sampleapplicationApp',
usemin: 'scripts/app.js',
htmlmin: '<%= htmlmin.dist.options %>'
}
}
},
htmlmin: {
dist: {
options: {
removeCommentsFromCDATA: true,
// https://github.com/yeoman/grunt-usemin/issues/44
collapseWhitespace: true,
collapseBooleanAttributes: true,
conservativeCollapse: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
keepClosingSlash: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// Put files not handled in other tasks here
copy: {
fonts: {
files: [{
expand: true,
dot: true,
flatten: true,
cwd: 'src/main/webapp',
dest: '<%= yeoman.dist %>/assets/fonts',
src: [
'bower_components/bootstrap/fonts/*.*'
]
}]
},
dist: {
files: [{
expand: true,
dot: true,
cwd: 'src/main/webapp',
dest: '<%= yeoman.dist %>',
src: [
'*.html',
'scripts/**/*.html',
'assets/images/**/*.{png,gif,webp,jpg,jpeg,svg}',
'assets/fonts/*'
]
}, {
expand: true,
cwd: '.tmp/assets/images',
dest: '<%= yeoman.dist %>/assets/images',
src: [
'generated/*'
]
}]
}
},
karma: {
unit: {
configFile: 'src/test/javascript/karma.conf.js',
singleRun: true
}
},
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
buildcontrol: {
options: {
commit: true,
push: false,
connectCommits: false,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
}
},
ngconstant: {
options: {
name: 'sampleapplicationApp',
deps: false,
wrap: '"use strict";\n// DO NOT EDIT THIS FILE, EDIT THE GRUNT TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n{%= __ngModule %}'
},
dev: {
options: {
dest: 'src/main/webapp/scripts/app/app.constants.js'
},
constants: {
ENV: 'dev',
VERSION: parseVersionFromPomXml()
}
},
prod: {
options: {
dest: '.tmp/scripts/app/app.constants.js'
},
constants: {
ENV: 'prod',
VERSION: parseVersionFromPomXml()
}
}
}
});
grunt.registerTask('serve', [
'clean:server',
'wiredep',
'ngconstant:dev',
'browserSync',
'watch'
]);
grunt.registerTask('server', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run([target ? ('serve:' + target) : 'serve']);
});
grunt.registerTask('test', [
'clean:server',
'wiredep:test',
'ngconstant:dev',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'wiredep:app',
'ngconstant:prod',
'useminPrepare',
'ngtemplates',
'imagemin',
'svgmin',
'concat',
'copy:fonts',
'copy:dist',
'ngAnnotate',
'cssmin',
'autoprefixer',
'uglify',
'rev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', ['serve']);
};

View File

@ -2,6 +2,8 @@
This application was generated using JHipster, you can find documentation and help at [https://jhipster.github.io](https://jhipster.github.io).
## Development
Before you can build this project, you must install and configure the following dependencies on your machine:
1. [Node.js][]: We use Node to run a development web server and build the project.
@ -12,25 +14,26 @@ After installing Node, you should be able to run the following command to instal
npm install
We use [Grunt][] as our build system. Install the grunt command-line tool globally with:
We use [Gulp][] as our build system. Install the Gulp command-line tool globally with:
npm install -g grunt-cli
npm install -g gulp
Run the following commands in two separate terminals to create a blissful development experience where your browser
auto-refreshes when files change on your hard drive.
mvn
grunt
./mvnw
gulp
Bower is used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by
specifying a newer version in `bower.json`. You can also run `bower update` and `bower install` to manage dependencies.
Add the `-h` flag on any command to see how you can use it. For example, `bower update -h`.
# Building for production
## Building for production
To optimize the sampleApplication client for production, run:
mvn -Pprod clean package
./mvnw -Pprod clean package
This will concatenate and minify CSS and JavaScript files. It will also modify `index.html` so it references
these new files.
@ -41,15 +44,16 @@ To ensure everything worked, run:
Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
# Testing
## Testing
Unit tests are run by [Karma][] and written with [Jasmine][]. They're located in `src/test/javascript` and can be run with:
Unit tests are run by [Karma][] and written with [Jasmine][]. They're located in `src/test/javascript/` and can be run with:
grunt test
gulp test
UI end-to-end tests are powered by [Protractor][], which is built on top of WebDriverJS. They're located in `src/test/javascript/e2e`
and can be run by starting Spring Boot in one terminal (`./mvnw spring-boot:run`) and running the tests (`gulp itest`) in a second one.
# Continuous Integration
## Continuous Integration
To setup this project in Jenkins, use the following configuration:
@ -62,13 +66,21 @@ To setup this project in Jenkins, use the following configuration:
* Poll SCM / Schedule: `H/5 * * * *`
* Build
* Invoke Maven / Tasks: `-Pprod clean package`
* Execute Shell / Command:
````
./mvnw spring-boot:run &
bootPid=$!
sleep 30s
gulp itest
kill $bootPid
````
* Post-build Actions
* Publish JUnit test result report / Test Report XMLs: `build/test-results/*.xml`
* Publish JUnit test result report / Test Report XMLs: `build/test-results/*.xml,build/reports/e2e/*.xml`
[JHipster]: https://jhipster.github.io/
[Node.js]: https://nodejs.org/
[Bower]: http://bower.io/
[Grunt]: http://gruntjs.com/
[Gulp]: http://gulpjs.com/
[BrowserSync]: http://www.browsersync.io/
[Karma]: http://karma-runner.github.io/
[Jasmine]: http://jasmine.github.io/2.0/introduction.html

View File

@ -1,49 +1,62 @@
{
"name": "sampleApplication",
"version": "0.0.0",
"appPath": "src/main/webapp",
"name": "sampleApplication",
"appPath": "src/main/webapp/",
"testPath": "src/test/javascript/spec",
"dependencies": {
"angular": "1.4.8",
"angular-aria": "1.4.8",
"angular-bootstrap": "0.14.3",
"angular": "1.5.2",
"angular-aria": "1.5.2",
"angular-bootstrap": "1.2.5",
"angular-cache-buster": "0.4.3",
"angular-cookies": "1.4.8",
"angular-dynamic-locale": "0.1.28",
"angular-i18n": "1.4.8",
"angular-local-storage": "0.2.3",
"angular-loading-bar": "0.8.0",
"angular-resource": "1.4.8",
"angular-sanitize": "1.4.8",
"angular-translate": "2.8.1",
"angular-translate-interpolation-messageformat": "2.8.1",
"angular-translate-loader-partial": "2.8.1",
"angular-translate-storage-cookie": "2.8.1",
"angular-ui-router": "0.2.15",
"bootstrap": "3.3.5",
"jquery": "2.1.4",
"angular-cookies": "1.5.2",
"angular-dynamic-locale": "0.1.30",
"angular-i18n": "1.5.2",
"ngstorage": "0.3.10",
"angular-loading-bar": "0.9.0",
"angular-resource": "1.5.2",
"angular-sanitize": "1.5.2",
"angular-translate": "2.11.0",
"angular-translate-interpolation-messageformat": "2.11.0",
"angular-translate-loader-partial": "2.11.0",
"angular-translate-storage-cookie": "2.11.0",
"angular-ui-router": "0.2.18",
"bootstrap": "3.3.6",
"bootstrap-ui-datetime-picker": "2.2.3",
"jquery": "2.2.2",
"json3": "3.3.2",
"modernizr": "3.2.0",
"ng-file-upload": "10.0.2",
"ngInfiniteScroll": "1.2.1",
"swagger-ui": "2.1.3"
"modernizr": "3.3.1",
"ng-file-upload": "12.0.4",
"ngInfiniteScroll": "1.2.2",
"swagger-ui": "2.1.4"
},
"devDependencies": {
"angular-mocks": "1.4.8",
"angular-scenario": "1.4.8"
"angular-mocks": "1.5.2",
"angular-scenario": "1.5.2"
},
"overrides": {
"angular": {
"dependencies": {
"jquery": "2.2.2"
}
},
"bootstrap": {
"main": [
"dist/js/bootstrap.js",
"dist/css/bootstrap.css",
"less/bootstrap.less"
]
},
"messageformat": {
"main": [
"messageformat.js",
"locale/en.js"
]
}
},
"resolutions": {
"angular": "1.4.8",
"angular-cookies": "1.4.8",
"jquery": "2.1.4"
"angular": "1.5.2",
"angular-cookies": "1.5.2",
"angular-bootstrap": "1.2.5",
"jquery": "2.2.2"
}
}

50
gulp/build.js Normal file
View File

@ -0,0 +1,50 @@
var fs = require('fs'),
gulp = require('gulp'),
lazypipe = require('lazypipe'),
footer = require('gulp-footer'),
sourcemaps = require('gulp-sourcemaps'),
rev = require('gulp-rev'),
htmlmin = require('gulp-htmlmin'),
ngAnnotate = require('gulp-ng-annotate'),
prefix = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
uglify = require('gulp-uglify'),
useref = require("gulp-useref"),
revReplace = require("gulp-rev-replace")
plumber = require('gulp-plumber'),
gulpIf = require('gulp-if'),
handleErrors = require('./handleErrors');
var config = require('./config');
var initTask = lazypipe()
.pipe(sourcemaps.init)
.pipe(footer, ';');
var jsTask = lazypipe()
.pipe(ngAnnotate)
.pipe(uglify);
var cssTask = lazypipe()
.pipe(prefix)
.pipe(cssnano);
module.exports = function() {
var templates = fs.readFileSync(config.tmp + '/templates.js');
var manifest = gulp.src(config.revManifest);
return gulp.src([config.app + '**/*.html',
'!' + config.app + 'app/**/*.html',
'!' + config.app + 'swagger-ui/**/*',
'!' + config.bower + '**/*.html'])
.pipe(plumber({errorHandler: handleErrors}))
//init sourcemaps and prepend semicolon
.pipe(useref({}, initTask))
//append html templates
.pipe(gulpIf('**/app.js', footer(templates)))
.pipe(gulpIf('*.js', jsTask()))
.pipe(gulpIf('*.css', cssTask()))
.pipe(gulpIf('*.html', htmlmin({collapseWhitespace: true})))
.pipe(gulpIf('**/*.!(html)', rev()))
.pipe(revReplace({manifest}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(config.dist));
}

12
gulp/config.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
app: 'src/main/webapp/',
dist: 'target/www/',
test: 'src/test/javascript/',
bower: 'src/main/webapp/bower_components/',
tmp: 'target/tmp',
revManifest: 'target/tmp/rev-manifest.json',
port: 9000,
apiPort: 8080,
liveReloadPort: 35729,
uri: 'http://localhost:'
};

20
gulp/handleErrors.js Normal file
View File

@ -0,0 +1,20 @@
var notify = require("gulp-notify");
var argv = require('yargs').argv;
module.exports = function() {
var args = Array.prototype.slice.call(arguments);
var notification = argv.notification === undefined ? true : argv.notification;
// Send error to notification center with gulp-notify
if(notification) {
notify.onError({
title: "JHipster Gulp Build",
subtitle: "Failure!",
message: "Error: <%= error.message %>",
sound: "Beep"
}).apply(this, args);
}
// Keep gulp from hanging on this task
this.emit('end');
};

60
gulp/serve.js Normal file
View File

@ -0,0 +1,60 @@
var gulp = require('gulp'),
util = require('./utils'),
url = require('url'),
browserSync = require('browser-sync'),
proxy = require('proxy-middleware');
var config = require('./config');
module.exports = function () {
var baseUri = config.uri + config.apiPort;
// Routes to proxy to the backend. Routes ending with a / will setup
// a redirect so that if accessed without a trailing slash, will
// redirect. This is required for some endpoints for proxy-middleware
// to correctly handle them.
var proxyRoutes = [
'/'
];
var requireTrailingSlash = proxyRoutes.filter(function (r) {
return util.endsWith(r, '/');
}).map(function (r) {
// Strip trailing slash so we can use the route to match requests
// with non trailing slash
return r.substr(0, r.length - 1);
});
var proxies = [
// Ensure trailing slash in routes that require it
function (req, res, next) {
requireTrailingSlash.forEach(function (route){
if (url.parse(req.url).path === route) {
res.statusCode = 301;
res.setHeader('Location', route + '/');
res.end();
}
});
next();
}
]
.concat(
// Build a list of proxies for routes: [route1_proxy, route2_proxy, ...]
proxyRoutes.map(function (r) {
var options = url.parse(baseUri + r);
options.route = r;
options.preserveHost = true;
return proxy(options);
}));
browserSync({
open: true,
port: config.port,
server: {
baseDir: config.app,
middleware: proxies
}
});
gulp.start('watch');
}

36
gulp/utils.js Normal file
View File

@ -0,0 +1,36 @@
'use strict';
var fs = require('fs');
module.exports = {
endsWith : endsWith,
parseVersion : parseVersion,
isLintFixed : isLintFixed
}
function endsWith(str, suffix) {
return str.indexOf('/', str.length - suffix.length) !== -1;
};
var parseString = require('xml2js').parseString;
// return the version number from `pom.xml` file
function parseVersion() {
var version;
var pomXml = fs.readFileSync('pom.xml', 'utf8');
parseString(pomXml, function (err, result) {
if (result.project.version && result.project.version[0]) {
version = result.project.version[0];
} else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) {
version = result.project.parent[0].version[0];
} else {
throw new Error('pom.xml is malformed. No version is defined');
}
});
return version;
}
function isLintFixed(file) {
// Has ESLint fixed the file contents?
return file.eslint !== null && file.eslint.fixed;
}

275
gulpfile.js Normal file
View File

@ -0,0 +1,275 @@
// Generated on 2016-03-23 using generator-jhipster 3.0.0
'use strict';
var gulp = require('gulp'),
rev = require('gulp-rev'),
templateCache = require('gulp-angular-templatecache'),
htmlmin = require('gulp-htmlmin'),
imagemin = require('gulp-imagemin'),
ngConstant = require('gulp-ng-constant-fork'),
eslint = require('gulp-eslint'),
argv = require('yargs').argv,
gutil = require('gulp-util'),
protractor = require('gulp-protractor').protractor,
es = require('event-stream'),
flatten = require('gulp-flatten'),
del = require('del'),
wiredep = require('wiredep').stream,
runSequence = require('run-sequence'),
browserSync = require('browser-sync'),
KarmaServer = require('karma').Server,
plumber = require('gulp-plumber'),
changed = require('gulp-changed'),
gulpIf = require('gulp-if'),
inject = require('gulp-inject'),
angularFilesort = require('gulp-angular-filesort');
var handleErrors = require('./gulp/handleErrors'),
serve = require('./gulp/serve'),
util = require('./gulp/utils'),
build = require('./gulp/build');
var yorc = require('./.yo-rc.json')['generator-jhipster'];
var config = require('./gulp/config');
gulp.task('clean', function () {
return del([config.dist], { dot: true });
});
gulp.task('copy', function () {
return es.merge(
gulp.src(config.app + 'i18n/**')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'i18n/'))
.pipe(gulp.dest(config.dist + 'i18n/')),
gulp.src(config.bower + 'bootstrap/fonts/*.*')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/fonts/'))
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/fonts/'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist)),
gulp.src(config.app + 'content/**/*.{woff,woff2,svg,ttf,eot,otf}')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/fonts/'))
.pipe(flatten())
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/fonts/'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist)),
gulp.src([config.app + 'robots.txt', config.app + 'favicon.ico', config.app + '.htaccess'], { dot: true })
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist))
.pipe(gulp.dest(config.dist))
);
});
gulp.task('images', function () {
return gulp.src(config.app + 'content/images/**')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/images'))
.pipe(imagemin({optimizationLevel: 5, progressive: true, interlaced: true}))
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/images'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('languages', function () {
var locales = yorc.languages.map(function (locale) {
return config.bower + 'angular-i18n/angular-locale_' + locale + '.js';
});
return gulp.src(locales)
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.app + 'i18n/'))
.pipe(gulp.dest(config.app + 'i18n/'));
});
gulp.task('styles', [], function () {
return gulp.src(config.app + 'content/css')
.pipe(browserSync.reload({stream: true}));
});
gulp.task('inject', function () {
return gulp.src(config.app + 'index.html')
.pipe(inject(gulp.src(config.app + 'app/**/*.js').pipe(angularFilesort()), {relative: true}))
.pipe(gulp.dest(config.app));
});
gulp.task('wiredep', ['wiredep:test', 'wiredep:app']);
gulp.task('wiredep:app', function () {
var stream = gulp.src(config.app + 'index.html')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(wiredep({
exclude: [
/angular-i18n/, // localizations are loaded dynamically
'bower_components/bootstrap/dist/js/' // exclude bootstrap js files as we use ui-bootstrap
]
}))
.pipe(gulp.dest(config.app));
return stream;
});
gulp.task('wiredep:test', function () {
return gulp.src(config.test + 'karma.conf.js')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(wiredep({
exclude: [
/angular-i18n/, // localizations are loaded dynamically
/angular-scenario/,
'bower_components/bootstrap/dist/js/' // exclude Bootstrap js files as we use ui-bootstrap
],
ignorePath: /\.\.\/\.\.\//, // remove ../../ from paths of injected JavaScript files
devDependencies: true,
fileTypes: {
js: {
block: /(([\s\t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'src/{{filePath}}\','
}
}
}
}))
.pipe(gulp.dest(config.test));
});
gulp.task('assets:prod', ['images', 'styles', 'html'], build);
gulp.task('html', function () {
return gulp.src(config.app + 'app/**/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(templateCache({
module: 'sampleApplicationApp',
root: 'app/',
moduleSystem: 'IIFE'
}))
.pipe(gulp.dest(config.tmp));
});
gulp.task('ngconstant:dev', function () {
return ngConstant({
dest: 'app.constants.js',
name: 'sampleApplicationApp',
deps: false,
noFile: true,
interpolate: /\{%=(.+?)%\}/g,
wrap:
'(function () {\n' +
' "use strict";\n' +
' // DO NOT EDIT THIS FILE, EDIT THE GULP TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n' +
' {%= __ngModule %}\n' +
'})();\n',
constants: {
ENV: 'dev',
VERSION: util.parseVersion()
}
})
.pipe(gulp.dest(config.app + 'app/'));
});
gulp.task('ngconstant:prod', function () {
return ngConstant({
dest: 'app.constants.js',
name: 'sampleApplicationApp',
deps: false,
noFile: true,
interpolate: /\{%=(.+?)%\}/g,
wrap:
'(function () {\n' +
' "use strict";\n' +
' // DO NOT EDIT THIS FILE, EDIT THE GULP TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n' +
' {%= __ngModule %}\n' +
'})();\n',
constants: {
ENV: 'prod',
VERSION: util.parseVersion()
}
})
.pipe(gulp.dest(config.app + 'app/'));
});
// check app for eslint errors
gulp.task('eslint', function () {
return gulp.src(['gulpfile.js', config.app + 'app/**/*.js'])
.pipe(plumber({errorHandler: handleErrors}))
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
// check app for eslint errors anf fix some of them
gulp.task('eslint:fix', function () {
return gulp.src(config.app + 'app/**/*.js')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(eslint({
fix: true
}))
.pipe(eslint.format())
.pipe(gulpIf(util.isLintFixed, gulp.dest(config.app + 'app')));
});
gulp.task('test', ['wiredep:test', 'ngconstant:dev'], function (done) {
new KarmaServer({
configFile: __dirname + '/' + config.test + 'karma.conf.js',
singleRun: true
}, done).start();
});
/* to run individual suites pass `gulp itest --suite suiteName` */
gulp.task('protractor', function () {
var configObj = {
configFile: config.test + 'protractor.conf.js'
};
if (argv.suite) {
configObj['args'] = ['--suite', argv.suite];
}
return gulp.src([])
.pipe(plumber({errorHandler: handleErrors}))
.pipe(protractor(configObj))
.on('error', function () {
gutil.log('E2E Tests failed');
process.exit(1);
});
});
gulp.task('itest', ['protractor']);
gulp.task('watch', function () {
gulp.watch('bower.json', ['install']);
gulp.watch(['gulpfile.js', 'pom.xml'], ['ngconstant:dev']);
gulp.watch(config.app + 'content/css/**/*.css', ['styles']);
gulp.watch(config.app + 'content/images/**', ['images']);
gulp.watch(config.app + 'app/**/*.js', ['inject']);
gulp.watch([config.app + '*.html', config.app + 'app/**', config.app + 'i18n/**']).on('change', browserSync.reload);
});
gulp.task('install', function () {
runSequence(['wiredep', 'ngconstant:dev'], 'languages', 'inject');
});
gulp.task('serve', function () {
runSequence('install', serve);
});
gulp.task('build', ['clean'], function (cb) {
runSequence(['copy', 'wiredep:app', 'ngconstant:prod', 'languages'], 'inject', 'assets:prod', cb);
});
gulp.task('default', ['serve']);

View File

@ -1,5 +1,5 @@
{
"name": "sampleapplication",
"name": "sample-application",
"version": "0.0.0",
"description": "Description for sampleApplication",
"private": true,
@ -11,57 +11,62 @@
"bower": "^1.6.3"
},
"devDependencies": {
"grunt": "0.4.5",
"grunt-autoprefixer": "3.0.3",
"grunt-build-control": "0.6.1",
"grunt-wiredep": "2.0.0",
"grunt-browser-sync": "2.2.0",
"browser-sync": "2.10.0",
"grunt-contrib-copy": "0.8.2",
"grunt-contrib-clean": "0.7.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-cssmin": "0.14.0",
"grunt-contrib-htmlmin": "0.6.0",
"grunt-contrib-imagemin": "1.0.0",
"grunt-contrib-jshint": "0.11.3",
"grunt-contrib-uglify": "0.10.1",
"grunt-contrib-watch": "0.6.1",
"grunt-modernizr": "1.0.1",
"grunt-ng-annotate": "1.0.1",
"grunt-ng-constant": "1.1.0",
"grunt-rev": "0.1.0",
"grunt-svgmin": "3.1.0",
"grunt-text-replace": "0.4.0",
"grunt-usemin": "3.1.1",
"grunt-angular-templates":"0.5.7",
"load-grunt-tasks": "3.3.0",
"grunt-karma": "0.12.1",
"time-grunt": "1.2.2",
"browser-sync": "2.11.2",
"del": "2.2.0",
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "1.0.0",
"event-stream": "3.3.2",
"jshint-stylish": "2.1.0",
"karma-script-launcher": "0.1.0",
"karma-chrome-launcher": "0.2.1",
"karma-html2js-preprocessor": "0.1.0",
"karma-jasmine": "0.3.6",
"karma-requirejs": "0.2.2",
"karma-phantomjs-launcher": "0.2.1",
"phantomjs": "1.9.18",
"karma": "0.13.19",
"karma-coverage": "0.5.3",
"generator-jhipster": "3.0.0",
"gulp": "3.9.1",
"gulp-angular-filesort": "1.1.1",
"gulp-angular-templatecache": "1.8.0",
"gulp-autoprefixer": "3.1.0",
"gulp-changed": "1.3.0",
"gulp-cssnano": "2.1.1",
"gulp-eslint": "2.0.0",
"gulp-flatten": "0.2.0",
"gulp-footer": "1.0.5",
"gulp-htmlmin": "1.3.0",
"gulp-if": "2.0.0",
"gulp-imagemin": "2.4.0",
"gulp-inject": "3.0.0",
"gulp-ng-annotate": "2.0.0",
"gulp-ng-constant-fork": "0.4.1",
"gulp-notify": "2.2.0",
"gulp-plumber": "1.1.0",
"gulp-protractor": "2.1.0",
"gulp-util": "3.0.7",
"gulp-rev": "7.0.0",
"gulp-rev-replace": "^0.4.3",
"gulp-sourcemaps": "1.6.0",
"gulp-uglify": "1.5.3",
"gulp-useref": "3.0.7",
"jasmine-core": "2.4.1",
"jasmine-reporters": "2.1.1",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-coverage": "0.5.5",
"karma-jasmine": "0.3.8",
"karma-jenkins-reporter": "0.0.2",
"generator-jhipster": "2.27.2",
"lodash": "3.10.1",
"xml2js": "0.4.15",
"yo": ">=1.3.0",
"requirejs": "2.1",
"jasmine-core": "2.3.4",
"zeparser": "0.0.7",
"wiredep": "2.2.2"
"karma-phantomjs-launcher": "1.0.0",
"karma-script-launcher": "0.2.0",
"lazypipe": "1.0.1",
"lodash": "4.6.1",
"map-stream": "0.0.6",
"phantomjs-prebuilt": "2.1.4",
"protractor": "3.1.1",
"protractor-jasmine2-screenshot-reporter": "0.3.0",
"proxy-middleware": "0.15.0",
"run-sequence": "1.1.5",
"wiredep": "4.0.0",
"xml2js": "0.4.16",
"yargs": "4.3.2"
},
"engines": {
"node": "^0.12 || ^4.2"
"node": "^4.3"
},
"scripts": {
"test": "grunt test"
"test": "gulp test",
"postinstall": "webdriver-manager update"
}
}

163
pom.xml
View File

@ -5,12 +5,12 @@
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>1.3.1.RELEASE</version>
<version>1.3.3.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.mycompany.myapp</groupId>
<artifactId>sampleapplication</artifactId>
<artifactId>sample-application</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>sampleApplication</name>
@ -33,9 +33,9 @@
</prerequisites>
<properties>
<hikaricp.version>2.4.1</hikaricp.version>
<assertj-core.version>3.1.0</assertj-core.version>
<awaitility.version>1.4.0</awaitility.version>
<hikaricp.version>2.4.3</hikaricp.version>
<assertj-core.version>3.3.0</assertj-core.version>
<awaitility.version>1.7.0</awaitility.version>
<commons-io.version>2.4</commons-io.version>
<commons-lang.version>2.6</commons-lang.version>
<gatling.version>2.1.7</gatling.version>
@ -50,18 +50,19 @@
<liquibase-hibernate4.version>3.5</liquibase-hibernate4.version>
<mapstruct.version>1.0.0.Final</mapstruct.version>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<maven-enforcer-plugin.version>1.3.1</maven-enforcer-plugin.version>
<maven-sortpom-plugin.version>2.3.0</maven-sortpom-plugin.version>
<maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
<sortpom-maven-plugin.version>2.5.0</sortpom-maven-plugin.version>
<metrics-spark-reporter.version>1.2</metrics-spark-reporter.version>
<metrics-spring.version>3.1.2</metrics-spring.version>
<metrics-spring.version>3.1.3</metrics-spring.version>
<logstash-logback-encoder.version>4.6</logstash-logback-encoder.version>
<run.addResources>false</run.addResources>
<spring-security.version>4.0.2.RELEASE</spring-security.version>
<springfox.version>2.0.3</springfox.version>
<spring-security.version>4.0.4.RELEASE</spring-security.version>
<springfox.version>2.4.0</springfox.version>
<!-- Sonar properties -->
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
<sonar-maven-plugin.version>2.6</sonar-maven-plugin.version>
<jacoco-maven-plugin.version>0.7.4.201502262128</jacoco-maven-plugin.version>
<sonar.exclusions>src/main/webapp/assets/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/dist/**/*.*</sonar.exclusions>
<sonar-maven-plugin.version>2.7.1</sonar-maven-plugin.version>
<jacoco-maven-plugin.version>0.7.6.201602180812</jacoco-maven-plugin.version>
<sonar.exclusions>src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, target/www/**/*.*</sonar.exclusions>
<sonar.java.codeCoveragePlugin>jacoco</sonar.java.codeCoveragePlugin>
<sonar.jacoco.itReportPath>${project.testresult.directory}/coverage/jacoco/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.jacoco.reportPath>${project.testresult.directory}/coverage/jacoco/jacoco.exec</sonar.jacoco.reportPath>
@ -204,12 +205,13 @@
</exclusions>
</dependency>
<!-- The HikariCP Java Agent is disabled by default, as it is experimental
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-agent</artifactId>
<version>${HikariCP.version}</version>
</dependency>
-->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-agent</artifactId>
<version>${HikariCP.version}</version>
</dependency>
-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
@ -336,6 +338,25 @@
</exclusions>
</dependency>
<!-- Spring Cloud -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logstash-logback-encoder.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
@ -365,14 +386,14 @@
<defaultGoal>spring-boot:run</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<directory>src/main/resources/</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.xml</exclude>
@ -381,9 +402,9 @@
</resources>
<plugins>
<plugin>
<groupId>com.google.code.sortpom</groupId>
<artifactId>maven-sortpom-plugin</artifactId>
<version>${maven-sortpom-plugin.version}</version>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>${sortpom-maven-plugin.version}</version>
<executions>
<execution>
<phase>verify</phase>
@ -453,18 +474,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx256m ${surefireArgLine}</argLine>
<argLine>-Djava.security.egd=file:/dev/./urandom -Xmx256m ${surefireArgLine}</argLine>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
@ -546,7 +560,7 @@
<defaultSchemaName></defaultSchemaName>
<username></username>
<password></password>
<referenceUrl>hibernate:spring:com.mycompany.myapp.domain?dialect=</referenceUrl>
<referenceUrl>hibernate:spring:com.mycompany.myapp.domain?dialect=&amp;hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
</configuration>
@ -573,12 +587,31 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<!--
Enable the line below to have remote debugging of your application on port 5005
<jvmArguments>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmArguments>
-->
<arguments>
<argument>--spring.profiles.active=dev</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.1</version>
<configuration>
<imageName>sampleapplication</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.war</include>
</resource>
</resources>
</configuration>
</plugin>
<!-- jhipster-needle-maven-add-plugin -->
</plugins>
<pluginManagement>
@ -612,6 +645,23 @@
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.github.trecloux</groupId>
<artifactId>
yeoman-maven-plugin
</artifactId>
<versionRange>
[0.5,)
</versionRange>
<goals>
<goal>build</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>