mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
awesome, headless git now pretty much works
This commit is contained in:
parent
7722114fb0
commit
c9fb851ad6
4 changed files with 127 additions and 4 deletions
34
src/js/git/headless.js
Normal file
34
src/js/git/headless.js
Normal 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;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue