From 6b805e4b4d3ff0acc9850918571771633c809f31 Mon Sep 17 00:00:00 2001 From: Christopher MacGown Date: Sun, 4 Jun 2017 10:12:24 -0700 Subject: [PATCH] rustup-init 1.3.0 (new formula) --- Aliases/rustup | 1 + Formula/rustup-init.rb | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 120000 Aliases/rustup create mode 100644 Formula/rustup-init.rb diff --git a/Aliases/rustup b/Aliases/rustup new file mode 120000 index 000000000000..c97586f9dabe --- /dev/null +++ b/Aliases/rustup @@ -0,0 +1 @@ +../Formula/rustup-init.rb \ No newline at end of file diff --git a/Formula/rustup-init.rb b/Formula/rustup-init.rb new file mode 100644 index 000000000000..84248225664b --- /dev/null +++ b/Formula/rustup-init.rb @@ -0,0 +1,33 @@ +class RustupInit < Formula + desc "The Rust toolchain installer" + homepage "https://github.com/rust-lang-nursery/rustup.rs" + + url "https://github.com/rust-lang-nursery/rustup.rs/archive/1.3.0.tar.gz" + sha256 "c0ca06b70104fed8f1de5a6f5ecfd8478e8bc03f15add8d7896b86b3b15e81e3" + + depends_on "rust" => :build + + def install + cargo_home = buildpath/"cargo_home" + cargo_home.mkpath + ENV["CARGO_HOME"] = cargo_home + + system "cargo", "build", "--release", "--verbose" + + bin.install buildpath/"target/release/rustup-init" + end + + test do + ENV["CARGO_HOME"] = testpath/".cargo" + ENV["RUSTUP_HOME"] = testpath/".multirust" + + system bin/"rustup-init", "-y" + (testpath/"hello.rs").write <<-EOS.undent + fn main() { + println!("Hello World!"); + } + EOS + system testpath/".cargo/bin/rustc", "hello.rs" + assert_equal "Hello World!", shell_output("./hello").chomp + end +end