AWESOME origin compare within trees and levels, visualizations down, finish animation chain fixed, everything is awesome here. ready fororigin levels

This commit is contained in:
Peter Cottle 2013-07-24 21:41:53 -07:00
parent 7a00bd09f6
commit c4ae821cef
12 changed files with 203 additions and 60 deletions

View file

@ -6401,23 +6401,7 @@ var Level = Sandbox.extend({
getCommandsThatCount: function() { getCommandsThatCount: function() {
var GitCommands = require('../git/commands'); var GitCommands = require('../git/commands');
var toCount = [ return GitCommands.commandsThatCount;
'git commit',
'git checkout',
'git rebase',
'git reset',
'git branch',
'git revert',
'git merge',
'git cherry-pick'
];
var myRegexMap = {};
_.each(toCount, function(method) {
if (!GitCommands.regexMap[method]) { throw new Error('wut no regex'); }
myRegexMap[method] = GitCommands.regexMap[method];
});
return myRegexMap;
}, },
undo: function() { undo: function() {
@ -6489,9 +6473,13 @@ var Level = Sandbox.extend({
Constants.GLOBAL.isAnimating = true; Constants.GLOBAL.isAnimating = true;
var skipFinishDialog = this.testOption('noFinishDialog'); var skipFinishDialog = this.testOption('noFinishDialog');
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation(); var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
if (this.mainVis.originVis) {
finishAnimationChain = finishAnimationChain.then(
this.mainVis.originVis.gitVisuals.finishAnimation()
);
}
if (!skipFinishDialog) { if (!skipFinishDialog) {
finishAnimationChain = finishAnimationChain finishAnimationChain = finishAnimationChain.then(function() {
.then(function() {
// we want to ask if they will move onto the next level // we want to ask if they will move onto the next level
// while giving them their results... // while giving them their results...
var nextDialog = new NextLevelConfirm({ var nextDialog = new NextLevelConfirm({
@ -6983,6 +6971,11 @@ var Visualization = Backbone.View.extend({
left: left + 'px', left: left + 'px',
top: top + 'px' top: top + 'px'
}); });
} else {
// set position to absolute so we all stack nicely
$(this.paper.canvas).css({
position: 'absolute'
});
} }
this.paper.setSize(width, height); this.paper.setSize(width, height);
@ -7360,6 +7353,11 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
if (tree.originTree) { if (tree.originTree) {
var treeString = JSON.stringify(tree.originTree); var treeString = JSON.stringify(tree.originTree);
// if we dont have an animation queue (like when loading
// right away), just go ahead and make an empty one
this.animationQueue = this.animationQueue || new AnimationQueue({
callback: function() {}
});
this.makeOrigin(treeString); this.makeOrigin(treeString);
} }
}; };
@ -13886,6 +13884,31 @@ var regexMap = {
'git clone': /^git +clone *?$/ 'git clone': /^git +clone *?$/
}; };
/**
* Maintain this list to keep track of which commands we track
* for the "git golf" minigame
*/
var commandsThatCount = (function() {
var toCount = [
'git commit',
'git checkout',
'git rebase',
'git reset',
'git branch',
'git revert',
'git merge',
'git clone',
'git cherry-pick'
];
var whichCountMap = {};
_.each(toCount, function(method) {
if (!regexMap[method]) { throw new Error('wut no regex'); }
whichCountMap[method] = regexMap[method];
});
return whichCountMap;
})();
var parse = function(str) { var parse = function(str) {
var method; var method;
var options; var options;
@ -14017,6 +14040,7 @@ GitOptionParser.prototype.explodeAndSet = function() {
}; };
exports.shortcutMap = shortcutMap; exports.shortcutMap = shortcutMap;
exports.commandsThatCount = commandsThatCount;
exports.instantCommands = instantCommands; exports.instantCommands = instantCommands;
exports.parse = parse; exports.parse = parse;
exports.regexMap = regexMap; exports.regexMap = regexMap;
@ -18242,6 +18266,9 @@ exports.levelSequences = {
require('../../levels/rampup/relativeRefs2').level, require('../../levels/rampup/relativeRefs2').level,
require('../../levels/rampup/reversingChanges').level require('../../levels/rampup/reversingChanges').level
], ],
remote: [
require('../../levels/remote/clone').level
],
rebase: [ rebase: [
require('../../levels/rebase/manyRebases').level require('../../levels/rebase/manyRebases').level
], ],
@ -18288,6 +18315,14 @@ exports.sequenceInfo = {
'zh_CN': '接下来是git的超赞特性。迫不及待了吧' 'zh_CN': '接下来是git的超赞特性。迫不及待了吧'
} }
}, },
remote: {
displayName: {
'en_US': 'Push & Pull -- Git Remotes!'
},
about: {
'en_US': 'Time to share your 1\'s and 0\'s kids; coding just got social'
}
},
rebase: { rebase: {
displayName: { displayName: {
'en_US': 'Master the Rebase Luke!', 'en_US': 'Master the Rebase Luke!',
@ -20544,6 +20579,19 @@ require.define("/levels/rampup/reversingChanges.js",function(require,module,expo
}); });
require.define("/levels/remote/clone.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"remoteTrackingBranch\":null,\"remote\":false,\"target\":\"C1\",\"id\":\"master\",\"type\":\"branch\"}},\"commits\":{\"C0\":{\"type\":\"commit\",\"parents\":[],\"author\":\"Peter Cottle\",\"createTime\":\"Wed Jul 24 2013 21:27:52 GMT-0700 (PDT)\",\"commitMessage\":\"Quick commit. Go Bears!\",\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"type\":\"commit\",\"parents\":[\"C0\"],\"author\":\"Peter Cottle\",\"createTime\":\"Wed Jul 24 2013 21:27:52 GMT-0700 (PDT)\",\"commitMessage\":\"Quick commit. Go Bears!\",\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\",\"type\":\"general ref\"}}}",
"solutionCommand": "git clone",
"name": {
"en_US": "The Clone Wars"
},
"hint": {
"en_US": "Just use \"git clone\" to finish the level, but make sure you understand the tutorial!"
}
};
});
require.define("/levels/rebase/manyRebases.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = { require.define("/levels/rebase/manyRebases.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
"compareOnlyMasterHashAgnostic": true, "compareOnlyMasterHashAgnostic": true,
"disabledMap": { "disabledMap": {
@ -23386,6 +23434,31 @@ var regexMap = {
'git clone': /^git +clone *?$/ 'git clone': /^git +clone *?$/
}; };
/**
* Maintain this list to keep track of which commands we track
* for the "git golf" minigame
*/
var commandsThatCount = (function() {
var toCount = [
'git commit',
'git checkout',
'git rebase',
'git reset',
'git branch',
'git revert',
'git merge',
'git clone',
'git cherry-pick'
];
var whichCountMap = {};
_.each(toCount, function(method) {
if (!regexMap[method]) { throw new Error('wut no regex'); }
whichCountMap[method] = regexMap[method];
});
return whichCountMap;
})();
var parse = function(str) { var parse = function(str) {
var method; var method;
var options; var options;
@ -23517,6 +23590,7 @@ GitOptionParser.prototype.explodeAndSet = function() {
}; };
exports.shortcutMap = shortcutMap; exports.shortcutMap = shortcutMap;
exports.commandsThatCount = commandsThatCount;
exports.instantCommands = instantCommands; exports.instantCommands = instantCommands;
exports.parse = parse; exports.parse = parse;
exports.regexMap = regexMap; exports.regexMap = regexMap;
@ -23958,6 +24032,11 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
if (tree.originTree) { if (tree.originTree) {
var treeString = JSON.stringify(tree.originTree); var treeString = JSON.stringify(tree.originTree);
// if we dont have an animation queue (like when loading
// right away), just go ahead and make an empty one
this.animationQueue = this.animationQueue || new AnimationQueue({
callback: function() {}
});
this.makeOrigin(treeString); this.makeOrigin(treeString);
} }
}; };
@ -28112,23 +28191,7 @@ var Level = Sandbox.extend({
getCommandsThatCount: function() { getCommandsThatCount: function() {
var GitCommands = require('../git/commands'); var GitCommands = require('../git/commands');
var toCount = [ return GitCommands.commandsThatCount;
'git commit',
'git checkout',
'git rebase',
'git reset',
'git branch',
'git revert',
'git merge',
'git cherry-pick'
];
var myRegexMap = {};
_.each(toCount, function(method) {
if (!GitCommands.regexMap[method]) { throw new Error('wut no regex'); }
myRegexMap[method] = GitCommands.regexMap[method];
});
return myRegexMap;
}, },
undo: function() { undo: function() {
@ -28200,9 +28263,13 @@ var Level = Sandbox.extend({
Constants.GLOBAL.isAnimating = true; Constants.GLOBAL.isAnimating = true;
var skipFinishDialog = this.testOption('noFinishDialog'); var skipFinishDialog = this.testOption('noFinishDialog');
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation(); var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
if (this.mainVis.originVis) {
finishAnimationChain = finishAnimationChain.then(
this.mainVis.originVis.gitVisuals.finishAnimation()
);
}
if (!skipFinishDialog) { if (!skipFinishDialog) {
finishAnimationChain = finishAnimationChain finishAnimationChain = finishAnimationChain.then(function() {
.then(function() {
// we want to ask if they will move onto the next level // we want to ask if they will move onto the next level
// while giving them their results... // while giving them their results...
var nextDialog = new NextLevelConfirm({ var nextDialog = new NextLevelConfirm({
@ -35268,6 +35335,11 @@ var Visualization = Backbone.View.extend({
left: left + 'px', left: left + 'px',
top: top + 'px' top: top + 'px'
}); });
} else {
// set position to absolute so we all stack nicely
$(this.paper.canvas).css({
position: 'absolute'
});
} }
this.paper.setSize(width, height); this.paper.setSize(width, height);
@ -35489,6 +35561,9 @@ exports.levelSequences = {
require('../../levels/rampup/relativeRefs2').level, require('../../levels/rampup/relativeRefs2').level,
require('../../levels/rampup/reversingChanges').level require('../../levels/rampup/reversingChanges').level
], ],
remote: [
require('../../levels/remote/clone').level
],
rebase: [ rebase: [
require('../../levels/rebase/manyRebases').level require('../../levels/rebase/manyRebases').level
], ],
@ -35535,6 +35610,14 @@ exports.sequenceInfo = {
'zh_CN': '接下来是git的超赞特性。迫不及待了吧' 'zh_CN': '接下来是git的超赞特性。迫不及待了吧'
} }
}, },
remote: {
displayName: {
'en_US': 'Push & Pull -- Git Remotes!'
},
about: {
'en_US': 'Time to share your 1\'s and 0\'s kids; coding just got social'
}
},
rebase: { rebase: {
displayName: { displayName: {
'en_US': 'Master the Rebase Luke!', 'en_US': 'Master the Rebase Luke!',
@ -38602,4 +38685,18 @@ require.define("/src/levels/rebase/selectiveRebase.js",function(require,module,e
}); });
require("/src/levels/rebase/selectiveRebase.js"); require("/src/levels/rebase/selectiveRebase.js");
require.define("/src/levels/remote/clone.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"remoteTrackingBranch\":null,\"remote\":false,\"target\":\"C1\",\"id\":\"master\",\"type\":\"branch\"}},\"commits\":{\"C0\":{\"type\":\"commit\",\"parents\":[],\"author\":\"Peter Cottle\",\"createTime\":\"Wed Jul 24 2013 21:27:52 GMT-0700 (PDT)\",\"commitMessage\":\"Quick commit. Go Bears!\",\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"type\":\"commit\",\"parents\":[\"C0\"],\"author\":\"Peter Cottle\",\"createTime\":\"Wed Jul 24 2013 21:27:52 GMT-0700 (PDT)\",\"commitMessage\":\"Quick commit. Go Bears!\",\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\",\"type\":\"general ref\"}}}",
"solutionCommand": "git clone",
"name": {
"en_US": "The Clone Wars"
},
"hint": {
"en_US": "Just use \"git clone\" to finish the level, but make sure you understand the tutorial!"
}
};
});
require("/src/levels/remote/clone.js");
})(); })();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
build/bundle.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -434,7 +434,7 @@
For a much easier time perusing the source, see the individual files at: For a much easier time perusing the source, see the individual files at:
https://github.com/pcottle/learnGitBranching https://github.com/pcottle/learnGitBranching
--> -->
<script src="build/bundle.min.0cc3ab99.js"></script> <script src="build/bundle.min.9a44e3c7.js"></script>
<!-- The advantage of github pages: super-easy, simple, slick static hostic. <!-- The advantage of github pages: super-easy, simple, slick static hostic.
The downside? No raw logs to parse for analytics, so I have to include The downside? No raw logs to parse for analytics, so I have to include

View file

@ -69,6 +69,31 @@ var regexMap = {
'git clone': /^git +clone *?$/ 'git clone': /^git +clone *?$/
}; };
/**
* Maintain this list to keep track of which commands we track
* for the "git golf" minigame
*/
var commandsThatCount = (function() {
var toCount = [
'git commit',
'git checkout',
'git rebase',
'git reset',
'git branch',
'git revert',
'git merge',
'git clone',
'git cherry-pick'
];
var whichCountMap = {};
_.each(toCount, function(method) {
if (!regexMap[method]) { throw new Error('wut no regex'); }
whichCountMap[method] = regexMap[method];
});
return whichCountMap;
})();
var parse = function(str) { var parse = function(str) {
var method; var method;
var options; var options;
@ -200,6 +225,7 @@ GitOptionParser.prototype.explodeAndSet = function() {
}; };
exports.shortcutMap = shortcutMap; exports.shortcutMap = shortcutMap;
exports.commandsThatCount = commandsThatCount;
exports.instantCommands = instantCommands; exports.instantCommands = instantCommands;
exports.parse = parse; exports.parse = parse;
exports.regexMap = regexMap; exports.regexMap = regexMap;

View file

@ -230,6 +230,11 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
if (tree.originTree) { if (tree.originTree) {
var treeString = JSON.stringify(tree.originTree); var treeString = JSON.stringify(tree.originTree);
// if we dont have an animation queue (like when loading
// right away), just go ahead and make an empty one
this.animationQueue = this.animationQueue || new AnimationQueue({
callback: function() {}
});
this.makeOrigin(treeString); this.makeOrigin(treeString);
} }
}; };

View file

@ -299,23 +299,7 @@ var Level = Sandbox.extend({
getCommandsThatCount: function() { getCommandsThatCount: function() {
var GitCommands = require('../git/commands'); var GitCommands = require('../git/commands');
var toCount = [ return GitCommands.commandsThatCount;
'git commit',
'git checkout',
'git rebase',
'git reset',
'git branch',
'git revert',
'git merge',
'git cherry-pick'
];
var myRegexMap = {};
_.each(toCount, function(method) {
if (!GitCommands.regexMap[method]) { throw new Error('wut no regex'); }
myRegexMap[method] = GitCommands.regexMap[method];
});
return myRegexMap;
}, },
undo: function() { undo: function() {
@ -387,9 +371,13 @@ var Level = Sandbox.extend({
Constants.GLOBAL.isAnimating = true; Constants.GLOBAL.isAnimating = true;
var skipFinishDialog = this.testOption('noFinishDialog'); var skipFinishDialog = this.testOption('noFinishDialog');
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation(); var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
if (this.mainVis.originVis) {
finishAnimationChain = finishAnimationChain.then(
this.mainVis.originVis.gitVisuals.finishAnimation()
);
}
if (!skipFinishDialog) { if (!skipFinishDialog) {
finishAnimationChain = finishAnimationChain finishAnimationChain = finishAnimationChain.then(function() {
.then(function() {
// we want to ask if they will move onto the next level // we want to ask if they will move onto the next level
// while giving them their results... // while giving them their results...
var nextDialog = new NextLevelConfirm({ var nextDialog = new NextLevelConfirm({

View file

@ -250,6 +250,11 @@ var Visualization = Backbone.View.extend({
left: left + 'px', left: left + 'px',
top: top + 'px' top: top + 'px'
}); });
} else {
// set position to absolute so we all stack nicely
$(this.paper.canvas).css({
position: 'absolute'
});
} }
this.paper.setSize(width, height); this.paper.setSize(width, height);

View file

@ -13,6 +13,9 @@ exports.levelSequences = {
require('../../levels/rampup/relativeRefs2').level, require('../../levels/rampup/relativeRefs2').level,
require('../../levels/rampup/reversingChanges').level require('../../levels/rampup/reversingChanges').level
], ],
remote: [
require('../../levels/remote/clone').level
],
rebase: [ rebase: [
require('../../levels/rebase/manyRebases').level require('../../levels/rebase/manyRebases').level
], ],
@ -59,6 +62,14 @@ exports.sequenceInfo = {
'zh_CN': '接下来是git的超赞特性。迫不及待了吧' 'zh_CN': '接下来是git的超赞特性。迫不及待了吧'
} }
}, },
remote: {
displayName: {
'en_US': 'Push & Pull -- Git Remotes!'
},
about: {
'en_US': 'Time to share your 1\'s and 0\'s kids; coding just got social'
}
},
rebase: { rebase: {
displayName: { displayName: {
'en_US': 'Master the Rebase Luke!', 'en_US': 'Master the Rebase Luke!',

View file

@ -0,0 +1,10 @@
exports.level = {
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"remoteTrackingBranch\":null,\"remote\":false,\"target\":\"C1\",\"id\":\"master\",\"type\":\"branch\"}},\"commits\":{\"C0\":{\"type\":\"commit\",\"parents\":[],\"author\":\"Peter Cottle\",\"createTime\":\"Wed Jul 24 2013 21:27:52 GMT-0700 (PDT)\",\"commitMessage\":\"Quick commit. Go Bears!\",\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"type\":\"commit\",\"parents\":[\"C0\"],\"author\":\"Peter Cottle\",\"createTime\":\"Wed Jul 24 2013 21:27:52 GMT-0700 (PDT)\",\"commitMessage\":\"Quick commit. Go Bears!\",\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\",\"type\":\"general ref\"}}}",
"solutionCommand": "git clone",
"name": {
"en_US": "The Clone Wars"
},
"hint": {
"en_US": "Just use \"git clone\" to finish the level, but make sure you understand the tutorial!"
}
};

View file

@ -12,6 +12,7 @@ Intl TODO
Big Things Big Things
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
[ ] compare settings for a level!!! integrated into builder... [ ] compare settings for a level!!! integrated into builder...
[ ] get goal visualization to show origin / remote.... hrm :O
[ ] tree pruning [ ] tree pruning
Easier origin things: Easier origin things: