mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
better command counting
This commit is contained in:
parent
f4179e9723
commit
76b8a6cc9d
3 changed files with 93 additions and 6 deletions
|
@ -4758,6 +4758,7 @@ var Level = Sandbox.extend({
|
|||
options.level = options.level || {};
|
||||
|
||||
this.gitCommandsIssued = 0;
|
||||
this.commandsThatCount = this.getCommandsThatCount();
|
||||
this.solved = false;
|
||||
|
||||
// possible options on how stringent to be on comparisons go here
|
||||
|
@ -4805,9 +4806,36 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
},
|
||||
|
||||
getCommandsThatCount: function() {
|
||||
var GitCommands = require('../git/commands');
|
||||
var toCount = [
|
||||
'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;
|
||||
},
|
||||
|
||||
afterCommandCB: function(command) {
|
||||
// TODO check if error, but not warning
|
||||
var matched = false;
|
||||
_.each(this.commandsThatCount, function(regex) {
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
if (matched) {
|
||||
this.gitCommandsIssued++;
|
||||
}
|
||||
console.log('git commands isssued', this.gitCommandsIssued);
|
||||
},
|
||||
|
||||
afterCommandDefer: function(defer) {
|
||||
|
@ -11894,6 +11922,7 @@ exports.instantCommands = instantCommands;
|
|||
exports.parse = parse;
|
||||
exports.regexMap = regexMap;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/level/parseWaterfall.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
@ -15232,6 +15261,7 @@ exports.instantCommands = instantCommands;
|
|||
exports.parse = parse;
|
||||
exports.regexMap = regexMap;
|
||||
|
||||
|
||||
});
|
||||
require("/src/js/git/commands.js");
|
||||
|
||||
|
@ -17255,6 +17285,7 @@ var Level = Sandbox.extend({
|
|||
options.level = options.level || {};
|
||||
|
||||
this.gitCommandsIssued = 0;
|
||||
this.commandsThatCount = this.getCommandsThatCount();
|
||||
this.solved = false;
|
||||
|
||||
// possible options on how stringent to be on comparisons go here
|
||||
|
@ -17302,9 +17333,36 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
},
|
||||
|
||||
getCommandsThatCount: function() {
|
||||
var GitCommands = require('../git/commands');
|
||||
var toCount = [
|
||||
'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;
|
||||
},
|
||||
|
||||
afterCommandCB: function(command) {
|
||||
// TODO check if error, but not warning
|
||||
var matched = false;
|
||||
_.each(this.commandsThatCount, function(regex) {
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
if (matched) {
|
||||
this.gitCommandsIssued++;
|
||||
}
|
||||
console.log('git commands isssued', this.gitCommandsIssued);
|
||||
},
|
||||
|
||||
afterCommandDefer: function(defer) {
|
||||
|
|
|
@ -185,3 +185,4 @@ exports.shortcutMap = shortcutMap;
|
|||
exports.instantCommands = instantCommands;
|
||||
exports.parse = parse;
|
||||
exports.regexMap = regexMap;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ var Level = Sandbox.extend({
|
|||
options.level = options.level || {};
|
||||
|
||||
this.gitCommandsIssued = 0;
|
||||
this.commandsThatCount = this.getCommandsThatCount();
|
||||
this.solved = false;
|
||||
|
||||
// possible options on how stringent to be on comparisons go here
|
||||
|
@ -72,9 +73,36 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
},
|
||||
|
||||
getCommandsThatCount: function() {
|
||||
var GitCommands = require('../git/commands');
|
||||
var toCount = [
|
||||
'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;
|
||||
},
|
||||
|
||||
afterCommandCB: function(command) {
|
||||
// TODO check if error, but not warning
|
||||
var matched = false;
|
||||
_.each(this.commandsThatCount, function(regex) {
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
if (matched) {
|
||||
this.gitCommandsIssued++;
|
||||
}
|
||||
console.log('git commands isssued', this.gitCommandsIssued);
|
||||
},
|
||||
|
||||
afterCommandDefer: function(defer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue