diff --git a/build/bundle.js b/build/bundle.js index 7c74d4e7..2609b743 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -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 - this.gitCommandsIssued++; + 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 - this.gitCommandsIssued++; + 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) { diff --git a/src/js/git/commands.js b/src/js/git/commands.js index aec83386..f0ebe905 100644 --- a/src/js/git/commands.js +++ b/src/js/git/commands.js @@ -185,3 +185,4 @@ exports.shortcutMap = shortcutMap; exports.instantCommands = instantCommands; exports.parse = parse; exports.regexMap = regexMap; + diff --git a/src/js/level/index.js b/src/js/level/index.js index 6fcf2dc4..e460c7a1 100644 --- a/src/js/level/index.js +++ b/src/js/level/index.js @@ -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 - this.gitCommandsIssued++; + 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) {