Last active
October 6, 2018 21:24
-
-
Save thewyzard44/4c0ad89d0cbb68a50bdcc2c188dc83f1 to your computer and use it in GitHub Desktop.
chefdk + chruby in WSL/bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
umask 022 | |
export PATH=~/bin:`echo $PATH | sed 's|:/bin:|&/opscode/chefdk/bin:/mnt/c/Users/Sean/AppData/Local/chefdk/gem/ruby/2.4.0/bin:/opscode/chefdk/embedded/bin:|'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ln -sfv /mnt/c/opscode /opscode | |
ln -sfv /opscode/chefdk/embedded /opt/rubies/chefdk | |
find /opscode/chefdk/ | egrep '/(chefdk|embedded)/bin/[^\./]+$' | xargs sed -i '/^#!C:/s|C:/|/|' | |
ln -sfv ruby.exe /opscode/chefdk/embedded/bin/ruby | |
sed -i -e '/$UID/,/fi/s/^[[:space:]]*\(if \|fi\)/#&/' -e 's/puts/print/' /usr/local/share/chruby/chruby.sh | |
#TODO: still need to idempotently script placing this next command right after the ruby shell-out in the chruby_use function | |
# not needed unless/until I reinstall chruby | |
#[[ "$var" =~ /chefdk$ ]] && PATH="${PATH//$RUBY_ROOT\/bin:/}" && eval "$(chef shell-init bash | grep -v '^export PATH=' | sed 's/\r//g')" && return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~/bin
** the last line needs manually placed in /usr/local/share/chruby/chruby.sh until I get a minute to sed/script it
Features:
kitchen
- just not chef'sruby
)chruby chefdk
(Line 14)potential caveats:
chruby chefdk
. it "shouldn't" be a big issue(?) due to...oh whoops - in the .bashrc you'll need to update that path with your own username
End Goal: one idempotent script that I can run everytime I update chruby or chefdk