From 3ad3aefac4d3261f29b2fa224b05dee73448d079 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Wed, 25 Jan 2017 19:30:08 +0300 Subject: [PATCH] Added automatic version numbering --- apps/api/documents/api.js | 2 +- apps/common/main/lib/view/About.js | 2 +- .../mobile/app/template/Settings.template | 2 +- .../mobile/app/template/Settings.template | 2 +- .../mobile/app/template/Settings.template | 2 +- build/Gruntfile.js | 35 +++++++++++++------ build/documenteditor.json | 2 +- build/presentationeditor.json | 2 +- build/spreadsheeteditor.json | 2 +- 9 files changed, 33 insertions(+), 18 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 05faa5ef5..7853efe00 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -571,7 +571,7 @@ }; DocsAPI.DocEditor.version = function() { - return '4.3.0'; + return '{{PRODUCT_VERSION}}'; }; MessageDispatcher = function(fn, scope) { diff --git a/apps/common/main/lib/view/About.js b/apps/common/main/lib/view/About.js index ade603ecf..5cca298c2 100644 --- a/apps/common/main/lib/view/About.js +++ b/apps/common/main/lib/view/About.js @@ -52,7 +52,7 @@ define([ initialize: function(options) { Common.UI.BaseView.prototype.initialize.call(this,arguments); - this.txtVersionNum = '4.3'; + this.txtVersionNum = '{{PRODUCT_VERSION}}'; this.txtAscMail = 'support@onlyoffice.com'; this.txtAscTelNum = '+371 660-16425'; this.txtAscUrl = 'www.onlyoffice.com'; diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index 9c41eb602..d55d09eaa 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -421,7 +421,7 @@

DOCUMENT EDITOR

-

<%= scope.textVersion %> 4.3

+

<%= scope.textVersion %> {{PRODUCT_VERSION}}

Ascensio System SIA

diff --git a/apps/presentationeditor/mobile/app/template/Settings.template b/apps/presentationeditor/mobile/app/template/Settings.template index ddd4b6d5a..b3eaa9fd0 100644 --- a/apps/presentationeditor/mobile/app/template/Settings.template +++ b/apps/presentationeditor/mobile/app/template/Settings.template @@ -223,7 +223,7 @@

PRESENTATION EDITOR

-

<%= scope.textVersion %> 4.3

+

<%= scope.textVersion %> {{PRODUCT_VERSION}}

Ascensio System SIA

diff --git a/apps/spreadsheeteditor/mobile/app/template/Settings.template b/apps/spreadsheeteditor/mobile/app/template/Settings.template index f2d459626..47d9c2f81 100644 --- a/apps/spreadsheeteditor/mobile/app/template/Settings.template +++ b/apps/spreadsheeteditor/mobile/app/template/Settings.template @@ -273,7 +273,7 @@

SPREADSHEET EDITOR

-

<%= scope.textVersion %> 4.3

+

<%= scope.textVersion %> {{PRODUCT_VERSION}}

Ascensio System SIA

diff --git a/build/Gruntfile.js b/build/Gruntfile.js index 904c63292..73885594d 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -8,7 +8,7 @@ module.exports = function(grunt) { ' *\n' + ' * <%= pkg.homepage %> \n' + ' *\n' + - ' * Version: ' + process.env['PRODUCT_VERSION'] + ' (build:' + process.env['BUILD_NUMBER'] + ')\n' + + ' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' + ' */\n'; @@ -117,7 +117,7 @@ module.exports = function(grunt) { doRegisterTask('requirejs', function(defaultConfig, packageFile) { return { uglify: { - pkg: grunt.file.readJSON(defaultConfig), + pkg: packageFile, options: { banner: '/** vim: et:ts=4:sw=4:sts=4\n' + @@ -136,7 +136,7 @@ module.exports = function(grunt) { grunt.registerTask('main-app-init', function() { grunt.initConfig({ - pkg: grunt.file.readJSON(defaultConfig), + pkg: packageFile, clean: { options: { @@ -169,13 +169,13 @@ module.exports = function(grunt) { replace: { writeVersion: { - src: ['<%= pkg.api.copy.script.dest %>' + '/documents/api.js'], + src: ['<%= pkg.api.copy.script.dest %>' + '/documents/api.js', + '<%= pkg.main.js.requirejs.options.out %>'], overwrite: true, replacements: [{ - from: /(\#{2}BN\#)/, + from: /\{\{PRODUCT_VERSION\}\}/, to: function(matchedWord, index, fullText, regexMatches) { - // return content.replace(/(\#{2}BN\#)/, "." + (process.env['BUILD_NUMBER'] || packageFile.build)); - return "." + (process.env['BUILD_NUMBER'] || packageFile.build); + return packageFile.version; } }] } @@ -219,7 +219,7 @@ module.exports = function(grunt) { grunt.registerTask('mobile-app-init', function() { grunt.initConfig({ - pkg: grunt.file.readJSON(defaultConfig), + pkg: packageFile, clean: { options: { @@ -281,13 +281,26 @@ module.exports = function(grunt) { 'images-app': { files: packageFile['mobile']['copy']['images-app'] } + }, + + replace: { + writeVersion: { + src: ['<%= pkg.mobile.js.requirejs.options.out %>'], + overwrite: true, + replacements: [{ + from: /\{\{PRODUCT_VERSION\}\}/, + to: function(matchedWord, index, fullText, regexMatches) { + return packageFile.version; + } + }] + } } }); }); grunt.registerTask('embed-app-init', function() { grunt.initConfig({ - pkg: grunt.file.readJSON(defaultConfig), + pkg: packageFile, clean: { options: { @@ -334,6 +347,8 @@ module.exports = function(grunt) { grunt.registerTask('increment-build', function() { var pkg = grunt.file.readJSON(defaultConfig); pkg.build = parseInt(pkg.build) + 1; + packageFile.version = (process.env['PRODUCT_VERSION'] || pkg.version); + packageFile.build = (process.env['BUILD_NUMBER'] || pkg.build); grunt.file.write(defaultConfig, JSON.stringify(pkg, null, 4)); }); @@ -353,7 +368,7 @@ module.exports = function(grunt) { grunt.registerTask('deploy-requirejs', ['requirejs-init', 'clean', 'uglify']); grunt.registerTask('deploy-app-main', ['main-app-init', 'clean', 'imagemin', 'less', 'requirejs', 'concat', 'copy', 'replace:writeVersion']); - grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin:styles', 'copy:template-backup', 'htmlmin', 'requirejs', 'concat', 'copy:template-restore', 'clean:template-backup', 'copy:localization', 'copy:index-page', 'copy:images-app']); + grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin:styles', 'copy:template-backup', 'htmlmin', 'requirejs', 'concat', 'copy:template-restore', 'clean:template-backup', 'copy:localization', 'copy:index-page', 'copy:images-app', 'replace:writeVersion']); grunt.registerTask('deploy-app-embed', ['embed-app-init', 'clean:prebuild', 'uglify', 'less', 'copy', 'clean:postbuild']); diff --git a/build/documenteditor.json b/build/documenteditor.json index 68d3f891e..ae713752e 100644 --- a/build/documenteditor.json +++ b/build/documenteditor.json @@ -1,6 +1,6 @@ { "name": "documenteditor", - "version": "4.7.0", + "version": "4.3.0", "build": 1112, "homepage": "http://www.onlyoffice.com", "private": true, diff --git a/build/presentationeditor.json b/build/presentationeditor.json index 308357da2..cdb9bd1c5 100644 --- a/build/presentationeditor.json +++ b/build/presentationeditor.json @@ -1,6 +1,6 @@ { "name": "presentationeditor", - "version": "4.7.0", + "version": "4.3.0", "build": 774, "homepage": "http://www.onlyoffice.com", "sdk": { diff --git a/build/spreadsheeteditor.json b/build/spreadsheeteditor.json index ab3693590..cf310b5b3 100644 --- a/build/spreadsheeteditor.json +++ b/build/spreadsheeteditor.json @@ -1,6 +1,6 @@ { "name": "spreadsheeteditor", - "version": "4.7.0", + "version": "4.3.0", "build": 879, "homepage": "http://www.onlyoffice.com", "private": true,