forked from Strider-CD/strider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefaultExtensions.js
89 lines (81 loc) · 2.43 KB
/
defaultExtensions.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
var utils = require('./lib/utils')
, path = require('path')
// TODO - most of this is cruft that should be moved
module.exports = function(ext){
ext['collaborators'] = {
panel : {
id: 'collaborators',
title: 'Collaborators',
controller: 'CollaboratorsCtrl',
script_path: '/javascripts/config/collaborators.js',
src : path.join(__dirname, './views/config/collaborators.html'),
data: function (user, repo, models, next) {
if (!repo.collaborators) return []
models.User.findCollaborators(repo.collaborators, function (err, whitelist) {
whitelist.push({
type: "user",
email: user.email,
access_level: 1,
owner: true,
gravatar: utils.gravatar(user.email)
})
next(null, whitelist)
})
}
}
}
ext['github'] = {
panel: {
id: 'github',
title: 'Github Config',
controller: 'GithubCtrl',
data: false,
script_path: '/javascripts/config/github.js',
src : path.join(__dirname, './views/config/github.html'),
/*
data: function () {
// we don't currently check to see that the webhook is still there. Should we?
// maybe we check every once in a while. No more than once an hour?
}
*/
}
}
ext['heroku'] = {
panel : {
id: 'heroku',
title: 'Heroku Config',
script_path: '/javascripts/config/heroku.js',
src : path.join(__dirname, './views/config/heroku.html'),
controller: 'HerokuCtrl',
data: function (user, repo, models, next) {
try {
user.get_prod_deploy_target(repo.url, function (err, target) {
if (err === 'No deploy target found') return next(null, false)
next(err, target);
});
} catch (e) {
console.log(e, e.stack);
next(e);
}
}
}
}
ext.webhooks = {}
ext['webhooks'].panel = {
id: 'webhooks',
title: 'Webhooks',
data: 'webhooks',
controller: 'WebhooksCtrl',
src : path.join(__dirname, './views/config/webhooks.html'),
script_path: '/javascripts/config/webhooks.js',
}
ext.deactivate = {}
ext['deactivate'].panel = {
id: 'deactivate',
title: 'Deactivate',
data: 'active',
controller: 'DeactivateCtrl',
src : path.join(__dirname, './views/config/deactivate.html'),
script_path: '/javascripts/config/deactivate.js',
}
}