Last active
February 6, 2019 13:20
-
-
Save ramon-sg/ebe02f47fb42ffe5151fd5093fbc5e10 to your computer and use it in GitHub Desktop.
curl -fsSLo- https://gist.githubusercontent.com/clouw/ebe02f47fb42ffe5151fd5093fbc5e10/raw/51ea4a79c5e2d3938510a4f604a4e75d64a2ba59/sentry-crystal-0.26.1.cr | crystal eval
This file contains hidden or 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
require "uri" | |
require "http/client" | |
require "file_utils" | |
print "🤖 Fetching sentry files..." | |
# Fetch sentry.cr | |
sentry_uri = "https://raw.githubusercontent.com/samueleaton/sentry/49a9a9cf1cdd87f0156206322df198c988132b6f/src/sentry.cr" | |
fetch_sentry_response = HTTP::Client.get sentry_uri | |
if fetch_sentry_response.status_code > 299 | |
puts "HTTP request error. Could not fetch #{sentry_uri}" | |
puts fetch_sentry_response.body | |
exit 1 | |
end | |
sentry_code = fetch_sentry_response.body | |
# Fetch sentry_cli.cr | |
sentry_cli_uri = "https://raw.githubusercontent.com/samueleaton/sentry/49a9a9cf1cdd87f0156206322df198c988132b6f/src/sentry_cli.cr" | |
fetch_cli_response = HTTP::Client.get sentry_cli_uri | |
if fetch_cli_response.status_code > 299 | |
puts "HTTP request error. Could not fetch #{sentry_cli_uri}" | |
puts fetch_cli_response.body | |
exit 1 | |
end | |
sentry_cli_code = fetch_cli_response.body | |
puts " success" | |
# Write files to dev directory | |
FileUtils.mkdir_p "./dev" | |
File.write "./dev/sentry.cr", sentry_code | |
File.write "./dev/sentry_cli.cr", sentry_cli_code | |
# compile sentry files | |
puts "🤖 Compiling sentry using --release flag..." | |
build_args = ["build", "--release", "./dev/sentry_cli.cr", "-o", "./sentry"] | |
compile_success = system "crystal", build_args | |
if compile_success | |
puts "🤖 Sentry installed!" | |
puts "\nTo execute sentry, do: | |
./sentry\n" | |
puts "\nTo see options: | |
./sentry --help\n\n" | |
else | |
puts "🤖 Bzzt. There was an error compiling sentry." | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment