nettoyage
parent
a99b1f4f9e
commit
9f0ad6c81d
|
@ -3,9 +3,11 @@ require "option_parser"
|
||||||
require "./payload.cr"
|
require "./payload.cr"
|
||||||
|
|
||||||
VERSION = 0.1
|
VERSION = 0.1
|
||||||
port = 3000
|
|
||||||
|
|
||||||
|
port = 3000
|
||||||
storage = "webhooksd-data"
|
storage = "webhooksd-data"
|
||||||
|
scriptfile = "on-push"
|
||||||
|
jsonfile = "payload.json"
|
||||||
|
|
||||||
args = [] of String
|
args = [] of String
|
||||||
|
|
||||||
|
@ -16,7 +18,7 @@ OptionParser.parse do |parser|
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
parser.on "-h", "--help", "Show help" do
|
parser.on "-h", "--help", "Show help" do
|
||||||
puts parser
|
puts parser
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
@ -45,9 +47,6 @@ OptionParser.parse do |parser|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
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 != "/"
|
||||||
context.response.status = HTTP::Status::NOT_FOUND
|
context.response.status = HTTP::Status::NOT_FOUND
|
||||||
|
@ -69,7 +68,7 @@ server = HTTP::Server.new do |context|
|
||||||
status = false
|
status = false
|
||||||
else
|
else
|
||||||
File.write(path_jsonfile, payload.content)
|
File.write(path_jsonfile, payload.content)
|
||||||
status = Process.run command: "sh", args: [scriptfile], shell: true,
|
status = Process.run command: "zsh", args: [scriptfile], shell: true,
|
||||||
error: STDERR, output: STDOUT, chdir: path_project
|
error: STDERR, output: STDOUT, chdir: path_project
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue