payload.json

master
Izimic 2020-11-27 16:59:17 +01:00
parent 62f1a3215d
commit a99b1f4f9e
1 changed files with 5 additions and 1 deletions

View File

@ -46,6 +46,7 @@ OptionParser.parse do |parser|
end
scriptfile = "on-push"
jsonfile = "payload.json"
server = HTTP::Server.new do |context|
if context.request.method != "POST" || context.request.path != "/"
@ -55,6 +56,7 @@ server = HTTP::Server.new do |context|
path_project = storage + "/" + payload.project
path_scriptfile = path_project + "/" + scriptfile
path_jsonfile = path_project + "/" + jsonfile
status = false
@ -66,11 +68,13 @@ server = HTTP::Server.new do |context|
STDERR.puts "ERROR: Scriptfile not found"
status = false
else
context.response.content_type = "text/plain"
File.write(path_jsonfile, payload.content)
status = Process.run command: "sh", args: [scriptfile], shell: true,
error: STDERR, output: STDOUT, chdir: path_project
end
end
context.response.content_type = "text/plain"
if status
context.response.print "SUCCESS"
else