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