awesome, headless git now pretty much works

This commit is contained in:
Peter Cottle 2012-12-16 18:35:24 -08:00
parent 7722114fb0
commit c9fb851ad6
4 changed files with 127 additions and 4 deletions

View file

@ -5214,6 +5214,19 @@ exports.VisEdge = VisEdge;
exports.VisBranch = VisBranch;
});
require.define("/util/mock.js",function(require,module,exports,__dirname,__filename,process,global){exports.mock = function(Constructor) {
var dummy = {};
var stub = function() {};
for (var key in Constructor.prototype) {
dummy[key] = stub;
}
return dummy;
};
});
require.define("/git/treeCompare.js",function(require,module,exports,__dirname,__filename,process,global){// static class...
@ -5303,6 +5316,43 @@ TreeCompare.prototype.compareTrees = function(treeA, treeB) {
exports.TreeCompare = TreeCompare;
});
require.define("/git/headless.js",function(require,module,exports,__dirname,__filename,process,global){var GitEngine = require('../git').GitEngine;
var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory;
var GitVisuals = require('../visuals').GitVisuals;
var Collections = require('../models/collections');
var CommitCollection = Collections.CommitCollection;
var BranchCollection = Collections.BranchCollection;
var mock = require('../util/mock').mock;
var HeadlessGit = function() {
this.init();
};
HeadlessGit.prototype.init = function() {
this.commitCollection = new CommitCollection();
this.branchCollection = new BranchCollection();
// here we mock visuals and animation factory so the git engine
// is headless
var animationFactory = mock(AnimationFactory);
var gitVisuals = mock(GitVisuals);
this.gitEngine = new GitEngine({
collection: this.commitCollection,
branches: this.branchCollection,
gitVisuals: gitVisuals,
animationFactory: animationFactory
});
this.gitEngine.init();
};
exports.HeadlessGit = HeadlessGit;
});
require.define("/app/index.js",function(require,module,exports,__dirname,__filename,process,global){/**
@ -5362,6 +5412,44 @@ exports.getUI = function() {
});
require("/app/index.js");
require.define("/git/headless.js",function(require,module,exports,__dirname,__filename,process,global){var GitEngine = require('../git').GitEngine;
var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory;
var GitVisuals = require('../visuals').GitVisuals;
var Collections = require('../models/collections');
var CommitCollection = Collections.CommitCollection;
var BranchCollection = Collections.BranchCollection;
var mock = require('../util/mock').mock;
var HeadlessGit = function() {
this.init();
};
HeadlessGit.prototype.init = function() {
this.commitCollection = new CommitCollection();
this.branchCollection = new BranchCollection();
// here we mock visuals and animation factory so the git engine
// is headless
var animationFactory = mock(AnimationFactory);
var gitVisuals = mock(GitVisuals);
this.gitEngine = new GitEngine({
collection: this.commitCollection,
branches: this.branchCollection,
gitVisuals: gitVisuals,
animationFactory: animationFactory
});
this.gitEngine.init();
};
exports.HeadlessGit = HeadlessGit;
});
require("/git/headless.js");
require.define("/git/index.js",function(require,module,exports,__dirname,__filename,process,global){var AnimationFactoryModule = require('../visuals/animation/animationFactory');
var Main = require('../app');
var AnimationQueue = require('../visuals/animation').AnimationQueue;
@ -7647,7 +7735,8 @@ require.define("/util/debug.js",function(require,module,exports,__dirname,__file
Collections: require('../models/collections'),
Async: require('../visuals/animation'),
AnimationFactory: require('../visuals/animation/animationFactory'),
Main: require('../app')
Main: require('../app'),
HeadLess: require('../git/headless')
};
_.each(toGlobalize, function(module) {

34
src/js/git/headless.js Normal file
View file

@ -0,0 +1,34 @@
var GitEngine = require('../git').GitEngine;
var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory;
var GitVisuals = require('../visuals').GitVisuals;
var Collections = require('../models/collections');
var CommitCollection = Collections.CommitCollection;
var BranchCollection = Collections.BranchCollection;
var mock = require('../util/mock').mock;
var HeadlessGit = function() {
this.init();
};
HeadlessGit.prototype.init = function() {
this.commitCollection = new CommitCollection();
this.branchCollection = new BranchCollection();
// here we mock visuals and animation factory so the git engine
// is headless
var animationFactory = mock(AnimationFactory);
var gitVisuals = mock(GitVisuals);
this.gitEngine = new GitEngine({
collection: this.commitCollection,
branches: this.branchCollection,
gitVisuals: gitVisuals,
animationFactory: animationFactory
});
this.gitEngine.init();
};
exports.HeadlessGit = HeadlessGit;

View file

@ -8,7 +8,8 @@ var toGlobalize = {
Collections: require('../models/collections'),
Async: require('../visuals/animation'),
AnimationFactory: require('../visuals/animation/animationFactory'),
Main: require('../app')
Main: require('../app'),
HeadLess: require('../git/headless')
};
_.each(toGlobalize, function(module) {

View file

@ -8,8 +8,7 @@ Big Graphic things:
Medium things:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- gitEngine loads from tree immediately, not the weird thing we have now!
- transfer gitEngine and visuals over to event-based communication so they can be detached by
cloning Backbone.events
- headless git
Small things to implement:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~