forked from sebastiande/insomnia-plugin-git-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (40 loc) · 1.25 KB
/
index.js
File metadata and controls
44 lines (40 loc) · 1.25 KB
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
const Workspace = require('./Workspace');
const Sync = require('./Sync');
const SyncToServer = require('./SyncToServer');
const SyncToLocal = require('./SyncToLocal');
module.exports.workspaceActions = [
{
label: 'Set GIT Repository URL',
icon: 'fa-git',
action: async (context, data) => {
await Sync.setupRepoUrl(context, data);
},
},
{
label: 'Pull from GIT',
icon: 'fa-arrow-down',
action: async (context, data) => {
if (await Sync.isSetup(context, data) === false) {
return;
}
await SyncToLocal.pull(context, data);
Workspace.importProject(context, data);
},
},
{
label: 'Push to GIT',
icon: 'fa-arrow-up',
action: async (context, data) => {
if (await Sync.isSetup(context, data) === false) {
return;
}
if (confirm('Are you sure you want to push your changes to Git?')) {
const expFilename = await Workspace.exportProject(context, data);
if (!expFilename) {
return;
}
await SyncToServer.push(context, data, expFilename);
}
},
}
];