mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2025-12-14 02:15:11 +02:00
Use AUTOENV prefix
- s/DOTENV_/AUTOENV_/ - s/dotenv_/autoenv_/ Ref: https://github.com/Tarrasch/zsh-autoenv/issues/6
This commit is contained in:
@@ -12,9 +12,9 @@ Manually create auth file
|
||||
|
||||
Now try to make it accept it
|
||||
|
||||
$ unset _dotenv_stack_entered
|
||||
$ unset _autoenv_stack_entered
|
||||
$ rm $AUTOENV_ENV_FILENAME
|
||||
$ _dotenv_read_answer() { echo 'y' }
|
||||
$ _autoenv_read_answer() { echo 'y' }
|
||||
$ cd .
|
||||
Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
|
||||
|
||||
@@ -35,11 +35,11 @@ The last "ENTERED" is because it executed the command
|
||||
|
||||
Now lets see that it actually checks the shasum value
|
||||
|
||||
$ unset _dotenv_stack_entered
|
||||
$ unset _autoenv_stack_entered
|
||||
$ cd .
|
||||
ENTERED
|
||||
|
||||
$ unset _dotenv_stack_entered
|
||||
$ unset _autoenv_stack_entered
|
||||
$ rm $AUTOENV_ENV_FILENAME
|
||||
$ test_autoenv_add_to_env $PWD/.env mischief
|
||||
$ cd .
|
||||
@@ -60,9 +60,9 @@ Now lets see that it actually checks the shasum value
|
||||
|
||||
Now, will it take no for an answer?
|
||||
|
||||
$ unset _dotenv_stack_entered
|
||||
$ unset _autoenv_stack_entered
|
||||
$ rm $AUTOENV_ENV_FILENAME
|
||||
$ _dotenv_read_answer() { echo 'n' }
|
||||
$ _autoenv_read_answer() { echo 'n' }
|
||||
$ cd .
|
||||
Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
Test $PWD, $_dotenv_from_dir and _dotenv_to_dir.
|
||||
Test $PWD, $_autoenv_from_dir and _autoenv_to_dir.
|
||||
|
||||
$ source $TESTDIR/setup.sh
|
||||
|
||||
Setup env actions / output.
|
||||
|
||||
$ DOTENV_LOOK_UPWARDS=1
|
||||
$ AUTOENV_LOOK_UPWARDS=1
|
||||
$ mkdir -p sub/sub2
|
||||
$ cd sub
|
||||
$ echo 'echo ENTERED: PWD:${PWD:t} from:${_dotenv_from_dir:t} to:${_dotenv_to_dir:t}' > .env
|
||||
$ echo 'echo LEFT: PWD:${PWD:t} from:${_dotenv_from_dir:t} to:${_dotenv_to_dir:t}' > .env.leave
|
||||
$ echo 'echo ENTERED: PWD:${PWD:t} from:${_autoenv_from_dir:t} to:${_autoenv_to_dir:t}' > .env
|
||||
$ echo 'echo LEFT: PWD:${PWD:t} from:${_autoenv_from_dir:t} to:${_autoenv_to_dir:t}' > .env.leave
|
||||
|
||||
Manually create auth files.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Lets set a simple .env action
|
||||
|
||||
Change to the directory.
|
||||
|
||||
$ _dotenv_read_answer() { echo 'y' }
|
||||
$ _autoenv_read_answer() { echo 'y' }
|
||||
$ cd .
|
||||
Attempting to load unauthorized env file: /tmp/cramtests-??????/leave.t/sub/.env (glob)
|
||||
|
||||
@@ -25,7 +25,7 @@ Change to the directory.
|
||||
|
||||
Leave the directory and answer "no".
|
||||
|
||||
$ _dotenv_read_answer() { echo 'n' }
|
||||
$ _autoenv_read_answer() { echo 'n' }
|
||||
$ cd ..
|
||||
Attempting to load unauthorized env file: /tmp/cramtests-??????/leave.t/sub/.env.leave (glob)
|
||||
|
||||
@@ -40,7 +40,7 @@ Leave the directory and answer "no".
|
||||
|
||||
$ cd sub
|
||||
ENTERED
|
||||
$ _dotenv_read_answer() { echo 'y' }
|
||||
$ _autoenv_read_answer() { echo 'y' }
|
||||
$ cd ..
|
||||
Attempting to load unauthorized env file: /tmp/cramtests-??????/leave.t/sub/.env.leave (glob)
|
||||
|
||||
@@ -56,7 +56,7 @@ Leave the directory and answer "no".
|
||||
|
||||
Now check with subdirs, looking upwards.
|
||||
|
||||
$ DOTENV_LOOK_UPWARDS=1
|
||||
$ AUTOENV_LOOK_UPWARDS=1
|
||||
$ mkdir sub/child
|
||||
$ cd sub/child
|
||||
ENTERED
|
||||
@@ -68,7 +68,7 @@ Now check with subdirs, looking upwards.
|
||||
|
||||
Now check with subdirs, not looking at parent dirs.
|
||||
|
||||
$ DOTENV_LOOK_UPWARDS=0
|
||||
$ AUTOENV_LOOK_UPWARDS=0
|
||||
$ cd sub/child
|
||||
$ cd ..
|
||||
ENTERED
|
||||
@@ -77,10 +77,10 @@ Now check with subdirs, not looking at parent dirs.
|
||||
LEFT
|
||||
|
||||
|
||||
Test that .env is sourced only once with DOTENV_HANDLE_LEAVE=0.
|
||||
Test that .env is sourced only once with AUTOENV_HANDLE_LEAVE=0.
|
||||
|
||||
$ unset _dotenv_stack_entered
|
||||
$ DOTENV_HANDLE_LEAVE=0
|
||||
$ unset _autoenv_stack_entered
|
||||
$ AUTOENV_HANDLE_LEAVE=0
|
||||
$ cd sub
|
||||
ENTERED
|
||||
$ cd ..
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
_AUTOENV_TEST_READ_ARGS='-t 1'
|
||||
|
||||
test_autoenv_add_to_env() {
|
||||
_dotenv_hash_pair $1 $2 >> $AUTOENV_ENV_FILENAME
|
||||
_autoenv_hash_pair $1 $2 >> $AUTOENV_ENV_FILENAME
|
||||
}
|
||||
|
||||
# Add enter and leave env files to authentication file.
|
||||
test_autoenv_auth_env_files() {
|
||||
echo -n > $AUTOENV_ENV_FILENAME
|
||||
test_autoenv_add_to_env $PWD/$DOTENV_FILE_ENTER
|
||||
test_autoenv_add_to_env $PWD/$DOTENV_FILE_LEAVE
|
||||
test_autoenv_add_to_env $PWD/$AUTOENV_FILE_ENTER
|
||||
test_autoenv_add_to_env $PWD/$AUTOENV_FILE_LEAVE
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ Setup test environment.
|
||||
|
||||
$ mkdir sub
|
||||
$ cd sub
|
||||
$ echo "autostash FOO=baz" > $DOTENV_FILE_ENTER
|
||||
$ echo "autounstash" > $DOTENV_FILE_LEAVE
|
||||
$ echo "autostash FOO=baz" > $AUTOENV_FILE_ENTER
|
||||
$ echo "autounstash" > $AUTOENV_FILE_LEAVE
|
||||
|
||||
Manually create auth file
|
||||
|
||||
|
||||
Reference in New Issue
Block a user