-
Notifications
You must be signed in to change notification settings - Fork 1
/
push.js
37 lines (32 loc) · 1.08 KB
/
push.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
const AQ = require("./gofish/aquarium.js")
const Connection = require("./connect.js");
const util = require("./util.js")
class Pusher {
async push() {
let c = new Connection("staging");
await c.connect();
let info = util.info();
if ( info.type == "Library" ) {
this.push_code(info, "source", util.contents("source.rb"));
} else if ( info.type == "OperationType" ) {
await this.push_code(info, "protocol", util.contents("protocol.rb"));
await this.push_code(info, "precondition", util.contents("precondition.rb"));
await this.push_code(info, "test", util.contents("test.rb"));
await this.push_code(info, "documentation", util.contents("documentation.md"));
}
}
push_code(info, name, content) {
let controller = "";
if ( info.type === "OperationType") {
controller = "operation_types";
} else {
controller = "libraries";
}
return AQ.post("/" + controller + "/code", {
id: info.id,
name: name,
content: content
});
}
}
module.exports = Pusher;