Skip to content

Commit

Permalink
Fixed adobe#68 - Implemented submodule & gh-pages update task, "publish"
Browse files Browse the repository at this point in the history
  • Loading branch information
sedge committed Mar 12, 2015
1 parent 4b14a4f commit 329cbcf
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
142 changes: 139 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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']);

Expand Down
11 changes: 11 additions & 0 deletions env.dist
Original file line number Diff line number Diff line change
@@ -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"


19 changes: 19 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<iframe id="test" src="src" style="width: 100%; height: 100%;">
<p>Your browser does not support iframes.</p>
</iframe>
<script type="text/javascript">
var iframe = document.getElementById("test");
var data;

window.addEventListener("message", function(event){
data = JSON.parse(event.data);
console.log(data);
});
</script>
</body>
</html>
105 changes: 55 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,57 @@
{
"name": "Brackets",
"version": "1.3.0-0",
"apiVersion": "1.3.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/adobe/brackets.git",
"branch": "",
"SHA": ""
},
"devDependencies": {
"grunt": "0.4.1",
"jasmine-node": "1.11.0",
"grunt-jasmine-node": "0.1.0",
"grunt-cli": "0.1.9",
"phantomjs": "1.9.13",
"grunt-lib-phantomjs": "0.3.0",
"grunt-contrib-jshint": "0.6.0",
"grunt-contrib-watch": "0.4.3",
"grunt-contrib-jasmine": "0.4.2",
"grunt-template-jasmine-requirejs": "0.1.0",
"grunt-contrib-cssmin": "0.6.0",
"grunt-contrib-clean": "0.4.1",
"grunt-contrib-copy": "0.4.1",
"grunt-contrib-htmlmin": "0.1.3",
"grunt-contrib-less": "0.8.2",
"grunt-contrib-requirejs": "0.4.1",
"grunt-contrib-uglify": "0.8.0",
"grunt-contrib-concat": "0.3.0",
"grunt-targethtml": "0.2.6",
"grunt-usemin": "0.1.11",
"load-grunt-tasks": "0.2.0",
"q": "0.9.2",
"semver": "^4.1.0",
"jshint": "2.1.4",
"xmldoc": "^0.1.2"
},
"scripts": {
"postinstall": "grunt install",
"test": "grunt cla-check-pull test"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/adobe/brackets/blob/master/LICENSE"
}
]
"name": "Brackets",
"version": "1.3.0-0",
"apiVersion": "1.3.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/adobe/brackets.git",
"branch": "",
"SHA": ""
},
"devDependencies": {
"grunt": "0.4.1",
"grunt-cli": "0.1.9",
"grunt-contrib-clean": "0.4.1",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-copy": "0.4.1",
"grunt-contrib-cssmin": "0.6.0",
"grunt-contrib-htmlmin": "0.1.3",
"grunt-contrib-jasmine": "0.4.2",
"grunt-contrib-jshint": "0.6.0",
"grunt-contrib-less": "0.8.2",
"grunt-contrib-requirejs": "0.4.1",
"grunt-contrib-uglify": "0.2.0",
"grunt-contrib-watch": "0.4.3",
"grunt-git": "^0.3.4",
"grunt-jasmine-node": "0.1.0",
"grunt-lib-phantomjs": "0.3.0",
"grunt-npm": "git://github.com/sedge/grunt-npm.git#branchcheck",
"grunt-shell": "^1.1.2",
"grunt-targethtml": "0.2.6",
"grunt-template-jasmine-requirejs": "0.1.0",
"grunt-update-submodules": "^0.4.1",
"grunt-usemin": "0.1.11",
"habitat": "^3.1.2",
"jasmine-node": "1.11.0",
"jshint": "2.1.4",
"load-grunt-tasks": "0.2.0",
"phantomjs": "1.9.13",
"q": "0.9.2",
"semver": "^4.1.0",
"xmldoc": "^0.1.2"
},
"scripts": {
"postinstall": "grunt install",
"test": "grunt cla-check-pull test"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/adobe/brackets/blob/master/LICENSE"
}
]
}
26 changes: 15 additions & 11 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,33 @@
},
"devDependencies": {
"grunt": "0.4.1",
"jasmine-node": "1.11.0",
"grunt-jasmine-node": "0.1.0",
"grunt-cli": "0.1.9",
"phantomjs": "1.9.11",
"grunt-lib-phantomjs": "0.3.0",
"grunt-contrib-jshint": "0.6.0",
"grunt-contrib-watch": "0.4.3",
"grunt-contrib-jasmine": "0.4.2",
"grunt-template-jasmine-requirejs": "0.1.0",
"grunt-contrib-cssmin": "0.6.0",
"grunt-contrib-clean": "0.4.1",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-copy": "0.4.1",
"grunt-contrib-cssmin": "0.6.0",
"grunt-contrib-htmlmin": "0.1.3",
"grunt-contrib-jasmine": "0.4.2",
"grunt-contrib-jshint": "0.6.0",
"grunt-contrib-less": "0.8.2",
"grunt-contrib-requirejs": "0.4.1",
"grunt-contrib-uglify": "0.2.0",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-watch": "0.4.3",
"grunt-git": "^0.3.4",
"grunt-jasmine-node": "0.1.0",
"grunt-lib-phantomjs": "0.3.0",
"grunt-npm": "git://github.com/sedge/grunt-npm.git#branchcheck",
"grunt-shell": "^1.1.2",
"grunt-targethtml": "0.2.6",
"grunt-template-jasmine-requirejs": "0.1.0",
"grunt-usemin": "0.1.11",
"habitat": "^3.1.2",
"jasmine-node": "1.11.0",
"jshint": "2.1.4",
"load-grunt-tasks": "0.2.0",
"phantomjs": "1.9.13",
"q": "0.9.2",
"semver": "^4.1.0",
"jshint": "2.1.4",
"xmldoc": "^0.1.2"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/brackets-browser-livedev
Loading

0 comments on commit 329cbcf

Please sign in to comment.