1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#!/bin/bash
# do this stuff in a tmp dir
cd "$(dirname "$0")/.."
project_root=`pwd`
mkdir -p tmp
cd tmp
# this is basically a shitty version of `gem unpack`
get_gem() {
name="$1"
url="$2"
if test -d "$name"
then
echo "Skipping download of $name"
return
else
echo "Downloading $name"
fi
mkdir "$name" &&
cd "$name" &&
curl -L "$url" > "$name".gem &&
tar -xf "$name".gem &&
gunzip data.tar.gz &&
tar -xf data.tar &&
cd ..
}
# download dependencies
get_gem "rspec" "https://rubygems.org/downloads/rspec-3.2.0.gem" &&
get_gem "rspec-core" "https://rubygems.org/downloads/rspec-core-3.2.1.gem" &&
get_gem "rspec-support" "https://rubygems.org/downloads/rspec-support-3.2.2.gem" &&
get_gem "rspec-expectations" "https://rubygems.org/downloads/rspec-expectations-3.2.0.gem" &&
get_gem "rspec-mocks" "https://rubygems.org/downloads/rspec-mocks-3.2.1.gem" &&
get_gem "diff-lcs" "https://rubygems.org/downloads/diff-lcs-1.2.5.gem" || exit 1
# run specs
cd "$project_root"
export PATH="$project_root/tmp/rspec-core/exe:$PATH"
opts=()
opts+=(-I "$project_root/tmp/diff-lcs/lib")
opts+=(-I "$project_root/tmp/rspec/lib")
opts+=(-I "$project_root/tmp/rspec-core/lib")
opts+=(-I "$project_root/tmp/rspec-expectations/lib")
opts+=(-I "$project_root/tmp/rspec-mocks/lib")
opts+=(-I "$project_root/tmp/rspec-support/lib")
if `ruby -e "exit RUBY_VERSION != '1.8.7'"`
then
opts+=(--disable-gems)
fi
ruby "${opts[@]}" -S rspec --colour --fail-fast --format documentation
|