diff --git a/.gitignore b/.gitignore index f90a1d105fd..57a62a6df85 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ Thumbs.db # Files that can be automatically downloaded that we don't want to ship with our builds /src/extensibility/node/node_modules/request/tests/ + +# Mozilla Bramble-specific files +.env diff --git a/Gruntfile.js b/Gruntfile.js index 8b757585f1d..b28b67cbaee 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,11 +21,31 @@ * */ /*global module, require*/ + +// Brackets specific config vars + + +var habitat = require('habitat'); +habitat.load(); +var env = new habitat(); + +var GIT_BRANCH = env.get("BRAMBLE_MAIN_BRANCH") || "bramble"; +var GIT_REMOTE = env.get("BRAMBLE_MAIN_REMOTE") || "upstream"; + module.exports = function (grunt) { 'use strict'; // load dependencies - require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', 'grunt-targethtml', 'grunt-usemin']}); + require('load-grunt-tasks')(grunt, { + pattern: [ + 'grunt-contrib-*', + 'grunt-targethtml', + 'grunt-usemin', + 'grunt-npm', + 'grunt-git', + 'grunt-update-submodules' + ] + }); grunt.loadTasks('tasks'); // Project configuration. @@ -316,7 +336,7 @@ module.exports = function (grunt) { '<%= meta.src %>', '<%= meta.test %>', // These modules include lots of third-party code, so we skip them - '!src/extensions/default/HTMLHinter/slowparse/**', + '!src/extensions/default/HTMLHinter/slowparse/**', '!src/extensions/default/HTMLHinter/tooltipsy.source.js', '!src/extensions/default/brackets-browser-livedev/nohost/**', //With Previous skip statement, this file was ignored, so we specify it directly for jshinting @@ -326,7 +346,7 @@ module.exports = function (grunt) { src: [ '<%= meta.src %>', // These modules include lots of third-party code, so we skip them - '!src/extensions/default/HTMLHinter/slowparse/**', + '!src/extensions/default/HTMLHinter/slowparse/**', '!src/extensions/default/HTMLHinter/tooltipsy.source.js', '!src/extensions/default/brackets-browser-livedev/nohost/**', //With Previous skip statement, this file was ignored, so we specify it directly for jshinting @@ -343,9 +363,125 @@ module.exports = function (grunt) { mac: "<%= shell.repo %>/installer/mac/staging/<%= pkg.name %>.app", win: "<%= shell.repo %>/installer/win/staging/<%= pkg.name %>.exe", linux: "<%= shell.repo %>/installer/linux/debian/package-root/opt/brackets/brackets" + }, + + // Brackets specific tasks + 'npm-checkBranch': { + options: { + branch: GIT_BRANCH + } + }, + gitcheckout: { + smart: { + options: { + branch: 'gh-pages', + overwrite: false + } + }, + }, + gitfetch: { + smart: { + options: {} + } + }, + "update_submodules": { + publish: { + options: { + params: "--remote -- src/extensions/default/brackets-browser-livedev" + } + } + }, + gitcommit: { + module: { + options: { + // This is replaced during the 'publish' task + message: "Placeholder" + } + }, + publish: { + options: { + noStatus: true, + allowEmpty: true, + message: "Latest distribution version of Bramble." + } + } + }, + gitadd: { + publish: { + files: { + src: ['./dist/*'] + }, + options: { + force: true + } + }, + modules: { + files: { + src: ['./src/extensions/default/brackets-browser-livedev'] + } + } + }, + gitpush: { + smart: { + options: { + remote: GIT_REMOTE, + // These options are left in for + // clarity. Their actual values + // will be set by the `publish` task. + branch: 'gh-pages', + force: true + }, + } } }); + // Bramble-task: smartCheckout + grunt.registerTask('smartCheckout', function(branch, overwrite) { + overwrite = overwrite == "true" ? true : false; + + grunt.config('gitcheckout.smart.options.branch', branch); + grunt.config('gitcheckout.smart.options.overwrite', overwrite); + grunt.task.run('gitcheckout:smart'); + }); + + // Bramble-task: smartPush + grunt.registerTask('smartPush', function(branch, force) { + force = force == "true" ? true : false; + + grunt.config('gitpush.smart.options.branch', branch); + grunt.config('gitpush.smart.options.force', force); + grunt.task.run('gitpush:smart'); + }); + + // Bramble-task: publish + grunt.registerTask('publish', 'Update submodules and the gh-pages branch with the latest built version of bramble.', function(patchLevel) { + var tasks = []; + + var date = new Date(Date.now()).toString(); + grunt.config("gitcommit.module.options.message", "Submodule update on " + date); + + // Confirm we're ready to start + tasks.push('checkBranch'); + + // Update submodules, commit and push to "master" + tasks.push('update_submodules:publish'); + tasks.push('gitadd:modules'); + tasks.push('gitcommit:module'); + tasks.push('smartPush:' + GIT_BRANCH + ":false"); + + // Update gh-pages with new dist + tasks.push('smartCheckout:gh-pages:true'); + tasks.push('build'); + tasks.push('gitadd:publish'); + tasks.push('gitcommit:publish'); + tasks.push('smartPush:gh-pages:true'); + + // Checkout back to the correct branch + tasks.push('smartCheckout:' + GIT_BRANCH); + + grunt.task.run(tasks); + }); + // task: install grunt.registerTask('install', ['write-config', 'less']); diff --git a/env.dist b/env.dist new file mode 100644 index 00000000000..40175734aea --- /dev/null +++ b/env.dist @@ -0,0 +1,11 @@ +## +# Config for Mozilla's Bramble adaptation of Brackets +# + +## Which branch is considered master? +export BRAMBLE_MAIN_BRANCH="bramble" + +## Which remote is considered upstream? +export BRAMBLE_MAIN_REMOTE="upstream" + + diff --git a/index.html b/index.html new file mode 100644 index 00000000000..ceeb586ee76 --- /dev/null +++ b/index.html @@ -0,0 +1,19 @@ + +
+ + + + + + +