File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,22 @@ source "$ruby_install_dir/checksums.sh"
77#
88function pre_install()
99{
10+
11+ local status
12+ local exisiting_part_dir=" ${install_dir%/* } "
13+
1014 mkdir -p " $src_dir " || return $?
11- mkdir -p " ${install_dir%/* } " || return $?
15+
16+ while [ ! -d " $exisiting_part_dir " ]; do
17+ exisiting_part_dir=" ${exisiting_part_dir%/* } "
18+ done
19+
20+ if [ ! -w " $exisiting_part_dir " ]; then
21+ fail " Installation directory is not writable by the user : ${exisiting_part_dir} "
22+ status=$?
23+ fi
24+
25+ mkdir -p " ${install_dir%/* } " || return $status
1226}
1327
1428#
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ . ./test/helper.sh
4+
5+ test_install_dir=" $test_fixtures_dir /no_write_permissions_test"
6+
7+ function setUp()
8+ {
9+ mkdir -p " $test_install_dir /bin"
10+ chmod -w " $test_install_dir /bin"
11+ }
12+
13+ function test_no_write_permissions()
14+ {
15+ local output status
16+ output=" $( ruby-install --install-dir " $test_install_dir /bin/rubies" ruby 2>&1 ) "
17+ status=$?
18+
19+ assertEquals " did not return 0" 255 $status
20+ assertTrue " did not print a message to STDOUT" \
21+ ' [[ "$output" == *"Installation directory is not writable by the user"* ]]'
22+ }
23+
24+ function tearDown()
25+ {
26+ rm -rf " $test_install_dir "
27+ }
28+
29+ SHUNIT_PARENT=$0 . $SHUNIT2
You can’t perform that action at this time.
0 commit comments