Skip to content

rosstimson/chef-ruby_install

Repository files navigation

ruby-install Chef Cookbook

Installs ruby-install, a simple way to build Rubies and the natural companion to chruby.

ruby-install itself is responsible for getting and dependencies necessary for building a particular Ruby.

Requirements

Cookbooks

The following cookbook is a direct dependency because it is used for common "default" functionality.

  • ark

On RHEL family distros, the "yum" cookbook is required for obtaining latest dependencies for building Rubies.

On Debian family distros, the "apt" cookbooks is required for obtaining latest dependencies for building Rubies.

Platform

The following platforms are supported and tested under test kitchen.

  • Ubuntu 14.10
  • Debian 7.8
  • CentOS 7.1
  • Fedora 21

Other Debian and RHEL family distributions are assumed to work. Other distributions that ruby-install supports should also work, please report any additional platforms so they can be added.

Usage

Simply include recipe[ruby_install] in your run_list to have ruby-install installed. You will also have access to the ruby_install_ruby resource.

Recipes

default

Installs the ruby-install codebase and initializes Chef to use the Lightweight Resources and Providers (LWRPs).

Attributes

version

The version of ruby-install that will be installed.

The default is the current latest version 0.4.1

checksum

sha256 checksum of the version to be installed, used for security.

The default is a checksum that matches up with the latest ruby-install.

default_ruby_base_path

The default base path for installed Rubies. For example the following resource:

ruby_install_ruby 'ruby 2.0.0-p247'

will be installed into "#{node['ruby_install']['default_ruby_base_path']}/ruby-2.0.0-p247"

The default is "/opt/rubies".

If you are using ruby-install alongside chruby it expects, by default, to find Rubies in /opt/rubies or ~/.rubies.

Development

Contributing

Pull requests are very welcome! Ideally create a topic branch for every separate change you make.

This cookbook uses [ChefSpec][chefspec] for unit tests. I also use Food Critic and RuboCop to check for style issues. When contributing it would be very helpful if you could run these via bundle exec spec and bundle exec style.

Lastly, there are Serverspec integration tests for use with Test Kitchen. At the very least the installation integration tests should be run, you can ignore the EC2 one if you don't have an AWS account (which you will get billed for). The allrubies tests often fail due to a particular Ruby failing to build on an OS, this is not necessarily an issue with this cookbook though so can safely be ignored. To see all of the available integration test suites just check bundle exec rake T or bundle exec kitchen list

License and Author

Author:: Ross Timson ([email protected])

Heavily influenced by, and some code from the Ruby-Build cookbook, Author:: Fletcher Nichol ([email protected])

Copyright 2013-2014, Ross Timson

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

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.