2014-11-21 21:07:06 +02:00
|
|
|
$ source $TESTDIR/setup.sh
|
2014-11-15 16:08:52 +02:00
|
|
|
|
|
|
|
Lets set a simple .env action
|
|
|
|
|
|
|
|
$ mkdir sub
|
|
|
|
$ cd sub
|
|
|
|
$ echo 'echo ENTERED' >> .env
|
|
|
|
$ echo 'echo LEFT' >> .env.leave
|
|
|
|
|
|
|
|
Change to the directory.
|
|
|
|
|
2014-11-27 14:33:04 +02:00
|
|
|
$ _autoenv_ask_for_yes() { echo "yes"; return 0 }
|
2014-11-15 16:08:52 +02:00
|
|
|
$ cd .
|
2014-11-27 14:33:04 +02:00
|
|
|
Attempting to load unauthorized env file!
|
|
|
|
-* /tmp/cramtests-*/leave.t/sub/.env (glob)
|
2014-11-15 16:08:52 +02:00
|
|
|
|
|
|
|
**********************************************
|
|
|
|
|
|
|
|
echo ENTERED
|
|
|
|
|
|
|
|
**********************************************
|
|
|
|
|
2014-11-27 14:33:04 +02:00
|
|
|
Would you like to authorize it? (type 'yes') yes
|
2014-11-15 16:08:52 +02:00
|
|
|
ENTERED
|
|
|
|
|
|
|
|
|
|
|
|
Leave the directory and answer "no".
|
|
|
|
|
2014-11-27 14:33:04 +02:00
|
|
|
$ _autoenv_ask_for_yes() { echo "no"; return 1 }
|
2014-11-15 16:08:52 +02:00
|
|
|
$ cd ..
|
2014-11-27 14:33:04 +02:00
|
|
|
Attempting to load unauthorized env file!
|
|
|
|
-* /tmp/cramtests-*/leave.t/sub/.env.leave (glob)
|
2014-11-15 16:08:52 +02:00
|
|
|
|
|
|
|
**********************************************
|
|
|
|
|
|
|
|
echo LEFT
|
|
|
|
|
|
|
|
**********************************************
|
|
|
|
|
2014-11-27 14:33:04 +02:00
|
|
|
Would you like to authorize it? (type 'yes') no
|
2014-11-15 16:08:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
$ cd sub
|
|
|
|
ENTERED
|
2014-11-27 14:33:04 +02:00
|
|
|
$ _autoenv_ask_for_yes() { echo "yes"; return 0 }
|
2014-11-15 16:08:52 +02:00
|
|
|
$ cd ..
|
2014-11-27 14:33:04 +02:00
|
|
|
Attempting to load unauthorized env file!
|
|
|
|
-* /tmp/cramtests-*/leave.t/sub/.env.leave (glob)
|
2014-11-15 16:08:52 +02:00
|
|
|
|
|
|
|
**********************************************
|
|
|
|
|
|
|
|
echo LEFT
|
|
|
|
|
|
|
|
**********************************************
|
|
|
|
|
2014-11-27 14:33:04 +02:00
|
|
|
Would you like to authorize it? (type 'yes') yes
|
2014-11-15 16:08:52 +02:00
|
|
|
LEFT
|
|
|
|
|
|
|
|
|
|
|
|
Now check with subdirs, looking upwards.
|
|
|
|
|
2014-11-21 23:51:28 +02:00
|
|
|
$ AUTOENV_LOOK_UPWARDS=1
|
2014-11-15 16:08:52 +02:00
|
|
|
$ mkdir sub/child
|
|
|
|
$ cd sub/child
|
|
|
|
ENTERED
|
|
|
|
$ cd .
|
|
|
|
$ cd ..
|
|
|
|
$ cd ..
|
|
|
|
LEFT
|
|
|
|
|
|
|
|
|
|
|
|
Now check with subdirs, not looking at parent dirs.
|
|
|
|
|
2014-11-21 23:51:28 +02:00
|
|
|
$ AUTOENV_LOOK_UPWARDS=0
|
2014-11-15 16:08:52 +02:00
|
|
|
$ cd sub/child
|
|
|
|
$ cd ..
|
|
|
|
ENTERED
|
|
|
|
$ cd child
|
|
|
|
$ cd ../..
|
|
|
|
LEFT
|
2014-11-15 16:25:20 +02:00
|
|
|
|
|
|
|
|
2014-11-21 23:51:28 +02:00
|
|
|
Test that .env is sourced only once with AUTOENV_HANDLE_LEAVE=0.
|
2014-11-15 16:25:20 +02:00
|
|
|
|
2014-11-21 23:51:28 +02:00
|
|
|
$ unset _autoenv_stack_entered
|
|
|
|
$ AUTOENV_HANDLE_LEAVE=0
|
2014-11-15 16:25:20 +02:00
|
|
|
$ cd sub
|
|
|
|
ENTERED
|
|
|
|
$ cd ..
|
|
|
|
$ cd sub
|