Created
October 2, 2017 05:14
-
-
Save skayred/aea573a4638cb16cc093a44a9f3e76d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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