Skip to content

Instantly share code, notes, and snippets.

@skayred
Created October 2, 2017 05:14
Show Gist options
  • Save skayred/aea573a4638cb16cc093a44a9f3e76d8 to your computer and use it in GitHub Desktop.
Save skayred/aea573a4638cb16cc093a44a9f3e76d8 to your computer and use it in GitHub Desktop.
post '/method' do
pars = JSON.parse(request.body.read)
tmp = `rm -rf tmp && mkdir tmp`
output = `cd tmp && git clone #{pars['repo']} && cd * && npm install && npm run lint 2>&1`
exit_code = $?.success?
puts exit_code
puts output
content_type :json
{
status: exit_code ? 'ok' : 'fail',
message: exit_code ? 'ok' : 'fail',
verbose_message: output.encode("iso-8859-1").force_encoding("utf-8")
}.to_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment