mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
massive linting
This commit is contained in:
parent
5dc7fc0bed
commit
48dd558de1
8 changed files with 189 additions and 167 deletions
128
build/bundle.js
128
build/bundle.js
|
@ -1,4 +1,5 @@
|
|||
(function(){var require = function (file, cwd) {
|
||||
(function(){
|
||||
var require = function (file, cwd) {
|
||||
var resolved = require.resolve(file, cwd || '/');
|
||||
var mod = require.modules[resolved];
|
||||
if (!mod) throw new Error(
|
||||
|
@ -917,7 +918,7 @@ GitEngine.prototype.validateArgBounds = function(args, lower, upper, option) {
|
|||
GitEngine.prototype.oneArgImpliedHead = function(args, option) {
|
||||
// for log, show, etc
|
||||
this.validateArgBounds(args, 0, 1, option);
|
||||
if (args.length == 0) {
|
||||
if (args.length === 0) {
|
||||
args.push('HEAD');
|
||||
}
|
||||
};
|
||||
|
@ -955,7 +956,7 @@ GitEngine.prototype.revert = function(whichCommits) {
|
|||
animationResponse.toRebaseArray = toRebase.slice(0);
|
||||
animationResponse.rebaseSteps = [];
|
||||
|
||||
beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var afterSnapshot;
|
||||
|
||||
// now make a bunch of commits on top of where we are
|
||||
|
@ -1056,12 +1057,13 @@ GitEngine.prototype.commitStarter = function() {
|
|||
}
|
||||
|
||||
var msg = null;
|
||||
var args = null;
|
||||
if (this.commandOptions['-a']) {
|
||||
this.command.addWarning('No need to add files in this demo');
|
||||
}
|
||||
|
||||
if (this.commandOptions['-am']) {
|
||||
var args = this.commandOptions['-am'];
|
||||
args = this.commandOptions['-am'];
|
||||
this.validateArgBounds(args, 1, 1, '-am');
|
||||
|
||||
this.command.addWarning("Don't worry about adding files in this demo. I'll take " +
|
||||
|
@ -1071,7 +1073,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
}
|
||||
|
||||
if (this.commandOptions['-m']) {
|
||||
var args = this.commandOptions['-m'];
|
||||
args = this.commandOptions['-m'];
|
||||
this.validateArgBounds(args, 1, 1, '-m');
|
||||
msg = args[0];
|
||||
}
|
||||
|
@ -1090,7 +1092,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
|
||||
GitEngine.prototype.commit = function() {
|
||||
var targetCommit = this.getCommitFromRef(this.HEAD);
|
||||
var id = undefined;
|
||||
var id = null;
|
||||
|
||||
// if we want to ammend, go one above
|
||||
if (this.commandOptions['--amend']) {
|
||||
|
@ -1139,7 +1141,7 @@ GitEngine.prototype.resolveStringRef = function(ref) {
|
|||
// may be something like HEAD~2 or master^^
|
||||
var relativeRefs = [
|
||||
[/^([a-zA-Z0-9]+)~(\d+)\s*$/, function(matches) {
|
||||
return parseInt(matches[2]);
|
||||
return parseInt(matches[2], 10);
|
||||
}],
|
||||
[/^([a-zA-Z0-9]+)(\^+)\s*$/, function(matches) {
|
||||
return matches[2].length;
|
||||
|
@ -1196,7 +1198,7 @@ GitEngine.prototype.setTargetLocation = function(ref, target) {
|
|||
// sets whatever ref is (branch, HEAD, etc) to a target. so if
|
||||
// you pass in HEAD, and HEAD is pointing to a branch, it will update
|
||||
// the branch to that commit, not the HEAD
|
||||
var ref = this.getOneBeforeCommit(ref);
|
||||
ref = this.getOneBeforeCommit(ref);
|
||||
ref.set('target', target);
|
||||
};
|
||||
|
||||
|
@ -1281,7 +1283,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
//
|
||||
// hence we need to do a BFS search, with the commit date being the
|
||||
// value to sort off of (rather than just purely the level)
|
||||
if (numBack == 0) {
|
||||
if (numBack === 0) {
|
||||
return commit;
|
||||
}
|
||||
|
||||
|
@ -1308,7 +1310,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
numBack--;
|
||||
}
|
||||
|
||||
if (numBack !== 0 || pQueue.length == 0) {
|
||||
if (numBack !== 0 || pQueue.length === 0) {
|
||||
throw new GitError({
|
||||
msg: "Sorry, I can't go that many commits back"
|
||||
});
|
||||
|
@ -1338,7 +1340,7 @@ GitEngine.prototype.rebaseAltID = function(id) {
|
|||
// here we switch from C''' to C'^4
|
||||
return bits[0].slice(0, -3) + "'^4";
|
||||
}],
|
||||
[/^C(\d+)['][^](\d+)$/, function(bits) {
|
||||
[/^C(\d+)['][\^](\d+)$/, function(bits) {
|
||||
return 'C' + String(bits[1]) + "'^" + String(Number(bits[2]) + 1);
|
||||
}]
|
||||
];
|
||||
|
@ -1378,7 +1380,7 @@ GitEngine.prototype.idSortFunc = function(cA, cB) {
|
|||
// return the 4 from C4, plus the length of the quotes
|
||||
return scale * bits[1] + bits[2].length;
|
||||
}],
|
||||
[/^C(\d+)['][^](\d+)$/, function(bits) {
|
||||
[/^C(\d+)['][\^](\d+)$/, function(bits) {
|
||||
return scale * bits[1] + Number(bits[2]);
|
||||
}]
|
||||
];
|
||||
|
@ -1770,7 +1772,7 @@ GitEngine.prototype.branchStarter = function() {
|
|||
}
|
||||
|
||||
|
||||
if (this.generalArgs.length == 0) {
|
||||
if (this.generalArgs.length === 0) {
|
||||
this.printBranches(this.getBranches());
|
||||
return;
|
||||
}
|
||||
|
@ -2505,7 +2507,7 @@ var VisEdge = Tree.VisEdge;
|
|||
var Visualization = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
var _this = this;
|
||||
Raphael(10, 10, 200, 200, function() {
|
||||
new Raphael(10, 10, 200, 200, function() {
|
||||
|
||||
// for some reason raphael calls this function with a predefined
|
||||
// context...
|
||||
|
@ -2872,7 +2874,7 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
|
|||
var myWidthPos = (min + max) / 2.0;
|
||||
commit.get('visNode').get('pos').x = myWidthPos;
|
||||
|
||||
if (commit.get('children').length == 0) {
|
||||
if (commit.get('children').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3747,10 +3749,6 @@ var VisBranch = VisBase.extend({
|
|||
}
|
||||
},
|
||||
|
||||
getFill: function() {
|
||||
return this.get('fill');
|
||||
},
|
||||
|
||||
getID: function() {
|
||||
return this.get('branch').get('id');
|
||||
},
|
||||
|
@ -3844,7 +3842,7 @@ var VisBranch = VisBase.extend({
|
|||
return {
|
||||
x: pos.x - 0.5 * textSize.w - this.get('hPad'),
|
||||
y: pos.y - 0.5 * textSize.h - this.get('vPad')
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getArrowPath: function() {
|
||||
|
@ -3973,7 +3971,7 @@ var VisBranch = VisBase.extend({
|
|||
// - part of a multi branch, but your thing is hidden
|
||||
if (this.get('isHead') ||
|
||||
this.getBranchStackLength() == 1 ||
|
||||
this.getBranchStackIndex() != 0) {
|
||||
this.getBranchStackIndex() !== 0) {
|
||||
return this.get('fill');
|
||||
}
|
||||
|
||||
|
@ -4028,7 +4026,7 @@ var VisBranch = VisBase.extend({
|
|||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
return this.getBranchStackIndex() == 0 ? 1 : 0.0;
|
||||
return this.getBranchStackIndex() === 0 ? 1 : 0.0;
|
||||
},
|
||||
|
||||
getTextOpacity: function() {
|
||||
|
@ -4087,7 +4085,7 @@ var VisBranch = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('text').attr(attr.text);
|
||||
this.get('rect').attr(attr.rect);
|
||||
this.get('arrow').attr(attr.arrow);
|
||||
|
@ -4162,7 +4160,7 @@ var VisNode = VisBase.extend({
|
|||
|
||||
setDepthBasedOn: function(depthIncrement) {
|
||||
if (this.get('depth') === undefined) {
|
||||
debugger
|
||||
debugger;
|
||||
throw new Error('no depth yet!');
|
||||
}
|
||||
var pos = this.get('pos');
|
||||
|
@ -4263,7 +4261,7 @@ var VisNode = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('circle').attr(attr.circle);
|
||||
this.get('text').attr(attr.text);
|
||||
return;
|
||||
|
@ -4302,12 +4300,12 @@ var VisNode = VisBase.extend({
|
|||
cx: parentCoords.x,
|
||||
cy: parentCoords.y,
|
||||
opacity: 0,
|
||||
r: 0,
|
||||
r: 0
|
||||
});
|
||||
this.get('text').attr({
|
||||
x: parentCoords.x,
|
||||
y: parentCoords.y,
|
||||
opacity: 0,
|
||||
opacity: 0
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -4407,9 +4405,7 @@ var VisNode = VisBase.extend({
|
|||
}
|
||||
|
||||
// now we need to get branch hues
|
||||
|
||||
return this.gitVisuals.getBlendedHuesForCommit(this.get('commit'));
|
||||
return this.get('fill');
|
||||
},
|
||||
|
||||
attachClickHandlers: function() {
|
||||
|
@ -4632,7 +4628,7 @@ var VisEdge = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('path').attr(attr.path);
|
||||
return;
|
||||
}
|
||||
|
@ -4643,8 +4639,7 @@ var VisEdge = VisBase.extend({
|
|||
speed !== undefined ? speed : this.get('animationSpeed'),
|
||||
easing || this.get('animationEasing')
|
||||
);
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var VisEdgeCollection = Backbone.Collection.extend({
|
||||
|
@ -5136,8 +5131,7 @@ require.define("/miscViews.js",function(require,module,exports,__dirname,__filen
|
|||
this.rebaseCallback(toRebase);
|
||||
|
||||
this.$el.html('');
|
||||
// kill ourselves?
|
||||
delete this;
|
||||
// garbage collection will get us
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -5161,8 +5155,7 @@ require.define("/miscViews.js",function(require,module,exports,__dirname,__filen
|
|||
distance: 5,
|
||||
placeholder: 'ui-state-highlight'
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var RebaseEntry = Backbone.Model.extend({
|
||||
|
@ -7040,7 +7033,7 @@ GitEngine.prototype.validateArgBounds = function(args, lower, upper, option) {
|
|||
GitEngine.prototype.oneArgImpliedHead = function(args, option) {
|
||||
// for log, show, etc
|
||||
this.validateArgBounds(args, 0, 1, option);
|
||||
if (args.length == 0) {
|
||||
if (args.length === 0) {
|
||||
args.push('HEAD');
|
||||
}
|
||||
};
|
||||
|
@ -7078,7 +7071,7 @@ GitEngine.prototype.revert = function(whichCommits) {
|
|||
animationResponse.toRebaseArray = toRebase.slice(0);
|
||||
animationResponse.rebaseSteps = [];
|
||||
|
||||
beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var afterSnapshot;
|
||||
|
||||
// now make a bunch of commits on top of where we are
|
||||
|
@ -7179,12 +7172,13 @@ GitEngine.prototype.commitStarter = function() {
|
|||
}
|
||||
|
||||
var msg = null;
|
||||
var args = null;
|
||||
if (this.commandOptions['-a']) {
|
||||
this.command.addWarning('No need to add files in this demo');
|
||||
}
|
||||
|
||||
if (this.commandOptions['-am']) {
|
||||
var args = this.commandOptions['-am'];
|
||||
args = this.commandOptions['-am'];
|
||||
this.validateArgBounds(args, 1, 1, '-am');
|
||||
|
||||
this.command.addWarning("Don't worry about adding files in this demo. I'll take " +
|
||||
|
@ -7194,7 +7188,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
}
|
||||
|
||||
if (this.commandOptions['-m']) {
|
||||
var args = this.commandOptions['-m'];
|
||||
args = this.commandOptions['-m'];
|
||||
this.validateArgBounds(args, 1, 1, '-m');
|
||||
msg = args[0];
|
||||
}
|
||||
|
@ -7213,7 +7207,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
|
||||
GitEngine.prototype.commit = function() {
|
||||
var targetCommit = this.getCommitFromRef(this.HEAD);
|
||||
var id = undefined;
|
||||
var id = null;
|
||||
|
||||
// if we want to ammend, go one above
|
||||
if (this.commandOptions['--amend']) {
|
||||
|
@ -7262,7 +7256,7 @@ GitEngine.prototype.resolveStringRef = function(ref) {
|
|||
// may be something like HEAD~2 or master^^
|
||||
var relativeRefs = [
|
||||
[/^([a-zA-Z0-9]+)~(\d+)\s*$/, function(matches) {
|
||||
return parseInt(matches[2]);
|
||||
return parseInt(matches[2], 10);
|
||||
}],
|
||||
[/^([a-zA-Z0-9]+)(\^+)\s*$/, function(matches) {
|
||||
return matches[2].length;
|
||||
|
@ -7319,7 +7313,7 @@ GitEngine.prototype.setTargetLocation = function(ref, target) {
|
|||
// sets whatever ref is (branch, HEAD, etc) to a target. so if
|
||||
// you pass in HEAD, and HEAD is pointing to a branch, it will update
|
||||
// the branch to that commit, not the HEAD
|
||||
var ref = this.getOneBeforeCommit(ref);
|
||||
ref = this.getOneBeforeCommit(ref);
|
||||
ref.set('target', target);
|
||||
};
|
||||
|
||||
|
@ -7404,7 +7398,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
//
|
||||
// hence we need to do a BFS search, with the commit date being the
|
||||
// value to sort off of (rather than just purely the level)
|
||||
if (numBack == 0) {
|
||||
if (numBack === 0) {
|
||||
return commit;
|
||||
}
|
||||
|
||||
|
@ -7431,7 +7425,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
numBack--;
|
||||
}
|
||||
|
||||
if (numBack !== 0 || pQueue.length == 0) {
|
||||
if (numBack !== 0 || pQueue.length === 0) {
|
||||
throw new GitError({
|
||||
msg: "Sorry, I can't go that many commits back"
|
||||
});
|
||||
|
@ -7461,7 +7455,7 @@ GitEngine.prototype.rebaseAltID = function(id) {
|
|||
// here we switch from C''' to C'^4
|
||||
return bits[0].slice(0, -3) + "'^4";
|
||||
}],
|
||||
[/^C(\d+)['][^](\d+)$/, function(bits) {
|
||||
[/^C(\d+)['][\^](\d+)$/, function(bits) {
|
||||
return 'C' + String(bits[1]) + "'^" + String(Number(bits[2]) + 1);
|
||||
}]
|
||||
];
|
||||
|
@ -7501,7 +7495,7 @@ GitEngine.prototype.idSortFunc = function(cA, cB) {
|
|||
// return the 4 from C4, plus the length of the quotes
|
||||
return scale * bits[1] + bits[2].length;
|
||||
}],
|
||||
[/^C(\d+)['][^](\d+)$/, function(bits) {
|
||||
[/^C(\d+)['][\^](\d+)$/, function(bits) {
|
||||
return scale * bits[1] + Number(bits[2]);
|
||||
}]
|
||||
];
|
||||
|
@ -7893,7 +7887,7 @@ GitEngine.prototype.branchStarter = function() {
|
|||
}
|
||||
|
||||
|
||||
if (this.generalArgs.length == 0) {
|
||||
if (this.generalArgs.length === 0) {
|
||||
this.printBranches(this.getBranches());
|
||||
return;
|
||||
}
|
||||
|
@ -8522,8 +8516,7 @@ require.define("/miscViews.js",function(require,module,exports,__dirname,__filen
|
|||
this.rebaseCallback(toRebase);
|
||||
|
||||
this.$el.html('');
|
||||
// kill ourselves?
|
||||
delete this;
|
||||
// garbage collection will get us
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -8547,8 +8540,7 @@ require.define("/miscViews.js",function(require,module,exports,__dirname,__filen
|
|||
distance: 5,
|
||||
placeholder: 'ui-state-highlight'
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var RebaseEntry = Backbone.Model.extend({
|
||||
|
@ -8652,10 +8644,6 @@ var VisBranch = VisBase.extend({
|
|||
}
|
||||
},
|
||||
|
||||
getFill: function() {
|
||||
return this.get('fill');
|
||||
},
|
||||
|
||||
getID: function() {
|
||||
return this.get('branch').get('id');
|
||||
},
|
||||
|
@ -8749,7 +8737,7 @@ var VisBranch = VisBase.extend({
|
|||
return {
|
||||
x: pos.x - 0.5 * textSize.w - this.get('hPad'),
|
||||
y: pos.y - 0.5 * textSize.h - this.get('vPad')
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getArrowPath: function() {
|
||||
|
@ -8878,7 +8866,7 @@ var VisBranch = VisBase.extend({
|
|||
// - part of a multi branch, but your thing is hidden
|
||||
if (this.get('isHead') ||
|
||||
this.getBranchStackLength() == 1 ||
|
||||
this.getBranchStackIndex() != 0) {
|
||||
this.getBranchStackIndex() !== 0) {
|
||||
return this.get('fill');
|
||||
}
|
||||
|
||||
|
@ -8933,7 +8921,7 @@ var VisBranch = VisBase.extend({
|
|||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
return this.getBranchStackIndex() == 0 ? 1 : 0.0;
|
||||
return this.getBranchStackIndex() === 0 ? 1 : 0.0;
|
||||
},
|
||||
|
||||
getTextOpacity: function() {
|
||||
|
@ -8992,7 +8980,7 @@ var VisBranch = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('text').attr(attr.text);
|
||||
this.get('rect').attr(attr.rect);
|
||||
this.get('arrow').attr(attr.arrow);
|
||||
|
@ -9067,7 +9055,7 @@ var VisNode = VisBase.extend({
|
|||
|
||||
setDepthBasedOn: function(depthIncrement) {
|
||||
if (this.get('depth') === undefined) {
|
||||
debugger
|
||||
debugger;
|
||||
throw new Error('no depth yet!');
|
||||
}
|
||||
var pos = this.get('pos');
|
||||
|
@ -9168,7 +9156,7 @@ var VisNode = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('circle').attr(attr.circle);
|
||||
this.get('text').attr(attr.text);
|
||||
return;
|
||||
|
@ -9207,12 +9195,12 @@ var VisNode = VisBase.extend({
|
|||
cx: parentCoords.x,
|
||||
cy: parentCoords.y,
|
||||
opacity: 0,
|
||||
r: 0,
|
||||
r: 0
|
||||
});
|
||||
this.get('text').attr({
|
||||
x: parentCoords.x,
|
||||
y: parentCoords.y,
|
||||
opacity: 0,
|
||||
opacity: 0
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -9312,9 +9300,7 @@ var VisNode = VisBase.extend({
|
|||
}
|
||||
|
||||
// now we need to get branch hues
|
||||
|
||||
return this.gitVisuals.getBlendedHuesForCommit(this.get('commit'));
|
||||
return this.get('fill');
|
||||
},
|
||||
|
||||
attachClickHandlers: function() {
|
||||
|
@ -9537,7 +9523,7 @@ var VisEdge = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('path').attr(attr.path);
|
||||
return;
|
||||
}
|
||||
|
@ -9548,8 +9534,7 @@ var VisEdge = VisBase.extend({
|
|||
speed !== undefined ? speed : this.get('animationSpeed'),
|
||||
easing || this.get('animationEasing')
|
||||
);
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var VisEdgeCollection = Backbone.Collection.extend({
|
||||
|
@ -9588,7 +9573,7 @@ var VisEdge = Tree.VisEdge;
|
|||
var Visualization = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
var _this = this;
|
||||
Raphael(10, 10, 200, 200, function() {
|
||||
new Raphael(10, 10, 200, 200, function() {
|
||||
|
||||
// for some reason raphael calls this function with a predefined
|
||||
// context...
|
||||
|
@ -9955,7 +9940,7 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
|
|||
var myWidthPos = (min + max) / 2.0;
|
||||
commit.get('visNode').get('pos').x = myWidthPos;
|
||||
|
||||
if (commit.get('children').length == 0) {
|
||||
if (commit.get('children').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10252,4 +10237,5 @@ exports.Visualization = Visualization;
|
|||
|
||||
});
|
||||
require("/visuals.js");
|
||||
|
||||
})();
|
||||
|
|
61
grunt.js
61
grunt.js
|
@ -1,45 +1,68 @@
|
|||
/*global module:false*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// eventually have sound...?
|
||||
grunt.registerTask('compliment', function() {
|
||||
grunt.log.writeln('You are awesome!');
|
||||
grunt.registerTask('compliment', 'Stay motivated!', function() {
|
||||
var defaults = ['Awesome!!'];
|
||||
|
||||
var compliments = grunt.config('compliment.compliments') || defaults;
|
||||
var index = Math.floor(Math.random() * compliments.length);
|
||||
|
||||
grunt.log.writeln(compliments[index]);
|
||||
});
|
||||
|
||||
grunt.initConfig({
|
||||
lint: {
|
||||
files: ['grunt.js', 'src/*.js']
|
||||
},
|
||||
compliment: {
|
||||
compliments: [
|
||||
"Wow peter great work!",
|
||||
"Such a professional dev environment",
|
||||
"Can't stop the TRAIN",
|
||||
"git raging"
|
||||
]
|
||||
},
|
||||
/*
|
||||
jasmine_node: {
|
||||
specNameMatcher: "./spec", // load only specs containing specNameMatcher
|
||||
projectRoot: ".",
|
||||
specNameMatcher: './spec', // load only specs containing specNameMatcher
|
||||
projectRoot: '.',
|
||||
requirejs: false,
|
||||
forceExit: true,
|
||||
jUnit: {
|
||||
report: false,
|
||||
savePath : "./build/reports/jasmine/",
|
||||
savePath : './build/reports/jasmine/',
|
||||
useDotNotation: true,
|
||||
consolidate: true
|
||||
}
|
||||
},
|
||||
*/
|
||||
watch: {
|
||||
files: '<config:lint.files>',
|
||||
tasks: 'lint'
|
||||
},*/
|
||||
tasks: 'default'
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
curly: true,
|
||||
eqeqeq: true,
|
||||
// sometimes triple equality is just redundant and unnecessary
|
||||
eqeqeq: false,
|
||||
regexp: false,
|
||||
immed: true,
|
||||
latedef: true,
|
||||
latedef: false,
|
||||
nonew: false,
|
||||
newcap: true,
|
||||
noarg: true,
|
||||
bitwise: true,
|
||||
sub: true,
|
||||
undef: true,
|
||||
unused: false,
|
||||
trailing: true,
|
||||
devel: true,
|
||||
jquery: true,
|
||||
nonstandard: true,
|
||||
boss: true,
|
||||
eqnull: true,
|
||||
browser: true
|
||||
browser: true,
|
||||
debug: true
|
||||
},
|
||||
globals: {
|
||||
_: true,
|
||||
|
@ -53,12 +76,26 @@ module.exports = function(grunt) {
|
|||
it: true,
|
||||
exports: true
|
||||
}
|
||||
},
|
||||
browserify: {
|
||||
'build/bundle.js': {
|
||||
//requires: ['traverse'],
|
||||
// aliases: ['jquery:jquery-browserify'],
|
||||
entries: ['src/*.js'],
|
||||
//prepend: ['<banner:meta.banner>'],
|
||||
append: [],
|
||||
/*hook: function (bundle) {
|
||||
// Do something with bundle
|
||||
}*/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//grunt.loadNpmTasks('grunt-jasmine-node');
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-jslint');
|
||||
|
||||
// Default task.
|
||||
grunt.registerTask('default', 'lint compliment'); //jasmine_node');
|
||||
grunt.registerTask('default', 'browserify compliment'); //jasmine_node');
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"devDependencies": {
|
||||
"grunt": "latest",
|
||||
"browserify": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"grunt-browserify": "~0.1.2",
|
||||
"grunt-jslint": "~0.2.2-1"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
53
src/git.js
53
src/git.js
|
@ -387,7 +387,7 @@ GitEngine.prototype.validateArgBounds = function(args, lower, upper, option) {
|
|||
GitEngine.prototype.oneArgImpliedHead = function(args, option) {
|
||||
// for log, show, etc
|
||||
this.validateArgBounds(args, 0, 1, option);
|
||||
if (args.length == 0) {
|
||||
if (args.length === 0) {
|
||||
args.push('HEAD');
|
||||
}
|
||||
};
|
||||
|
@ -425,7 +425,7 @@ GitEngine.prototype.revert = function(whichCommits) {
|
|||
animationResponse.toRebaseArray = toRebase.slice(0);
|
||||
animationResponse.rebaseSteps = [];
|
||||
|
||||
beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var afterSnapshot;
|
||||
|
||||
// now make a bunch of commits on top of where we are
|
||||
|
@ -526,12 +526,13 @@ GitEngine.prototype.commitStarter = function() {
|
|||
}
|
||||
|
||||
var msg = null;
|
||||
var args = null;
|
||||
if (this.commandOptions['-a']) {
|
||||
this.command.addWarning('No need to add files in this demo');
|
||||
}
|
||||
|
||||
if (this.commandOptions['-am']) {
|
||||
var args = this.commandOptions['-am'];
|
||||
args = this.commandOptions['-am'];
|
||||
this.validateArgBounds(args, 1, 1, '-am');
|
||||
|
||||
this.command.addWarning("Don't worry about adding files in this demo. I'll take " +
|
||||
|
@ -541,7 +542,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
}
|
||||
|
||||
if (this.commandOptions['-m']) {
|
||||
var args = this.commandOptions['-m'];
|
||||
args = this.commandOptions['-m'];
|
||||
this.validateArgBounds(args, 1, 1, '-m');
|
||||
msg = args[0];
|
||||
}
|
||||
|
@ -560,7 +561,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
|
||||
GitEngine.prototype.commit = function() {
|
||||
var targetCommit = this.getCommitFromRef(this.HEAD);
|
||||
var id = undefined;
|
||||
var id = null;
|
||||
|
||||
// if we want to ammend, go one above
|
||||
if (this.commandOptions['--amend']) {
|
||||
|
@ -609,7 +610,7 @@ GitEngine.prototype.resolveStringRef = function(ref) {
|
|||
// may be something like HEAD~2 or master^^
|
||||
var relativeRefs = [
|
||||
[/^([a-zA-Z0-9]+)~(\d+)\s*$/, function(matches) {
|
||||
return parseInt(matches[2]);
|
||||
return parseInt(matches[2], 10);
|
||||
}],
|
||||
[/^([a-zA-Z0-9]+)(\^+)\s*$/, function(matches) {
|
||||
return matches[2].length;
|
||||
|
@ -666,7 +667,7 @@ GitEngine.prototype.setTargetLocation = function(ref, target) {
|
|||
// sets whatever ref is (branch, HEAD, etc) to a target. so if
|
||||
// you pass in HEAD, and HEAD is pointing to a branch, it will update
|
||||
// the branch to that commit, not the HEAD
|
||||
var ref = this.getOneBeforeCommit(ref);
|
||||
ref = this.getOneBeforeCommit(ref);
|
||||
ref.set('target', target);
|
||||
};
|
||||
|
||||
|
@ -751,7 +752,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
//
|
||||
// hence we need to do a BFS search, with the commit date being the
|
||||
// value to sort off of (rather than just purely the level)
|
||||
if (numBack == 0) {
|
||||
if (numBack === 0) {
|
||||
return commit;
|
||||
}
|
||||
|
||||
|
@ -778,7 +779,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
numBack--;
|
||||
}
|
||||
|
||||
if (numBack !== 0 || pQueue.length == 0) {
|
||||
if (numBack !== 0 || pQueue.length === 0) {
|
||||
throw new GitError({
|
||||
msg: "Sorry, I can't go that many commits back"
|
||||
});
|
||||
|
@ -808,7 +809,7 @@ GitEngine.prototype.rebaseAltID = function(id) {
|
|||
// here we switch from C''' to C'^4
|
||||
return bits[0].slice(0, -3) + "'^4";
|
||||
}],
|
||||
[/^C(\d+)['][^](\d+)$/, function(bits) {
|
||||
[/^C(\d+)['][\^](\d+)$/, function(bits) {
|
||||
return 'C' + String(bits[1]) + "'^" + String(Number(bits[2]) + 1);
|
||||
}]
|
||||
];
|
||||
|
@ -848,7 +849,7 @@ GitEngine.prototype.idSortFunc = function(cA, cB) {
|
|||
// return the 4 from C4, plus the length of the quotes
|
||||
return scale * bits[1] + bits[2].length;
|
||||
}],
|
||||
[/^C(\d+)['][^](\d+)$/, function(bits) {
|
||||
[/^C(\d+)['][\^](\d+)$/, function(bits) {
|
||||
return scale * bits[1] + Number(bits[2]);
|
||||
}]
|
||||
];
|
||||
|
@ -863,7 +864,7 @@ GitEngine.prototype.idSortFunc = function(cA, cB) {
|
|||
}
|
||||
}
|
||||
throw new Error('Could not parse commit ID ' + id);
|
||||
}
|
||||
};
|
||||
|
||||
return getNumToSort(cA.get('id')) - getNumToSort(cB.get('id'));
|
||||
};
|
||||
|
@ -924,7 +925,7 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
|||
// then we BFS from currentLocation, using the downstream set as our stopping point.
|
||||
// we need to BFS because we need to include all commits below
|
||||
// pop these commits on top of targetSource and modify their ids with quotes
|
||||
var stopSet = this.getUpstreamSet(targetSource)
|
||||
var stopSet = this.getUpstreamSet(targetSource);
|
||||
|
||||
// now BFS from here on out
|
||||
var toRebaseRough = [];
|
||||
|
@ -1151,14 +1152,15 @@ GitEngine.prototype.merge = function(targetSource, currentLocation) {
|
|||
}
|
||||
);
|
||||
|
||||
this.setTargetLocation(currentLocation, mergeCommit)
|
||||
this.setTargetLocation(currentLocation, mergeCommit);
|
||||
return mergeCommit;
|
||||
};
|
||||
|
||||
GitEngine.prototype.checkoutStarter = function() {
|
||||
var args = null;
|
||||
if (this.commandOptions['-b']) {
|
||||
// the user is really trying to just make a branch and then switch to it. so first:
|
||||
var args = this.commandOptions['-b'];
|
||||
args = this.commandOptions['-b'];
|
||||
this.twoArgsImpliedHead(args, '-b');
|
||||
|
||||
var validId = this.validateBranchName(args[0]);
|
||||
|
@ -1180,7 +1182,7 @@ GitEngine.prototype.checkoutStarter = function() {
|
|||
}
|
||||
|
||||
if (this.commandOptions['-B']) {
|
||||
var args = this.commandOptions['-B'];
|
||||
args = this.commandOptions['-B'];
|
||||
this.twoArgsImpliedHead(args, '-B');
|
||||
|
||||
this.forceBranch(args[0], args[1]);
|
||||
|
@ -1240,7 +1242,7 @@ GitEngine.prototype.branchStarter = function() {
|
|||
}
|
||||
|
||||
|
||||
if (this.generalArgs.length == 0) {
|
||||
if (this.generalArgs.length === 0) {
|
||||
this.printBranches(this.getBranches());
|
||||
return;
|
||||
}
|
||||
|
@ -1305,7 +1307,7 @@ GitEngine.prototype.deleteBranch = function(name) {
|
|||
|
||||
GitEngine.prototype.unescapeQuotes = function(str) {
|
||||
return str.replace(/'/g, "'");
|
||||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.dispatch = function(command, callback) {
|
||||
// current command, options, and args are stored in the gitEngine
|
||||
|
@ -1489,14 +1491,17 @@ GitEngine.prototype.getUpstreamSet = function(ancestor) {
|
|||
|
||||
var exploredSet = {};
|
||||
exploredSet[ancestorID] = true;
|
||||
|
||||
var addToExplored = function(rent) {
|
||||
exploredSet[rent.get('id')] = true;
|
||||
queue.push(rent);
|
||||
};
|
||||
|
||||
while (queue.length) {
|
||||
var here = queue.pop();
|
||||
var rents = here.get('parents');
|
||||
|
||||
_.each(rents, function(rent) {
|
||||
exploredSet[rent.get('id')] = true;
|
||||
queue.push(rent);
|
||||
});
|
||||
_.each(rents, addToExplored);
|
||||
}
|
||||
return exploredSet;
|
||||
};
|
||||
|
@ -1535,7 +1540,7 @@ var Ref = Backbone.Model.extend({
|
|||
|
||||
var Branch = Ref.extend({
|
||||
defaults: {
|
||||
visBranch: null,
|
||||
visBranch: null
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
|
@ -1583,7 +1588,7 @@ var Commit = Backbone.Model.extend({
|
|||
'+++ bigGameResults.html',
|
||||
'@@ 13,27 @@ Winner, Score',
|
||||
'- Stanfurd, 14-7',
|
||||
'+ Cal, 21-14',
|
||||
'+ Cal, 21-14'
|
||||
].join('\n') + '\n';
|
||||
},
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ var InteractiveRebaseView = Backbone.View.extend({
|
|||
this.rebaseCallback(toRebase);
|
||||
|
||||
this.$el.html('');
|
||||
// kill ourselves?
|
||||
delete this;
|
||||
// garbage collection will get us
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -99,8 +98,7 @@ var InteractiveRebaseView = Backbone.View.extend({
|
|||
distance: 5,
|
||||
placeholder: 'ui-state-highlight'
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var RebaseEntry = Backbone.Model.extend({
|
||||
|
|
27
src/tree.js
27
src/tree.js
|
@ -51,10 +51,6 @@ var VisBranch = VisBase.extend({
|
|||
}
|
||||
},
|
||||
|
||||
getFill: function() {
|
||||
return this.get('fill');
|
||||
},
|
||||
|
||||
getID: function() {
|
||||
return this.get('branch').get('id');
|
||||
},
|
||||
|
@ -148,7 +144,7 @@ var VisBranch = VisBase.extend({
|
|||
return {
|
||||
x: pos.x - 0.5 * textSize.w - this.get('hPad'),
|
||||
y: pos.y - 0.5 * textSize.h - this.get('vPad')
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getArrowPath: function() {
|
||||
|
@ -277,7 +273,7 @@ var VisBranch = VisBase.extend({
|
|||
// - part of a multi branch, but your thing is hidden
|
||||
if (this.get('isHead') ||
|
||||
this.getBranchStackLength() == 1 ||
|
||||
this.getBranchStackIndex() != 0) {
|
||||
this.getBranchStackIndex() !== 0) {
|
||||
return this.get('fill');
|
||||
}
|
||||
|
||||
|
@ -332,7 +328,7 @@ var VisBranch = VisBase.extend({
|
|||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
return this.getBranchStackIndex() == 0 ? 1 : 0.0;
|
||||
return this.getBranchStackIndex() === 0 ? 1 : 0.0;
|
||||
},
|
||||
|
||||
getTextOpacity: function() {
|
||||
|
@ -391,7 +387,7 @@ var VisBranch = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('text').attr(attr.text);
|
||||
this.get('rect').attr(attr.rect);
|
||||
this.get('arrow').attr(attr.arrow);
|
||||
|
@ -466,7 +462,7 @@ var VisNode = VisBase.extend({
|
|||
|
||||
setDepthBasedOn: function(depthIncrement) {
|
||||
if (this.get('depth') === undefined) {
|
||||
debugger
|
||||
debugger;
|
||||
throw new Error('no depth yet!');
|
||||
}
|
||||
var pos = this.get('pos');
|
||||
|
@ -567,7 +563,7 @@ var VisNode = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('circle').attr(attr.circle);
|
||||
this.get('text').attr(attr.text);
|
||||
return;
|
||||
|
@ -606,12 +602,12 @@ var VisNode = VisBase.extend({
|
|||
cx: parentCoords.x,
|
||||
cy: parentCoords.y,
|
||||
opacity: 0,
|
||||
r: 0,
|
||||
r: 0
|
||||
});
|
||||
this.get('text').attr({
|
||||
x: parentCoords.x,
|
||||
y: parentCoords.y,
|
||||
opacity: 0,
|
||||
opacity: 0
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -711,9 +707,7 @@ var VisNode = VisBase.extend({
|
|||
}
|
||||
|
||||
// now we need to get branch hues
|
||||
|
||||
return this.gitVisuals.getBlendedHuesForCommit(this.get('commit'));
|
||||
return this.get('fill');
|
||||
},
|
||||
|
||||
attachClickHandlers: function() {
|
||||
|
@ -936,7 +930,7 @@ var VisEdge = VisBase.extend({
|
|||
},
|
||||
|
||||
animateToAttr: function(attr, speed, easing) {
|
||||
if (speed == 0) {
|
||||
if (speed === 0) {
|
||||
this.get('path').attr(attr.path);
|
||||
return;
|
||||
}
|
||||
|
@ -947,8 +941,7 @@ var VisEdge = VisBase.extend({
|
|||
speed !== undefined ? speed : this.get('animationSpeed'),
|
||||
easing || this.get('animationEasing')
|
||||
);
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var VisEdgeCollection = Backbone.Collection.extend({
|
||||
|
|
|
@ -16,7 +16,7 @@ var VisEdge = Tree.VisEdge;
|
|||
var Visualization = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
var _this = this;
|
||||
Raphael(10, 10, 200, 200, function() {
|
||||
new Raphael(10, 10, 200, 200, function() {
|
||||
|
||||
// for some reason raphael calls this function with a predefined
|
||||
// context...
|
||||
|
@ -383,7 +383,7 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
|
|||
var myWidthPos = (min + max) / 2.0;
|
||||
commit.get('visNode').get('pos').x = myWidthPos;
|
||||
|
||||
if (commit.get('children').length == 0) {
|
||||
if (commit.get('children').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue