Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add application version number #1050

Merged
merged 1 commit into from
Jan 28, 2015
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: 6 additions & 4 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';

var pomParser = require('node-pom-parser');
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;

// usemin custom step
var path = require('path');
var useminAutoprefixer = {
name: 'autoprefixer',
createConfig: require('grunt-usemin/lib/config/cssmin').createConfig // Reuse cssmins createConfig
Expand All @@ -26,7 +26,7 @@ module.exports = function (grunt) {
tasks: ['wiredep']
},
ngconstant: {
files: ['Gruntfile.js'],
files: ['Gruntfile.js', 'pom.xml'],
tasks: ['ngconstant:dev']
},<% if (useCompass) { %>
compass: {
Expand Down Expand Up @@ -486,15 +486,17 @@ module.exports = function (grunt) {
dest: 'src/main/webapp/scripts/app/app.constants.js',
},
constants: {
ENV: 'dev'
ENV: 'dev',
VERSION: pomParser.parsePom({ filePath: "pom.xml"}).version
}
},
prod: {
options: {
dest: '.tmp/scripts/app/app.constants.js',
},
constants: {
ENV: 'prod'
ENV: 'prod',
VERSION: pomParser.parsePom({ filePath: "pom.xml"}).version
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"karma-requirejs": "0.2.2",
"karma-phantomjs-launcher": "0.1.4",
"karma": "0.12.31",
"node-pom-parser": "0.1.1",
"bower": "1.3.12",
"generator-jhipster": "<%= packagejs.version %>",
"lodash": "2.4.1",
Expand Down
9 changes: 6 additions & 3 deletions app/templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var gulp = require('gulp'),
replace = require('gulp-replace'),
url = require('url'),
wiredep = require('wiredep').stream,
gulpif = require('gulp-if');
gulpif = require('gulp-if'),
pomParser = require('node-pom-parser');

var karma = require('gulp-karma')({configFile: 'src/test/javascript/karma.conf.js'});

Expand Down Expand Up @@ -208,7 +209,8 @@ gulp.task('ngconstant:dev', function() {
interpolate: /\{%=(.+?)%\}/g,
wrap: '"use strict";\n// DO NOT EDIT THIS FILE, EDIT THE GULP TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n{%= __ngModule %}',
constants: {
ENV: 'dev'
ENV: 'dev',
VERSION: pomParser.parsePom({ filePath: "pom.xml"}).version
},
})
.pipe(gulp.dest(yeoman.app + 'scripts/app/'));
Expand All @@ -223,7 +225,8 @@ gulp.task('ngconstant:prod', function() {
interpolate: /\{%=(.+?)%\}/g,
wrap: '"use strict";\n// DO NOT EDIT THIS FILE, EDIT THE GULP TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n{%= __ngModule %}',
constants: {
ENV: 'prod'
ENV: 'prod',
VERSION: pomParser.parsePom({ filePath: "pom.xml"}).version
},
})
.pipe(gulp.dest(yeoman.tmp + 'scripts/app/'));
Expand Down
5 changes: 5 additions & 0 deletions app/templates/src/main/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ body {
background-repeat: no-repeat;
}

.navbar-version {
font-size: 10px;
color: #ccc
}

.browserupgrade {
margin: 0.2em 0;
background: #ccc;
Expand Down
8 changes: 8 additions & 0 deletions app/templates/src/main/webapp/assets/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ Developement Ribbon
background-repeat: no-repeat;
}

/* ==========================================================================
Version number in navbar
========================================================================== */
.navbar-version {
font-size: 10px;
color: #ccc
}

/* ==========================================================================
Browser Upgrade Prompt
========================================================================== */
Expand Down
3 changes: 2 additions & 1 deletion app/templates/src/main/webapp/scripts/app/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
angular.module('<%=angularAppName%>', ['LocalStorageModule', 'tmh.dynamicLocale',
'ngResource', 'ui.router', 'ngCookies', 'pascalprecht.translate', 'ngCacheBuster'])

.run(function ($rootScope, $location, $http, $state, $translate, Auth, Principal, Language, ENV) {
.run(function ($rootScope, $location, $http, $state, $translate, Auth, Principal, Language, ENV, VERSION) {
$rootScope.ENV = ENV;
$rootScope.VERSION = VERSION;
$rootScope.$on('$stateChangeStart', function (event, toState, toStateParams) {
$rootScope.toState = toState;
$rootScope.toStateParams = toStateParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span translate="global.title">jhipster</span></a>
<a class="navbar-brand" href="#"><span translate="global.title">jhipster</span> <span class="navbar-version">{{VERSION}}</span></a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse" ng-switch="isAuthenticated()">
<ul class="nav navbar-nav nav-pills navbar-right">
Expand Down