Skip to content

Commit

Permalink
rust-prebuilt: added new plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Apr 20, 2014
1 parent 642b759 commit 1bb5f4f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/nv-plugins/rust-prebuilt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

# Output lists of versions
plug_list_versions() {
echo $(curl -s https://github.com/mozilla/rust/wiki/Doc-releases | \
egrep 'static.rust-lang.org\/dist\/rust-[0-9]+\.[0-9]+\.tar\.gz' | \
egrep -o '[0-9]+\.[0-9]+' | uniq | sort --version-sort)
}

# Return full url for tarball
plug_url_for_download() {
local version=$1
local arch=$(nv_get_system_arch "i686" "x86_64")
local system=$(nv_get_system "unknown-linux-gnu" "apple-darwin")
echo "http://static.rust-lang.org/dist/rust-${version}-${arch}-${system}.tar.gz"
}

# Like we build
plug_build() {
local src_path=$1
local build_path=$2
cp -r "$src_path"/*/* "$build_path"
}
3 changes: 2 additions & 1 deletion tests/ls-plugins.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ load test_helper
assert_equal "node-prebuilt" "${lines[7]}"
assert_equal "python" "${lines[8]}"
assert_equal "rust" "${lines[9]}"
assert_equal "" "${lines[10]}"
assert_equal "rust-prebuilt" "${lines[10]}"
assert_equal "" "${lines[11]}"
}
13 changes: 12 additions & 1 deletion tests/plugin.rust.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,16 @@ load test_helper

run rustc -v
assert_success
assert_equal "${lines[0]}" "rustc 0.9"
assert_equal "rustc 0.9" "${lines[0]}"
}

@test "plugin: rust-prebuilt" {
run nv mk rust_test_env --rust-prebuilt=0.10
assert_success

nv on --same-shell rust_test_env

run rustc -v
assert_success
assert_equal "rustc 0.10 (46867cc 2014-04-02 16:59:39 -0700)" "${lines[0]}"
}

0 comments on commit 1bb5f4f

Please sign in to comment.