-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.js
130 lines (91 loc) · 2.6 KB
/
core.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// Generated by CoffeeScript 1.9.1
/**
* A resource represents a file or directory in the store
*/
(function() {
var Author, Change, Resource, Revision, Store;
Resource = (function() {
function Resource(path1, contents1, latest) {
this.path = path1;
this.contents = contents1 != null ? contents1 : null;
this.latest = latest != null ? latest : null;
}
Resource.prototype.getContents = function(store, cb) {
return this.contents || store.read(this.path, cb);
};
Resource.prototype.getLatest = function(store, cb) {
return this.latest || store.latest(this.path, cb);
};
return Resource;
})();
/**
* Describes the author of a revision
*/
Author = (function() {
/**
* @constructor
* @param {String} name
* @param {String} email
*/
function Author(name, email) {
this.name = name;
this.email = email;
/**
* @property {String} name Name of the author
*/
/**
* @property {String} email Email address of the author
*/
}
/**
* Returns a git-style string representation of the author: `name <email>`
* @return {String}
*/
Author.prototype.toString = function() {
return this.name + " <" + this.email + ">";
};
return Author;
})();
Change = (function() {
function Change(added, deleted, modified) {
this.added = added;
this.deleted = deleted;
this.modified = modified;
}
return Change;
})();
/**
* @class Revision
* Represents a single revision in the history of a file
*/
Revision = (function() {
function Revision(path1, id1, time, author1, message1, changes) {
this.path = path1;
this.id = id1;
this.time = time;
this.author = author1;
this.message = message1;
this.changes = changes;
}
Revision.prototype.getContents = function(store) {};
return Revision;
})();
Store = (function() {
function Store(options, callback) {}
Store.prototype.save = function(path, contents, author, message, callback) {};
Store.prototype.read = function(path, id, callback) {};
Store.prototype.retrieve = function(id, callback) {};
Store.prototype.remove = function(path, callback) {};
Store.prototype.move = function(fromPath, toPath) {};
Store.prototype.list = function(directory) {};
Store.prototype.search = function(pattern) {};
return Store;
})();
module.exports = {
Store: Store,
Author: Author,
Change: Change,
Resource: Resource,
Revision: Revision
};
}).call(this);