From 7aa8ea3b2ab99baee28203de6ea02f7a199d585e Mon Sep 17 00:00:00 2001 From: Ed Reel Date: Mon, 17 Oct 2022 14:05:59 -0500 Subject: [PATCH] Add crystal package (#7512) Co-authored-by: chronos --- packages/crystal.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/crystal.rb diff --git a/packages/crystal.rb b/packages/crystal.rb new file mode 100644 index 0000000000..30fceace4e --- /dev/null +++ b/packages/crystal.rb @@ -0,0 +1,29 @@ +require 'package' + +class Crystal < Package + description 'A language for humans and computers' + homepage 'https://crystal-lang.org/' + version '1.6.0' + license 'Apache-2.0' + compatibility 'x86_64' + source_url 'https://github.com/crystal-lang/crystal/releases/download/1.6.0/crystal-1.6.0-1-linux-x86_64-bundled.tar.gz' + source_sha256 '5b1b287563839c3c9a2fa7b620c48b5c56de0756464e8370f3a7f720a3ba4df0' + + depends_on 'llvm' # R + + def self.install + FileUtils.mkdir_p CREW_DEST_PREFIX.to_s + FileUtils.mv %w[bin lib share], CREW_DEST_PREFIX.to_s + bashcomp = <<~EOF + # Crystal bash completion + source "#{CREW_PREFIX}/share/bash-completion/completions/crystal" + EOF + FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/bash.d" + File.write("#{CREW_DEST_PREFIX}/etc/bash.d/10-crystal", bashcomp) + end + + def self.postinstall + puts "\nTo finish the installation, execute the following:".lightblue + puts "source ~/.bashrc\n".lightblue + end +end