Development repository for the ruby_rbenv cookbook
Ruby HTML
Latest commit 46df66c Oct 26, 2017 @tas50 tas50 Merge pull request #194 from gavvvr/centos-6.7_missing-tar
Missing tar package for CentOS 6.7
Permalink
Failed to load latest commit information.
.delivery Test with Local Delivery instead of Rake Jun 16, 2017
.github Add github templates Apr 11, 2017
foodcritic Updatee platforms, foodcritic (sous-chefs), Cookstyle Feb 28, 2017
libraries Run gem resource commands as a local rbenv user (#193) Oct 26, 2017
resources Missing tar package for CentOS 6.7 Oct 26, 2017
templates Switch LWRPs to custom resources (#169) Jul 24, 2017
test Run gem resource commands as a local rbenv user (#193) Oct 26, 2017
.gitignore Update changelog and ignore direnv (#172) Jul 24, 2017
.gitmodules Updatee platforms, foodcritic (sous-chefs), Cookstyle Feb 28, 2017
.kitchen.appveyor.yml Switch LWRPs to custom resources (#169) Jul 24, 2017
.kitchen.dokken.yml Run gem resource commands as a local rbenv user (#193) Oct 26, 2017
.kitchen.yml Switch LWRPs to custom resources (#169) Jul 24, 2017
.travis.yml Gem install (#178) Aug 3, 2017
Berksfile Switch LWRPs to custom resources (#169) Jul 24, 2017
CHANGELOG.md Release 2.0.5 Oct 17, 2017
CODE_OF_CONDUCT.md Updatee platforms, foodcritic (sous-chefs), Cookstyle Feb 28, 2017
CONTRIBUTING.md Updatee platforms, foodcritic (sous-chefs), Cookstyle Feb 28, 2017
Gemfile Switch LWRPs to custom resources (#169) Jul 24, 2017
Guardfile Fix inconsistent indents Oct 12, 2015
LICENSE Remove the copyright from the license file Jul 18, 2016
README.md Fix insall -> install typo (#192) Oct 23, 2017
appveyor.yml Switch LWRPs to custom resources (#169) Jul 24, 2017
chefignore Update ignore files Apr 11, 2017
metadata.rb Release 2.0.5 Oct 17, 2017

README.md

Chef ruby_rbenv Cookbook

Build Status Cookbook Version

Description

Manages rbenv and its installed Rubies.

Several custom_resources are defined facilitate this.

WARNING: As of version 1.0 this cookbook was renamed from rbenv to ruby_rbenv so it could be uploaded to the Supermarket.

Requirements

Chef

This cookbook requires Chef 12.9+.

Platform

  • Debian derivatives
  • Fedora
  • macOS
  • RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux)
  • openSUSE and openSUSE leap

Usage

Please read

Example installations are provided in test/fixtures/cookbooks/test/recipes/

A rbenv_system_install or rbenv_user_install is required to be set so that rbenv knows which version you want to use, and is installed on the system.

Gem

Used to install a gem into the selected rbenv environment.

rbenv_gem 'gem_name' do
  options # Optional: Options to pass to the gem command e.g. '--no-rdoc --no-ri'
  source # Optional: source URL/location for gem.
  timeout # Optional: Gem install timeout
  version # Optional: Gem version to install
  response_file # Optional: response file to reconfigure a gem
  rbenv_version # Which rbenv verison to install the gem to. Defaults to global
end

Global

rbenv_global '2.3.4' do
  user # Optional: if passed sets the users global version. Do not set, to set the systems global version
end

If a user is passed in to this resource it sets the global version for the user, under the users root_path (usually ~/.rbenv/version), otherwise it sets the system global version.

Plugin

Installs a rbenv plugin.

rbenv_plugin 'ruby-build' do
  git_url # Git URL of the plugin
  git_ref # Git reference of the plugin
  user # Optional: if passed installs to the users rbenv. Do not set, to set installs to the system rbenv.
end

If user is passed in, the plugin is installed to the users install of rbenv.

Rehash

rbenv_rehash 'rehash' do
  user 'vagrant' # Optional: if passed rehashes the user Ruby otherwise rehashes the system rbenv
end

Ruby

Installs a given Ruby version to the system or user location.

rbenv_ruby '2.3.4' do
  user # Optional: If passed the user rbenv to install to
  rbenv_action # Optional: the action to perform, install, remove etc
end

Shorter example rbenv_ruby '2.4.1'

Script

Runs a rbenv aware script.

rbenv_script 'foo' do
  rbenv_version #rbenv version to run the script against
  environment # Optional: Environment to setup to run the script
  user # Optional: User to run as
  group # Optional: Group to run as
  path # Optional: User to run as
  returns # Optional: Expected return code
  code # Script code to run
end

System_install

Installs rbenv to the system location, by default /usr/local/rbenv

rbenv_system_install 'foo' do
  git_url # URL of the plugin repo you want to checkout
  git_ref # Optional: Git reference to checkout
  update_rbenv # Optional: Keeps the git repo up to date
end

User_install

Installs rbenv to the user path, making rbenv available to that user only.

rbenv_user_install 'vagrant' do
  git_url # Optional: Git URL to checkout rbenv from.
  git_ref # Optional: Git reference to checkout e.g. 'master'
  user # Which user to install rbenv to (also specified in the resources name above)
end

System-Wide Mac Installation Note

This cookbook takes advantage of managing profile fragments in an /etc/profile.d directory, common on most Unix-flavored platforms. Unfortunately, Mac OS X does not support this idiom out of the box, so you may need to modify your user profile.

Development

Pull requests are very welcome! Make sure your patches are well tested.

License and Author

Copyright 2011, Fletcher Nichol

Copyright 2017, Dan Webb

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.