1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 18:02:54 +01:00

build-config task to be used by concat/minify build process

This commit is contained in:
Jason San Jose 2013-12-02 14:31:09 -08:00
parent b171a55da0
commit cca208c1ed
3 changed files with 30 additions and 3 deletions

2
.gitignore vendored
View File

@ -9,6 +9,8 @@ src/brackets.min.css
/node_modules
/npm-debug.log
# ignore compiled files
/dist
# ignore everything in the dev extension directory EXCEPT the README
# (so that the directory is non-empty and can be in git)

View File

@ -25,7 +25,8 @@
module.exports = function (grunt) {
"use strict";
var child_process = require("child_process"),
var build = {},
child_process = require("child_process"),
path = require("path"),
q = require("q"),
qexec = q.denodeify(child_process.exec);
@ -117,4 +118,8 @@ module.exports = function (grunt) {
done();
});
});
build.getGitInfo = getGitInfo;
return build;
};

View File

@ -20,11 +20,12 @@
* DEALINGS IN THE SOFTWARE.
*
*/
/*global module, require*/
/*global module, require, process*/
module.exports = function (grunt) {
"use strict";
var common = require("./lib/common")(grunt);
var common = require("./lib/common")(grunt),
build = require("./build")(grunt);
// task: write-config
grunt.registerTask("write-config", "Merge package.json and src/brackets.config.json into src/config.json", function () {
@ -39,4 +40,23 @@ module.exports = function (grunt) {
common.writeJSON(grunt, "src/config.json", appConfigJSON);
});
// task: build-config
grunt.registerTask("build-config", "Update config.json with the branch and SHA being built", function () {
var done = this.async(),
distConfig = grunt.file.readJSON("src/config.json");
build.getGitInfo(process.cwd()).then(function (gitInfo) {
distConfig.version = distConfig.version.substr(0, distConfig.version.lastIndexOf("-") + 1) + gitInfo.commits;
distConfig.repository.SHA = gitInfo.sha;
distConfig.repository.branch = gitInfo.branch;
common.writeJSON(grunt, "dist/config.json", distConfig);
done();
}, function (err) {
grunt.log.writeln(err);
done(false);
});
});
};