* use ruby version manager instead of system ruby;

* use dynamic determination of the current bash scrip directory.
This commit is contained in:
Vladmir Sharhsov(warpc) 2013-09-09 09:33:27 +04:00
parent b3dbc7f029
commit 9189658cd5
1 changed files with 20 additions and 4 deletions

View File

@ -1,10 +1,26 @@
#!/bin/bash
# astute_rspec_check.sh
# RVM
source ~/.bash_profile
set -e
# change dir to the path of the directory in which a current bash script is located
# source: http://stackoverflow.com/a/179231/842168
function cd_workspace() {
pushd . > /dev/null
SCRIPT_PATH="${BASH_SOURCE[0]}";
if ([ -h "${SCRIPT_PATH}" ]) then
while([ -h "${SCRIPT_PATH}" ]) do cd `dirname "$SCRIPT_PATH"`; SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd > /dev/null
}
function license_check() {
# License information must be in every source file
cd $WORKSPACE
cd_workspace
tmpfile=`tempfile`
find * -not -path "docs/*" -regex ".*\.\(rb\)" -type f -print0 | xargs -0 grep -Li License
@ -19,10 +35,10 @@ function license_check() {
}
function ruby_checks() {
cd $WORKSPACE
cd_workspace
# Install all ruby dependencies
sudo bundle install
# Install all ruby dependencies (expect ruby version manager: RVM, rbenv or similar)
bundle install
# Run unit rspec tests
bundle exec rake spec:unit