diff --git a/test.sh b/test.sh index 5255f41..6a98bfb 100755 --- a/test.sh +++ b/test.sh @@ -33,7 +33,9 @@ test_suite() { echo "Test: ~/.zshrc was generated" && assert_contain "$ZSHRC" 'ZSH="/root/.oh-my-zsh"' "!" echo "Test: theme was configured" && assert_contain "$ZSHRC" 'ZSH_THEME="agnoster"' "!" echo "Test: plugins were configured" && assert_contain "$ZSHRC" 'plugins=(git git-auto-fetch zsh-autosuggestions zsh-completions )' "!" - echo "Test: lines are appended to ~/.zshrc" && assert_contain "$ZSHRC" 'CASE_SENSITIVE="true"' "!" && assert_contain "$ZSHRC" 'HYPHEN_INSENSITIVE="true"' "!" + echo "Test: line 1 is appended to ~/.zshrc" && assert_contain "$ZSHRC" 'CASE_SENSITIVE="true"' "!" + echo "Test: line 2 is appended to ~/.zshrc" && assert_contain "$ZSHRC" 'HYPHEN_INSENSITIVE="true"' "!" + echo "Test: newline is expanded when append lines" && assert_not_contain "$ZSHRC" '\nCASE_SENSITIVE="true"' "!" echo echo "######### Success! All tests are passing for ${image_name}" diff --git a/zsh-in-docker.sh b/zsh-in-docker.sh index 5a00137..9e06d69 100755 --- a/zsh-in-docker.sh +++ b/zsh-in-docker.sh @@ -102,7 +102,7 @@ plugins=($_PLUGINS) source \$ZSH/oh-my-zsh.sh EOM - echo $ZSHRC_APPEND + printf $ZSHRC_APPEND } powerline10k_config() { @@ -119,10 +119,12 @@ install_dependencies cd /tmp +# Install On-My-Zsh if [ ! -d $HOME/.oh-my-zsh ]; then sh -c "$(curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" --unattended fi +# Generate plugin list plugin_list="" for plugin in $PLUGINS; do if [ "`echo $plugin | grep -E '^http.*'`" != "" ]; then @@ -134,8 +136,10 @@ for plugin in $PLUGINS; do plugin_list="${plugin_list}$plugin_name " done +# Generate .zshrc zshrc_template "$HOME" "$THEME" "$plugin_list" > $HOME/.zshrc +# Install powerlevel10k if not other theme were specified if [ "$THEME" = "powerlevel10k/powerlevel10k" ]; then git clone https://github.com/romkatv/powerlevel10k $HOME/.oh-my-zsh/custom/themes/powerlevel10k powerline10k_config >> $HOME/.zshrc