-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarboard.rb
More file actions
94 lines (68 loc) · 1.84 KB
/
warboard.rb
File metadata and controls
94 lines (68 loc) · 1.84 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
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
# warboard.rb
require 'sinatra'
require 'pusher'
require 'json'
require 'httparty'
require 'github_api'
require 'pp'
Pusher.app_id = '28242'
Pusher.key = '1d429354391310d97281'
Pusher.secret = '7679f66095f826841f45'
get '/' do
github = Github.new
erb :index, :layout => :index
#haml :index
end
post '/git', :provides => :json do
push = JSON.parse(params[:payload])
Pusher['test_channel'].trigger('event1', push)
end
post '/payload' do
push = JSON.parse(request.body.read)
Pusher['test_channel'].trigger('event1', push)
end
get '/show' do
pp Partay.post('http://localhost:9292/git', {})
end
get '/ping/:id' do
id = params[:id]
# GitHub payload template
# {
# :before => before,
# :after => after,
# :ref => ref,
# :commits => [{
# :id => commit.id,
# :message => commit.message,
# :timestamp => commit.committed_date.xmlschema,
# :url => commit_url,
# :added => array_of_added_paths,
# :removed => array_of_removed_paths,
# :modified => array_of_modified_paths,
# :author => {
# :name => commit.author.name,
# :email => commit.author.email
# }
# }],
# :repository => {
# :name => repository.name,
# :url => repo_url,
# :pledgie => repository.pledgie.id,
# :description => repository.description,
# :homepage => repository.homepage,
# :watchers => repository.watchers.size,
# :forks => repository.forks.size,
# :private => repository.private?,
# :owner => {
# :name => repository.owner.login,
# :email => repository.owner.email
# }
# }
# }
data = {'message' => 'Update recieved!', 'id' => id, 'text' => 'text here'}
Pusher['test_channel'].trigger('notification', data)
end
get '/:file' do
file = params[:file]
File.read(File.join('public',file ))
end