mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-25 21:24:36 +02:00
big refactor looking a lot better now
This commit is contained in:
parent
e422bdb181
commit
0aadae766f
12 changed files with 1539 additions and 1355 deletions
|
@ -2,6 +2,7 @@ var _ = require('underscore');
|
|||
var intl = require('../intl');
|
||||
|
||||
var GitCommands = require('../git/commands');
|
||||
var Commands = require('../commands');
|
||||
|
||||
var Errors = require('../util/errors');
|
||||
var GitError = Errors.GitError;
|
||||
|
@ -26,7 +27,7 @@ DisabledMap.prototype.getInstantCommands = function() {
|
|||
};
|
||||
|
||||
_.each(this.disabledMap, function(val, disabledCommand) {
|
||||
var gitRegex = GitCommands.regexMap[disabledCommand];
|
||||
var gitRegex = Commands.getRegexMap()[disabledCommand];
|
||||
if (!gitRegex) {
|
||||
throw new Error('wuttttt this disbaled command' + disabledCommand +
|
||||
' has no regex matching');
|
||||
|
|
|
@ -10,12 +10,14 @@ var log = require('../log');
|
|||
var Errors = require('../util/errors');
|
||||
var Sandbox = require('../level/sandbox').Sandbox;
|
||||
var Constants = require('../util/constants');
|
||||
var Commands = require('../commands');
|
||||
|
||||
var Visualization = require('../visuals/visualization').Visualization;
|
||||
var ParseWaterfall = require('../level/parseWaterfall').ParseWaterfall;
|
||||
var DisabledMap = require('../level/disabledMap').DisabledMap;
|
||||
var Command = require('../models/commandModel').Command;
|
||||
var GitShim = require('../git/gitShim').GitShim;
|
||||
var GitCommands = require('../git/commands');
|
||||
|
||||
var MultiView = require('../views/multiView').MultiView;
|
||||
var CanvasTerminalHolder = require('../views').CanvasTerminalHolder;
|
||||
|
@ -44,7 +46,6 @@ var Level = Sandbox.extend({
|
|||
this.level = options.level;
|
||||
|
||||
this.gitCommandsIssued = [];
|
||||
this.commandsThatCount = this.getCommandsThatCount();
|
||||
this.solved = false;
|
||||
|
||||
this.initGoalData(options);
|
||||
|
@ -297,11 +298,6 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
},
|
||||
|
||||
getCommandsThatCount: function() {
|
||||
var GitCommands = require('../git/commands');
|
||||
return GitCommands.commandsThatCount;
|
||||
},
|
||||
|
||||
undo: function() {
|
||||
this.gitCommandsIssued.pop();
|
||||
Level.__super__.undo.apply(this, arguments);
|
||||
|
@ -314,7 +310,8 @@ var Level = Sandbox.extend({
|
|||
}
|
||||
|
||||
var matched = false;
|
||||
_.each(this.commandsThatCount, function(regex) {
|
||||
_.each(Commands.getCommandsThatCount(), function(name) {
|
||||
var regex = Commands.getRegex(name);
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
if (matched) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var _ = require('underscore');
|
||||
|
||||
var GitCommands = require('../git/commands');
|
||||
var Commands = require('../commands');
|
||||
var SandboxCommands = require('../level/sandboxCommands');
|
||||
|
||||
// more or less a static class
|
||||
|
@ -8,7 +9,7 @@ var ParseWaterfall = function(options) {
|
|||
options = options || {};
|
||||
this.options = options;
|
||||
this.shortcutWaterfall = options.shortcutWaterfall || [
|
||||
GitCommands.shortcutMap
|
||||
Commands.getShortcutMap()
|
||||
];
|
||||
|
||||
this.instantWaterfall = options.instantWaterfall || [
|
||||
|
|
|
@ -4,6 +4,7 @@ var util = require('../util');
|
|||
var constants = require('../util/constants');
|
||||
var intl = require('../intl');
|
||||
|
||||
var Commands = require('../commands');
|
||||
var Errors = require('../util/errors');
|
||||
var CommandProcessError = Errors.CommandProcessError;
|
||||
var GitError = Errors.GitError;
|
||||
|
@ -120,7 +121,7 @@ var getAllCommands = function() {
|
|||
|
||||
var allCommands = _.extend(
|
||||
{},
|
||||
require('../git/commands').regexMap,
|
||||
require('../commands').getRegexMap(),
|
||||
require('../level').regexMap,
|
||||
regexMap
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue