diff --git a/.gitignore b/.gitignore index ae51880ac86..c6e19a9a8f1 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ Thumbs.db # ignore .disabled file for default extensions /src/extensions/default/*/.disabled +# generate through grunt +/src/config.json + #OSX .DS_Store files .DS_Store diff --git a/Gruntfile.js b/Gruntfile.js index 9f56ba54111..2f8f4d5ac7c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -341,7 +341,7 @@ module.exports = function (grunt) { }); // task: install - grunt.registerTask('install', ['write-config', 'less', 'npm-install-source']); + grunt.registerTask('install', ['write-config:dev', 'less', 'npm-install-source']); // task: test grunt.registerTask('test', ['eslint', 'jasmine', 'nls-check']); @@ -349,10 +349,11 @@ module.exports = function (grunt) { // task: set-release // Update version number in package.json and rewrite src/config.json - grunt.registerTask('set-release', ['update-release-number', 'write-config']); + grunt.registerTask('set-release', ['update-release-number', 'write-config:dev']); // task: build grunt.registerTask('build', [ + 'write-config:dist', 'eslint:src', 'jasmine', 'clean', diff --git a/src/brackets.config.dev.json b/src/brackets.config.dev.json new file mode 100644 index 00000000000..fb63f4d01ba --- /dev/null +++ b/src/brackets.config.dev.json @@ -0,0 +1,3 @@ +{ + "healthDataServerURL" : "https://healthdev.brackets.io/healthDataLog" +} diff --git a/src/brackets.config.dist.json b/src/brackets.config.dist.json new file mode 100644 index 00000000000..51a409ad9a0 --- /dev/null +++ b/src/brackets.config.dist.json @@ -0,0 +1,3 @@ +{ + "healthDataServerURL" : "https://health.brackets.io/healthDataLog" +} diff --git a/src/brackets.config.json b/src/brackets.config.json index 25041fd3938..89a0db49067 100644 --- a/src/brackets.config.json +++ b/src/brackets.config.json @@ -20,7 +20,6 @@ "extension_registry" : "https://s3.amazonaws.com/extend.brackets/registry.json", "extension_url" : "https://s3.amazonaws.com/extend.brackets/{0}/{0}-{1}.zip", "linting.enabled_by_default" : true, - "build_timestamp" : "", - "healthDataServerURL" : "https://health.brackets.io/healthDataLog" + "build_timestamp" : "" } } diff --git a/tasks/write-config.js b/tasks/write-config.js index 1a3b4003cb8..86a7e24c5d3 100644 --- a/tasks/write-config.js +++ b/tasks/write-config.js @@ -31,9 +31,21 @@ module.exports = function (grunt) { // task: write-config grunt.registerTask("write-config", "Merge package.json and src/brackets.config.json into src/config.json", function () { - var packageJSON = grunt.file.readJSON("package.json"), - appConfigJSON = grunt.file.readJSON("src/brackets.config.json"); + var name = "dev"; + if (this.flags.dist === true) { + name = "dist"; + } + var appConfigJSON = grunt.file.readJSON("src/brackets.config.json"), + appConfigEnvJSON = grunt.file.readJSON("src/brackets.config." + name + ".json"), + key; + for (key in appConfigEnvJSON) { + if (appConfigEnvJSON.hasOwnProperty(key)) { + appConfigJSON.config[key] = appConfigEnvJSON[key]; + } + } + + var packageJSON = grunt.file.readJSON("package.json"); Object.keys(packageJSON).forEach(function (key) { if (appConfigJSON[key] === undefined) { appConfigJSON[key] = packageJSON[key];