Skip to content

Commit 5ac0cf8

Browse files
committed
Include a binstubs check before running CI script
Newer RSpec contributors may not have setup binstubs. When running `script/run_build` locally it errors in confusing ways. Often at this point they are unsure how to properly get the binstubs onto the system. This includes a very simplistic check for the non-optional binstubs. It aggregates the missing binstubs and the associated gems, then provides the user helpful options on how to get the binstubs. While talking with the users it was decided that this is a kinder approach than simply forcing the creating of the binstubs. Better to inform the user then forcefully inject executables into their system.
1 parent 7941593 commit 5ac0cf8

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

travis/script/functions.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,50 @@ function run_spec_suite_for {
8383
fi;
8484
}
8585

86+
function check_binstubs {
87+
echo "Checking required binstubs"
88+
89+
local success=0
90+
local binstubs=""
91+
local gems=""
92+
93+
if [ ! -x ./bin/rspec ]; then
94+
binstubs=" bin/rspec"
95+
gems=" rspec-core"
96+
success=1
97+
fi
98+
99+
if [ ! -x ./bin/rake ]; then
100+
binstubs="$binstubs bin/rake"
101+
gems="$gems rake"
102+
success=1
103+
fi
104+
105+
if [ ! -x ./bin/cucumber ]; then
106+
binstubs="$binstubs bin/cucumber"
107+
gems="$gems cucumber"
108+
success=1
109+
fi
110+
111+
if [ $success -eq 1 ]; then
112+
echo
113+
echo "Missing binstubs:$binstubs"
114+
echo "Install missing binstubs using one of the following:"
115+
echo
116+
echo " # Create the missing binstubs"
117+
echo " $ bundle binstubs$gems"
118+
echo
119+
echo " # To binstub all gems"
120+
echo " $ bundle install --binstubs"
121+
echo
122+
echo " # To binstub all gems and avoid loading bundler"
123+
echo " $ bundle install --standalone --binstubs"
124+
fi
125+
126+
return $success
127+
}
128+
129+
check_binstubs
86130
function check_documentation_coverage {
87131
echo "bin/yard stats --list-undoc"
88132

travis/script/run_build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ if [ -f script/custom_build_functions.sh ]; then
77
source script/custom_build_functions.sh
88
fi
99

10+
fold "binstub check" check_binstubs
11+
1012
fold "specs" run_specs_and_record_done
1113
fold "cukes" run_cukes
1214

0 commit comments

Comments
 (0)