forked from ajlai/github-heroku-pusher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.rb
More file actions
39 lines (32 loc) · 609 Bytes
/
Copy pathweb.rb
File metadata and controls
39 lines (32 loc) · 609 Bytes
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
require 'sinatra'
require 'json'
require 'git'
require 'heroku'
get '/' do
"Hello, world"
end
get '/public_key' do
::CURRENT_SSH_KEY
end
get '/status' do
c = GitPusher.local_state(ENV['GITHUB_REPO'])
"SHA: #{c.sha} | Date: #{c.date}"
end
get '/nuke-repos' do
`rm -r repos`
"nuked!"
end
get '/force-push' do
GitPusher.deploy(ENV['GITHUB_REPO'])
"Success!"
end
post '/post-receive' do
data = JSON.parse(params[:payload])
# if data["repository"]["private"]
# "freak out"
# end
url = data["repository"]["url"]
GitPusher.deploy(url)
"Success!"
end
require_relative 'lib/init'