-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
59 lines (45 loc) · 1.5 KB
/
Cakefile
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
TBModel = require './models'
client = require './client'
nconf = require 'nconf'
request = require 'request'
#setup models
TBRoot = TBModel.TBRoot
nconf.file({ file: "./config.json" })
#setup clients
trelloClient = client.trelloClient(nconf)
dropboxClient = client.dropboxClient(nconf)
task "sync:trello", "Maps Dropboxfiles to Trello", ->
tbRoot = new TBRoot("TrelloBox")
tbRoot.dropboxClient = dropboxClient
tbRoot.trelloClient = trelloClient
tbRoot.syncTrello()
task "sync:dropbox", "Maps Dropboxfiles to Trello", ->
tbRoot = new TBRoot("TrelloBox")
tbRoot.dropboxClient = dropboxClient
tbRoot.trelloClient = trelloClient
tbRoot.syncDropbox()
task "getBoardId", "retreives boardId", ->
tbRoot = new TBRoot("TrelloBox")
tbRoot.trelloClient = trelloClient
tbRoot.initTrelloBoardObject (err, board) ->
console.log board.id
task "webhook:setup", "Set up Trello webhook for the board", ->
tbRoot = new TBRoot("TrelloBox")
tbRoot.trelloClient = trelloClient
tbRoot.initTrelloBoardObject (err, board) ->
console.log board.id
authToken = nconf.get("TRELLO_TOKEN")
appKey = nconf.get("TRELLO_APP_KEY")
url = "https://trello.com/1/tokens/#{authToken}/webhooks/?key=#{appKey}"
form =
idModel: board.id
callbackURL: nconf.get("WEBHOOK_CALLBACK_URL")
description: 'webhook for TrellBox'
req =
url: url
form: form
request.post req, (err, response, body) ->
if err
console.log(err)
return
console.log(body)