Skip to content

docwhat/rbenv-chef-workstation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rbenv-chef-workstation: Use Chef Workstation with rbenv

This plugin lets you treat Chef Workstation as another version in rbenv.

Chef Workstation replaces ChefDK. If you want to use ChefDK instead, then use the old rbenv-chefdk plugin instead.

Requirements

Installation

To install rbenv-chef-workstation, clone this repository into the $(rbenv root)/plugins directory.

$ cd $(rbenv root)/plugins
$ git clone <url>

Warning: If you've previously installed Chef Workstation, you will want to undo the changes recommended in the Chef Workstation install instructions or in the Homebrew info gist. Otherwise rbenv or Chef Workstation will not work correctly.

Then create an empty directory in $(rbenv root)/versions called chef-workstation:

$ mkdir "$(rbenv root)/versions/chef-workstation"

Finally, change to the new chef-workstation version and run rbenv rehash.

$ rbenv shell chef-workstation
$ rbenv rehash
$ rbenv which ruby
/opt/chef-workstation/embedded/bin/ruby

That's it!

Troubleshooting

If you are having problems, try running sanity-check.sh:

$ $SHELL "$(rbenv root)/plugins/rbenv-chef-workstation/sanity-check.sh"

Error running commands and errors talk about chefdk

Make sure you have completely uninstalled chefdk:

# This removes old Gems and the rbenv-chefdk plugin.
$ rm -rf ~/.chefdk "$(rbenv root)/plugins/rbenv-chefdk" "$(rbenv root)/versions/chefdk"

Frequently Asked Questions

Hey, what happened to gem?

With the Chef Workstation you have to use chef gem instead.

Why don't you include /opt/chef-workstation/embedded/bin?

We don't fully include the /opt/chef-workstation/embedded/bin directory because it'll break your system in subtle ways.

/opt/chef-workstation/embedded/bin has commands like clear, tput, xsltproc, and xz. These are commands that are part of your system and are only included in Chef Workstation so it gets reliable results across platforms.

If we made shims of these commands, your system might break when not using chef-workstation and can produce unexpected results even if you were using chef-workstation if your version of these commands are different (e.g. Gnu vs. BSD or version).

Why not just symlink /opt/chef-workstation/embedded to $(rbenv root)/versions/chef-workstation?

For the same reason we don't include /opt/chef-workstation/embedded/bin: It breaks systems commands in unexpected ways.

Rbenv isn't working or is using gems from the wrong place

Make sure you undid any changes recommended by the Chef Workstation install instructions or in the Homebrew info gist.

Specifically, make sure you aren't calling chef shell-init anyplace in your shell startup files.

"can't find executable chef (Gem::Exception)"

This is because you are using rbenv-bundle-exec.

You'll have to tell rbenv-bundle-exec to ignore a bunch of binaries that are only in Chef Workstation:

echo chef >> ~/.no_bundle_exec
echo berks >> ~/.no_bundle_exec

Questions?

You can reach me at docwhat.org or as docwhat on Freenode IRC.

License

See the LICENSE file

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit
  • Send me a pull request. Bonus points for topic branches.

Releases

No releases published

Packages

No packages published

Languages