├── spec └── .gitkeep ├── documentation ├── .gitkeep └── resources │ ├── rbenv_rehash.md │ ├── rbenv_system_install.md │ ├── rbenv_global.md │ ├── rbenv_plugin.md │ ├── rbenv_ruby.md │ ├── rbenv_user_install.md │ ├── rbenv_gem.md │ └── rbenv_script.md ├── .gitattributes ├── .mdlrc ├── .github ├── CODEOWNERS ├── lock.yml ├── workflows │ ├── conventional-commits.yml │ ├── prevent-file-change.yml │ ├── release.yml │ ├── copilot-setup-steps.yml │ ├── stale.yml │ └── ci.yml └── copilot-instructions.md ├── .release-please-manifest.json ├── .rubocop.yml ├── test ├── fixtures │ └── cookbooks │ │ └── test │ │ ├── recipes │ │ ├── rehash.rb │ │ ├── script.rb │ │ ├── system_install.rb │ │ ├── global.rb │ │ ├── ruby_uninstall.rb │ │ ├── user_install.rb │ │ ├── dokken.rb │ │ ├── custom_group_install.rb │ │ ├── plugin.rb │ │ └── gem.rb │ │ └── metadata.rb ├── integration │ ├── ruby_uninstall │ │ ├── inspec.yml │ │ └── controls │ │ │ └── ruby_uninstall.rb │ ├── global │ │ ├── inspec.yml │ │ └── controls │ │ │ └── global_install.rb │ ├── user_install │ │ ├── inspec.yml │ │ └── controls │ │ │ └── user_install.rb │ ├── gem │ │ ├── inspec.yml │ │ └── controls │ │ │ └── gem_install.rb │ ├── system_install │ │ ├── inspec.yml │ │ └── controls │ │ │ └── system_install.rb │ └── custom_group_install │ │ ├── inspec.yml │ │ └── controls │ │ └── default.rb └── unit │ ├── user_spec.rb │ ├── default_spec.rb │ ├── system_spec.rb │ ├── user_install_spec.rb │ └── system_install_spec.rb ├── .envrc ├── CODE_OF_CONDUCT.md ├── kitchen.exec.yml ├── Berksfile ├── TESTING.md ├── .vscode └── extensions.json ├── CONTRIBUTING.md ├── resources ├── _partial │ ├── _common.rb │ └── _git.rb ├── rehash.rb ├── plugin.rb ├── global.rb ├── system_install.rb ├── script.rb ├── user_install.rb ├── ruby.rb └── gem.rb ├── Guardfile ├── .markdownlint-cli2.yaml ├── .yamllint ├── release-please-config.json ├── .editorconfig ├── templates └── rbenv.sh.erb ├── renovate.json ├── .overcommit.yml ├── .gitignore ├── metadata.rb ├── kitchen.global.yml ├── kitchen.yml ├── Dangerfile ├── chefignore ├── kitchen.dokken.yml ├── libraries ├── package_deps.rb └── helpers.rb ├── README.md ├── LICENSE └── CHANGELOG.md /spec/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /documentation/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD013", "~MD024" 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sous-chefs/maintainers 2 | -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "5.0.24" 3 | } 4 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | AllCops: 3 | Exclude: 4 | - 'Dangerfile' 5 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/rehash.rb: -------------------------------------------------------------------------------- 1 | rbenv_rehash 'defaultness' 2 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | export KITCHEN_GLOBAL_YAML=kitchen.global.yml 3 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/script.rb: -------------------------------------------------------------------------------- 1 | rbenv_script 'not-much' do 2 | code 'rake nadda' 3 | end 4 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | version '0.99.0' 3 | 4 | depends 'ruby_rbenv' 5 | depends 'yum-almalinux' 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Guidelines 2 | 3 | This project follows the Chef Community Guidelines 4 | -------------------------------------------------------------------------------- /kitchen.exec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: { name: exec } 3 | transport: { name: exec } 4 | 5 | platforms: 6 | - name: macos-latest 7 | - name: windows-latest 8 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'test', path: 'test/fixtures/cookbooks/test' 7 | end 8 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/system_install.rb: -------------------------------------------------------------------------------- 1 | # Install Rbenv to the system path e.g. /usr/local/rbenv 2 | rbenv_system_install 'system' do 3 | update_rbenv false 4 | end 5 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/TESTING.MD). 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "Shopify.ruby-lsp", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please refer to 4 | [https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD) 5 | -------------------------------------------------------------------------------- /resources/_partial/_common.rb: -------------------------------------------------------------------------------- 1 | property :user, 2 | String, 3 | description: '' 4 | 5 | property :root_path, 6 | String, 7 | default: lazy { Chef::Rbenv::Helpers.root_path(node, user) }, 8 | description: '' 9 | -------------------------------------------------------------------------------- /test/integration/ruby_uninstall/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rbenv 3 | title: rbenv profile 4 | maintainer: Sous Chefs 5 | license: Apache-2.0 6 | summary: Verifies that Rubies can be uninstalled 7 | version: 1.0.0 8 | supports: 9 | - os-family: linux 10 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | guard :rspec, spec_paths: ['test/unit'] do 2 | watch(%r{^test/unit/.+_spec\.rb$}) 3 | watch(%r{^(libraries|providers|recipes|resources)/(.+)\.rb$}) { |m| "test/unit/#{m[1]}/#{m[2]}_spec.rb" } 4 | watch('test/unit/spec_helper.rb') { 'test/unit' } 5 | end 6 | -------------------------------------------------------------------------------- /.github/lock.yml: -------------------------------------------------------------------------------- 1 | --- 2 | daysUntilLock: 365 3 | exemptLabels: [] 4 | lockLabel: false 5 | lockComment: > 6 | This thread has been automatically locked since there has not been 7 | any recent activity after it was closed. Please open a new issue for 8 | related bugs. 9 | -------------------------------------------------------------------------------- /.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | ul-indent: false # MD007 3 | line-length: false # MD013 4 | no-duplicate-heading: false # MD024 5 | reference-links-images: false # MD052 6 | no-multiple-blanks: 7 | maximum: 2 8 | ignores: 9 | - .github/copilot-instructions.md 10 | -------------------------------------------------------------------------------- /test/integration/global/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rbenv 3 | title: rbenv profile 4 | maintainer: Sous Chefs 5 | copyright: Webb Agile Solutions Ltd. 6 | license: Apache-2.0 7 | summary: Verifies rbenv correctly sets the global Ruby version 8 | version: 1.0.0 9 | supports: 10 | - os-family: linux 11 | -------------------------------------------------------------------------------- /test/integration/user_install/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rbenv 3 | title: rbenv profile 4 | maintainer: Sous Chefs 5 | copyright: Webb Agile Solutions Ltd. 6 | license: Apache-2.0 7 | summary: Verifies rbenv is installed correctly for a user 8 | version: 1.0.0 9 | supports: 10 | - os-family: linux 11 | -------------------------------------------------------------------------------- /test/integration/gem/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rbenv 3 | title: rbenv profile 4 | maintainer: Sous Chefs 5 | copyright: Webb Agile Solutions Ltd. 6 | license: Apache-2.0 7 | summary: Verifies gems install correctly to the correct Ruby versions 8 | version: 1.0.0 9 | supports: 10 | - os-family: linux 11 | -------------------------------------------------------------------------------- /test/integration/system_install/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rbenv 3 | title: rbenv profile 4 | maintainer: Sous Chefs 5 | copyright: Webb Agile Solutions Ltd. 6 | license: Apache-2.0 7 | summary: Verifies rbenv is installed correctly system wide 8 | version: 1.0.0 9 | supports: 10 | - os-family: linux 11 | -------------------------------------------------------------------------------- /test/integration/custom_group_install/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rbenv 3 | title: rbenv profile 4 | maintainer: Sous Chefs 5 | copyright: Webb Agile Solutions Ltd. 6 | license: Apache-2.0 7 | summary: Verifies rbenv is installed correctly for a user & group 8 | version: 1.0.0 9 | supports: 10 | - os-family: linux 11 | -------------------------------------------------------------------------------- /.github/workflows/conventional-commits.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: conventional-commits 3 | 4 | "on": 5 | pull_request: 6 | types: 7 | - opened 8 | - reopened 9 | - edited 10 | - synchronize 11 | 12 | jobs: 13 | conventional-commits: 14 | uses: sous-chefs/.github/.github/workflows/conventional-commits.yml@5.0.3 15 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | rules: 4 | line-length: 5 | max: 256 6 | level: warning 7 | document-start: disable 8 | braces: 9 | forbid: false 10 | min-spaces-inside: 0 11 | max-spaces-inside: 1 12 | min-spaces-inside-empty: -1 13 | max-spaces-inside-empty: -1 14 | comments: 15 | min-spaces-from-content: 1 16 | -------------------------------------------------------------------------------- /resources/_partial/_git.rb: -------------------------------------------------------------------------------- 1 | property :git_url, 2 | String, 3 | default: 'https://github.com/rbenv/rbenv.git', 4 | description: 'Git URL to download the plugin from.' 5 | 6 | property :git_ref, 7 | String, 8 | default: 'master', 9 | description: 'Git reference to download, can be a SHA, tag or branch name.' 10 | -------------------------------------------------------------------------------- /test/unit/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | describe 'ruby_rbenv::user' do 5 | let(:chef_run) do 6 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) 7 | end 8 | 9 | it 'converges successfully' do 10 | expect { chef_run }.to_not raise_error 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/unit/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | describe 'ruby_rbenv::default' do 5 | let(:chef_run) do 6 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) 7 | end 8 | 9 | it 'converges successfully' do 10 | expect { chef_run }.to_not raise_error 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/unit/system_spec.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | describe 'ruby_rbenv::system' do 5 | let(:chef_run) do 6 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) 7 | end 8 | 9 | it 'converges successfully' do 10 | expect { chef_run }.to_not raise_error 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/unit/user_install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | describe 'ruby_rbenv::user_install' do 5 | let(:chef_run) do 6 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) 7 | end 8 | 9 | it 'converges successfully' do 10 | expect { chef_run }.to_not raise_error 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/unit/system_install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | describe 'ruby_rbenv::system_install' do 5 | let(:chef_run) do 6 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) 7 | end 8 | 9 | it 'converges successfully' do 10 | expect { chef_run }.to_not raise_error 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/global.rb: -------------------------------------------------------------------------------- 1 | global_version = '2.4.1' 2 | 3 | # Make sure that Vagarant user is on the box for dokken 4 | include_recipe 'test::dokken' 5 | 6 | # Install Rbenv Globally 7 | rbenv_system_install 'system' 8 | 9 | rbenv_ruby global_version do 10 | verbose true 11 | end 12 | 13 | # Set that Ruby as the global Ruby 14 | rbenv_global global_version 15 | -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | ".": { 4 | "package-name": "ruby_rbenv", 5 | "changelog-path": "CHANGELOG.md", 6 | "release-type": "ruby", 7 | "include-component-in-tag": false, 8 | "version-file": "metadata.rb" 9 | } 10 | }, 11 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" 12 | } 13 | -------------------------------------------------------------------------------- /.github/workflows/prevent-file-change.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: prevent-file-change 3 | 4 | "on": 5 | pull_request: 6 | types: 7 | - opened 8 | - reopened 9 | - edited 10 | - synchronize 11 | 12 | jobs: 13 | prevent-file-change: 14 | uses: sous-chefs/.github/.github/workflows/prevent-file-change.yml@5.0.3 15 | secrets: 16 | token: ${{ secrets.GITHUB_TOKEN }} 17 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root=true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | indent_style = space 13 | indent_size = 2 14 | 15 | # Avoid issues parsing cookbook files later 16 | charset = utf-8 17 | 18 | # Avoid cookstyle warnings 19 | trim_trailing_whitespace = true 20 | -------------------------------------------------------------------------------- /test/integration/global/controls/global_install.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | global_ruby = '2.4.1' 3 | 4 | control 'Rbenv should be installed' do 5 | title 'Rbenv should be installed globally' 6 | 7 | desc "Can set global Ruby version to #{global_ruby}" 8 | describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do 9 | its('exit_status') { should eq 0 } 10 | its('stdout') { should include(global_ruby) } 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/integration/ruby_uninstall/controls/ruby_uninstall.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | global_system_ruby = '2.5.1' 4 | 5 | control 'Ruby uninstall' do 6 | title 'Ruby should be uninstalled' 7 | 8 | desc "#{global_system_ruby} should be uninstalled" 9 | describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do 10 | its('exit_status') { should eq 0 } 11 | its('stdout') { should_not match(/#{Regexp.quote(global_system_ruby)}/) } 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /templates/rbenv.sh.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef for <%= node['fqdn'] %> 2 | # Local modifications will be overridden 3 | 4 | # prefer a user rbenv over a system wide install 5 | if [ -s "${HOME}/.rbenv/bin" ]; then 6 | rbenv_root="${HOME}/.rbenv" 7 | elif [ -s "<%= @global_prefix %>" ]; then 8 | rbenv_root="<%= @global_prefix %>" 9 | export RBENV_ROOT="$rbenv_root" 10 | fi 11 | 12 | if [ -n "$rbenv_root" ]; then 13 | export PATH="${rbenv_root}/bin:$PATH" 14 | eval "$(rbenv init -)" 15 | fi 16 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/ruby_uninstall.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | system_version = '2.5.1' 4 | 5 | # Make sure that Vagarant user is on the box for dokken 6 | include_recipe 'test::dokken' 7 | 8 | # System Install 9 | rbenv_system_install 'system' 10 | 11 | # Install system wide Ruby 12 | rbenv_ruby system_version 13 | 14 | # Set System global version 15 | rbenv_global system_version 16 | 17 | # Uninstall Ruby 18 | rbenv_ruby system_version do 19 | rbenv_action 'uninstall' 20 | end 21 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "packageRules": [ 5 | { 6 | "groupName": "Actions", 7 | "matchUpdateTypes": ["minor", "patch", "pin"], 8 | "automerge": true, 9 | "addLabels": ["Release: Patch", "Skip: Announcements"] 10 | }, 11 | { 12 | "groupName": "Actions", 13 | "matchUpdateTypes": ["major"], 14 | "automerge": false, 15 | "addLabels": ["Release: Patch", "Skip: Announcements"] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/user_install.rb: -------------------------------------------------------------------------------- 1 | # Install rbenv and makes it avilable to the selected user 2 | version = '2.4.1' 3 | 4 | # Make sure that Vagarant user is on the box for dokken 5 | include_recipe 'test::dokken' 6 | 7 | # Keeps the rbenv install upto date 8 | rbenv_user_install 'vagrant' 9 | 10 | rbenv_plugin 'ruby-build' do 11 | git_url 'https://github.com/rbenv/ruby-build.git' 12 | user 'vagrant' 13 | end 14 | 15 | rbenv_ruby '2.4.1' do 16 | user 'vagrant' 17 | end 18 | 19 | rbenv_global version do 20 | user 'vagrant' 21 | end 22 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: release 3 | 4 | "on": 5 | push: 6 | branches: 7 | - main 8 | 9 | permissions: 10 | contents: write 11 | issues: write 12 | pull-requests: write 13 | packages: write 14 | attestations: write 15 | id-token: write 16 | 17 | jobs: 18 | release: 19 | uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@5.0.3 20 | secrets: 21 | token: ${{ secrets.PORTER_GITHUB_TOKEN }} 22 | supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }} 23 | supermarket_key: ${{ secrets.CHEF_SUPERMARKET_KEY }} 24 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/dokken.rb: -------------------------------------------------------------------------------- 1 | # Make sure Vagrant user is on the box. This should fix the dokken user install 2 | user 'vagrant' 3 | 4 | group 'vagrant' do 5 | members 'vagrant' 6 | end 7 | 8 | directory '/home/vagrant' do 9 | owner 'vagrant' 10 | group 'vagrant' 11 | not_if { platform?('windows') } 12 | end 13 | 14 | if platform_family?('rhel', 'amazon') && node['platform_version'].to_i >= 8 15 | yum_alma_baseos 'base' 16 | yum_alma_extras 'extras' 17 | yum_alma_appstream 'appstream' 18 | yum_alma_powertools 'powertools' 19 | package 'perl' 20 | end 21 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_rehash.md: -------------------------------------------------------------------------------- 1 | # Rehash 2 | 3 | If user is passed in, the user Ruby is rehashed rather than the system Ruby. 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | --------- | -------- | -------------------- | ------------------------------ | 9 | | user | `String` | | Username to run the script as. | 10 | | root_path | `String` | See root_path helper | Path to install Ruby to. | 11 | 12 | ## Example 13 | 14 | ```ruby 15 | rbenv_rehash 'rehash' do 16 | user 'vagrant' 17 | end 18 | ``` 19 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PreCommit: 3 | TrailingWhitespace: 4 | enabled: true 5 | YamlLint: 6 | enabled: true 7 | required_executable: "yamllint" 8 | ChefSpec: 9 | enabled: true 10 | required_executable: "chef" 11 | command: ["chef", "exec", "rspec"] 12 | Cookstyle: 13 | enabled: true 14 | required_executable: "cookstyle" 15 | command: ["cookstyle"] 16 | MarkdownLint: 17 | enabled: false 18 | required_executable: "npx" 19 | command: ["npx", "markdownlint-cli2", "'**/*.md'"] 20 | include: ["**/*.md"] 21 | 22 | CommitMsg: 23 | HardTabs: 24 | enabled: true 25 | -------------------------------------------------------------------------------- /test/integration/system_install/controls/system_install.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | control 'Rbenv system install' do 4 | title 'Rbenv should be installed system wide' 5 | 6 | desc 'Rbenv should be installed and run successfully' 7 | describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do 8 | its('exit_status') { should eq 0 } 9 | end 10 | end 11 | 12 | control 'Rbenv system path' do 13 | title 'Rbenv should be installed in the system wide location' 14 | 15 | describe file('/usr/local/rbenv') do 16 | it { should exist } 17 | it { should be_directory } 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /.github/workflows/copilot-setup-steps.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'Copilot Setup Steps' 3 | 4 | "on": 5 | workflow_dispatch: 6 | push: 7 | paths: 8 | - .github/workflows/copilot-setup-steps.yml 9 | pull_request: 10 | paths: 11 | - .github/workflows/copilot-setup-steps.yml 12 | 13 | jobs: 14 | copilot-setup-steps: 15 | runs-on: ubuntu-latest 16 | permissions: 17 | contents: read 18 | steps: 19 | - name: Check out code 20 | uses: actions/checkout@v5 21 | - name: Install Chef 22 | uses: actionshub/chef-install@main 23 | - name: Install cookbooks 24 | run: berks install 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | .config 3 | InstalledFiles 4 | pkg 5 | test/tmp 6 | test/version_tmp 7 | tmp 8 | _Store 9 | *~ 10 | *# 11 | .#* 12 | \#*# 13 | *.un~ 14 | *.tmp 15 | *.bk 16 | *.bkup 17 | 18 | # editor files 19 | .idea 20 | .*.sw[a-z] 21 | 22 | # ruby/bundler/rspec files 23 | .ruby-version 24 | .ruby-gemset 25 | .rvmrc 26 | Gemfile.lock 27 | .bundle 28 | *.gem 29 | coverage 30 | spec/reports 31 | 32 | # YARD / rdoc artifacts 33 | .yardoc 34 | _yardoc 35 | doc/ 36 | rdoc 37 | 38 | # chef infra stuff 39 | Berksfile.lock 40 | .kitchen 41 | kitchen.local.yml 42 | vendor/ 43 | .coverage/ 44 | .zero-knife.rb 45 | Policyfile.lock.json 46 | 47 | # vagrant stuff 48 | .vagrant/ 49 | .vagrant.d/ 50 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/custom_group_install.rb: -------------------------------------------------------------------------------- 1 | # Install rbenv and makes it avilable to the selected user 2 | version = '2.4.1' 3 | 4 | # Make sure that Vagarant user is on the box for dokken 5 | include_recipe 'test::dokken' 6 | 7 | group 'new-group' do 8 | members 'vagrant' 9 | end 10 | 11 | # Keeps the rbenv install upto date 12 | rbenv_user_install 'vagrant' do 13 | user 'vagrant' 14 | group 'new-group' 15 | end 16 | 17 | rbenv_plugin 'ruby-build' do 18 | git_url 'https://github.com/rbenv/ruby-build.git' 19 | user 'vagrant' 20 | end 21 | 22 | rbenv_ruby '2.4.1' do 23 | user 'vagrant' 24 | end 25 | 26 | rbenv_global version do 27 | user 'vagrant' 28 | end 29 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'ruby_rbenv' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | issues_url 'https://github.com/sous-chefs/ruby_rbenv/issues' 5 | source_url 'https://github.com/sous-chefs/ruby_rbenv' 6 | license 'Apache-2.0' 7 | description 'Manages rbenv and installs Rbenv based Rubies' 8 | version '5.0.24' 9 | chef_version '>= 16.0' 10 | 11 | depends 'yum-almalinux' 12 | 13 | supports 'amazon' 14 | supports 'centos' 15 | supports 'debian' 16 | supports 'fedora' 17 | supports 'linuxmint' 18 | supports 'mac_os_x' 19 | supports 'opensuse' 20 | supports 'redhat' 21 | supports 'scientific' 22 | supports 'ubuntu' 23 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/plugin.rb: -------------------------------------------------------------------------------- 1 | version = '2.4.1' 2 | 3 | # Make sure that Vagarant user is on the box for dokken 4 | include_recipe 'test::dokken' 5 | 6 | rbenv_user_install 'vagrant' 7 | 8 | rbenv_system_install 'system' 9 | 10 | rbenv_ruby version do 11 | install_ruby_build false 12 | user 'vagrant' 13 | end 14 | 15 | rbenv_global version do 16 | user 'vagrant' 17 | end 18 | 19 | rbenv_plugin 'ruby-build' do 20 | git_url 'https://github.com/rbenv/ruby-build.git' 21 | user 'vagrant' 22 | end 23 | 24 | # This should get installed to the system_install 25 | rbenv_plugin 'user-gems' do 26 | git_url 'git@github.com:mislav/rbenv-user-gems.git' 27 | git_ref 'v1.0.1' 28 | end 29 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_system_install.md: -------------------------------------------------------------------------------- 1 | # System_install 2 | 3 | Installs rbenv to the system location, by default `/usr/local/rbenv` 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | ------------- | --------------- | ------------------------------------ | ----------- | 9 | | git_url | `String` | `https://github.com/rbenv/rbenv.git` | | 10 | | git_ref | `String` | `master` | | 11 | | global_prefix | `String` | `/usr/local/rbenv` | | 12 | | update_rbenv | `true`, `false` | `true` | | 13 | 14 | ## Example 15 | 16 | ```ruby 17 | rbenv_system_install 'foo' do 18 | update_rbenv 'false' 19 | global_prefix '/home/vagrant/.rbenv' 20 | end 21 | ``` 22 | -------------------------------------------------------------------------------- /kitchen.global.yml: -------------------------------------------------------------------------------- 1 | --- 2 | provisioner: 3 | name: chef_infra 4 | product_name: chef 5 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 6 | channel: stable 7 | install_strategy: once 8 | chef_license: accept 9 | enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %> 10 | multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> 11 | deprecations_as_errors: true 12 | log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> 13 | 14 | verifier: 15 | name: inspec 16 | 17 | platforms: 18 | - name: almalinux-8 19 | - name: almalinux-9 20 | - name: amazonlinux-2023 21 | - name: centos-stream-9 22 | - name: debian-11 23 | - name: debian-12 24 | - name: fedora-latest 25 | - name: opensuse-leap-15 26 | - name: oraclelinux-8 27 | - name: oraclelinux-9 28 | - name: rockylinux-8 29 | - name: rockylinux-9 30 | - name: ubuntu-20.04 31 | - name: ubuntu-22.04 32 | - name: ubuntu-24.04 33 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_global.md: -------------------------------------------------------------------------------- 1 | # Global 2 | 3 | Sets the global ruby version. The name of the resource is the version to set. 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | ------------- | -------- | -------------------- | ---------------------------------- | 9 | | rbenv_version | `String` | | Version to set as the global Ruby. | 10 | | user | `String` | | Username to run the script as. | 11 | | root_path | `String` | See root_path helper | Path to install Ruby to. | 12 | 13 | ## Examples 14 | 15 | ```ruby 16 | rbenv_global '2.5.1' 17 | ``` 18 | 19 | ```ruby 20 | rbenv_global '2.5.2' do 21 | user 'vagrant' 22 | end 23 | ``` 24 | 25 | 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. 26 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_plugin.md: -------------------------------------------------------------------------------- 1 | # Plugin 2 | 3 | Installs a rbenv plugin. 4 | If user is passed in, the plugin is installed to the users install of rbenv. 5 | 6 | ## Properties 7 | 8 | | Name | Type | Default | Description | 9 | | --------- | -------- | -------------------- | ------------------------------------------------------------ | 10 | | git_url | `String` | | Git URL to download the plugin from. | 11 | | git_ref | `String` | `master` | Git reference to download, can be a SHA, tag or branch name. | 12 | | user | `String` | | Username to run the script as. | 13 | | root_path | `String` | See root_path helper | Path to install Ruby to. | 14 | 15 | ## Example 16 | 17 | ```ruby 18 | rbenv_plugin 'ruby-build' do 19 | user 'vagrant' 20 | end 21 | ``` 22 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | 5 | provisioner: 6 | product_name: chef 7 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 8 | install_strategy: once 9 | deprecations_as_errors: true 10 | 11 | verifier: 12 | name: inspec 13 | 14 | platforms: 15 | - name: centos-7 16 | - name: centos-8 17 | - name: fedora-latest 18 | - name: debian-10 19 | - name: debian-11 20 | - name: debian-12 21 | - name: ubuntu-18.04 22 | - name: ubuntu-20.04 23 | - name: ubuntu-22.04 24 | - name: opensuse-leap 25 | 26 | suites: 27 | - name: gem 28 | run_list: recipe[test::gem] 29 | - name: global 30 | run_list: recipe[test::global] 31 | - name: ruby_uninstall 32 | run_list: recipe[test::ruby_uninstall] 33 | - name: system_install 34 | run_list: recipe[test::system_install] 35 | - name: user_install 36 | run_list: recipe[test::user_install] 37 | - name: custom_group_install 38 | run_list: recipe[test::custom_group_install] 39 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Mark stale issues and pull requests 3 | 4 | "on": 5 | schedule: [cron: "0 0 * * *"] 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@v10 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | close-issue-message: > 15 | Closing due to inactivity. 16 | If this is still an issue please reopen or open another issue. 17 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 18 | Thanks, Sous-Chefs. 19 | days-before-close: 7 20 | days-before-stale: 365 21 | stale-issue-message: > 22 | Marking stale due to inactivity. 23 | Remove stale label or comment or this will be closed in 7 days. 24 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 25 | Thanks, Sous-Chefs. 26 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/gem.rb: -------------------------------------------------------------------------------- 1 | # Make sure that Vagarant user is on the box for dokken 2 | include_recipe 'test::dokken' 3 | 4 | # System Install 5 | rbenv_system_install 'system' 6 | # Install several Rubies to a system wide location 7 | rbenv_ruby '2.4.1' do 8 | verbose true 9 | end 10 | 11 | rbenv_ruby '2.7.1' do 12 | verbose true 13 | end 14 | 15 | # Set System global version 16 | rbenv_global '2.4.1' 17 | 18 | rbenv_gem 'mail' do 19 | version '2.6.5' 20 | rbenv_version '2.7.1' 21 | end 22 | 23 | rbenv_gem 'mail' do 24 | version '2.6.5' 25 | rbenv_version '2.4.1' 26 | end 27 | 28 | rbenv_gem 'mail' do 29 | version '2.6.5' 30 | rbenv_version '2.4.1' 31 | action :remove 32 | end 33 | 34 | # User Install 35 | rbenv_user_install 'vagrant' 36 | 37 | # Install a Ruby to a user directory 38 | rbenv_ruby '2.7.1' do 39 | user 'vagrant' 40 | end 41 | 42 | # Set the vagrant global version 43 | rbenv_global '2.7.1' do 44 | user 'vagrant' 45 | end 46 | 47 | rbenv_gem 'bundler' do 48 | version '1.15.4' 49 | user 'vagrant' 50 | rbenv_version '2.7.1' 51 | end 52 | -------------------------------------------------------------------------------- /resources/rehash.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: rehash 4 | # 5 | # Author:: Fletcher Nichol 6 | # Author:: Dan Webb 7 | # 8 | # Copyright:: 2011-2018, Fletcher Nichol 9 | # Copyright:: 2017-2021, Dan Webb 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # 23 | provides :rbenv_rehash 24 | unified_mode true 25 | use '_partial/_common' 26 | 27 | action :run do 28 | rbenv_script "rbenv rehash #{which_rbenv}" do 29 | code %(rbenv rehash) 30 | user new_resource.user if new_resource.user 31 | root_path new_resource.root_path 32 | action :run 33 | end 34 | end 35 | 36 | action_class do 37 | include Chef::Rbenv::Helpers 38 | end 39 | -------------------------------------------------------------------------------- /test/integration/user_install/controls/user_install.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | global_ruby = '2.4.1' 4 | 5 | control 'Rbenv should be installed' do 6 | title 'Rbenv should be installed to the users home directory' 7 | 8 | desc 'Rbenv should be installed' 9 | describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv global"') do 10 | its('exit_status') { should eq 0 } 11 | its('stdout') { should include(global_ruby) } 12 | end 13 | 14 | describe file('/home/vagrant/.rbenv/versions') do 15 | it { should exist } 16 | it { should be_writable.by_user('vagrant') } 17 | end 18 | end 19 | 20 | control 'ruby-build plugin should be installed' do 21 | title 'ruby-build should be installed to the users home directory' 22 | describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv install -L"') do 23 | its('exit_status') { should eq 0 } 24 | its('stdout') { should include('2.3.4') } 25 | its('stdout') { should include(global_ruby) } 26 | end 27 | end 28 | 29 | control 'Global Ruby' do 30 | title 'Rbenv should be installed globally' 31 | 32 | desc "Can set global Ruby version to #{global_ruby}" 33 | describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv versions --bare"') do 34 | its('exit_status') { should eq 0 } 35 | its('stdout') { should include(global_ruby) } 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_ruby.md: -------------------------------------------------------------------------------- 1 | # Ruby 2 | 3 | Installs a given Ruby version to the system or user location. 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | ------------------ | --------------- | ----------------------------------------- | --------------------------------------- | 9 | | version | `String` | | Ruby version to install. | 10 | | environment | `Hash` | | Environment to pass to the Ruby script. | 11 | | rbenv_action | `String` | `install` | Action to pass to rbenv. | 12 | | verbose | `true`, `false` | `false` | Build Ruby with verbose output. | 13 | | ruby_build_git_url | `String` | `https://github.com/rbenv/ruby-build.git` | Git URL for Ruby build. | 14 | | user | `String` | | Username to run the script as. | 15 | | root_path | `String` | See root_path helper | Path to install Ruby to. | 16 | 17 | ## Examples 18 | 19 | ```ruby 20 | rbenv_ruby '2.5.1' do 21 | user 'vagrant' 22 | end 23 | ``` 24 | 25 | ```ruby 26 | rbenv_ruby '2.5.1' 27 | ``` 28 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_user_install.md: -------------------------------------------------------------------------------- 1 | # User_install 2 | 3 | Installs rbenv to the user path, making rbenv available to that user only. 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | ------------ | --------------- | ------------------------------------ | ------------------------------------------------------------ | 9 | | git_url | `String` | `https://github.com/rbenv/rbenv.git` | Git URL to rbenv from. | 10 | | git_ref | `String` | `master` | Git reference to download, can be a SHA, tag or branch name. | 11 | | user | `String` | | User to install the Ruby to. | 12 | | group | `String` | user | Group to create the resources with. | 13 | | home_dir | `String` | `::File.expand_path("~#{user}")` | Directory to point user_prefix to. | 14 | | user_prefix | `String` | `::File.join(home_dir, '.rbenv')` | Location to install Ruby. | 15 | | update_rbenv | `true`, `false` | `true` | Update rbenv definitions. | 16 | 17 | ## Examples 18 | 19 | ```ruby 20 | rbenv_user_install 'vagrant' do 21 | user 'vagrant' 22 | end 23 | ``` 24 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: [main] 8 | 9 | jobs: 10 | lint-unit: 11 | uses: sous-chefs/.github/.github/workflows/lint-unit.yml@5.0.3 12 | permissions: 13 | actions: write 14 | checks: write 15 | pull-requests: write 16 | statuses: write 17 | issues: write 18 | 19 | integration: 20 | needs: lint-unit 21 | runs-on: ubuntu-latest 22 | strategy: 23 | matrix: 24 | os: 25 | - "almalinux-8" 26 | - "almalinux-9" 27 | - "amazonlinux-2023" 28 | - "centos-7" 29 | - "centos-stream-8" 30 | - "centos-stream-9" 31 | - "debian-10" 32 | - "debian-11" 33 | - "debian-12" 34 | - "fedora-latest" 35 | - "ubuntu-1804" 36 | - "ubuntu-2004" 37 | - "ubuntu-2204" 38 | suite: 39 | - "gem" 40 | - "global" 41 | - "ruby-uninstall" 42 | - "system-install" 43 | - "user-install" 44 | - "custom-group-install" 45 | fail-fast: false 46 | steps: 47 | - name: Check out code 48 | uses: actions/checkout@v5 49 | - name: Install Chef 50 | uses: actionshub/chef-install@3.0.1 51 | - name: Dokken 52 | uses: actionshub/test-kitchen@3.0.0 53 | env: 54 | CHEF_LICENSE: accept-no-persist 55 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 56 | with: 57 | suite: ${{ matrix.suite }} 58 | os: ${{ matrix.os }} 59 | -------------------------------------------------------------------------------- /test/integration/custom_group_install/controls/default.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | global_ruby = '2.4.1' 4 | 5 | control 'Rbenv should be installed' do 6 | title 'Rbenv should be installed to the users home directory' 7 | 8 | desc 'Rbenv should be installed' 9 | describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv global"') do 10 | its('exit_status') { should eq 0 } 11 | its('stdout') { should include(global_ruby) } 12 | end 13 | 14 | describe file('/home/vagrant/.rbenv/versions') do 15 | it { should exist } 16 | it { should be_writable.by_user('vagrant') } 17 | its('group') { should eq 'new-group' } 18 | end 19 | 20 | describe file('/home/vagrant/.rbenv') do 21 | it { should exist } 22 | it { should be_writable.by_user('vagrant') } 23 | its('group') { should eq 'new-group' } 24 | end 25 | end 26 | 27 | control 'ruby-build plugin should be installed' do 28 | title 'ruby-build should be installed to the users home directory' 29 | describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv install -L"') do 30 | its('exit_status') { should eq 0 } 31 | its('stdout') { should include('2.3.4') } 32 | its('stdout') { should include(global_ruby) } 33 | end 34 | end 35 | 36 | control 'Global Ruby' do 37 | title 'Rbenv should be installed globally' 38 | 39 | desc "Can set global Ruby version to #{global_ruby}" 40 | describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv versions --bare"') do 41 | its('exit_status') { should eq 0 } 42 | its('stdout') { should include(global_ruby) } 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /test/integration/gem/controls/gem_install.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | global_ruby = '2.4.1' 3 | 4 | control 'Global Gem Install' do 5 | title 'Should install Mail Gem globally' 6 | 7 | desc "Can set global Ruby version to #{global_ruby}" 8 | describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do 9 | its('exit_status') { should eq 0 } 10 | its('stdout') { should include(global_ruby) } 11 | end 12 | 13 | desc '2.7.1 Gem should have mail installed' 14 | describe bash('/usr/local/rbenv/versions/2.7.1/bin/gem list --local mail') do 15 | its('exit_status') { should eq 0 } 16 | its('stdout') { should include('2.6.5') } 17 | its('stdout') { should_not include('2.6.6') } 18 | end 19 | 20 | desc '2.4.1 Gem should not have any mail version installed' 21 | describe bash('/usr/local/rbenv/versions/2.4.1/bin/gem list --local') do 22 | its('exit_status') { should eq 0 } 23 | its('stdout') { should_not include('2.6.5') } 24 | its('stdout') { should_not include('2.6.6') } 25 | end 26 | 27 | desc 'gem home should be rbenv in an rbenv directory' 28 | describe bash('source /etc/profile.d/rbenv.sh && gem env home') do 29 | its('exit_status') { should eq 0 } 30 | its('stdout') { should include("/usr/local/rbenv/versions/#{global_ruby}/lib/ruby/gems/2.4.0") } 31 | end 32 | end 33 | 34 | control 'User Gem Install' do 35 | title 'Should install Bundler Gem to a user home' 36 | 37 | desc 'Gemspec file should have correct ownership' 38 | describe file('/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/specifications/bundler-1.15.4.gemspec') do 39 | it { should exist } 40 | it { should be_owned_by 'vagrant' } 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /resources/plugin.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: plugin 4 | # 5 | # Author:: Dan Webb 6 | # 7 | # Copyright:: 2017-2021, Dan Webb 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | provides :rbenv_plugin 22 | unified_mode true 23 | use '_partial/_common' 24 | 25 | property :git_url, 26 | String, 27 | required: true, 28 | description: 'Git URL to download the plugin from' 29 | 30 | property :git_ref, 31 | String, 32 | default: 'master', 33 | description: 'Git reference to download, can be a SHA, tag or branch name' 34 | 35 | # https://github.com/rbenv/rbenv/wiki/Plugins 36 | action :install do 37 | # If we pass in a username, we then to a plugin install to the users home_dir 38 | # See chef_rbenv_script_helpers.rb for root_path 39 | git "Install #{new_resource.name} plugin" do 40 | destination ::File.join(new_resource.root_path, 'plugins', new_resource.name) 41 | repository new_resource.git_url 42 | reference new_resource.git_ref 43 | user new_resource.user if new_resource.user 44 | action :sync 45 | end 46 | end 47 | 48 | action_class do 49 | include Chef::Rbenv::Helpers 50 | end 51 | -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | # Reference: http://danger.systems/reference.html 2 | 3 | # A pull request summary is required. Add a description of the pull request purpose. 4 | # Changelog must be updated for each pull request that changes code. 5 | # Warnings will be issued for: 6 | # Pull request with more than 400 lines of code changed 7 | # Pull reqest that change more than 5 lines without test changes 8 | # Failures will be issued for: 9 | # Pull request without summary 10 | # Pull requests with code changes without changelog entry 11 | 12 | def code_changes? 13 | code = %w(libraries attributes recipes resources files templates) 14 | code.each do |location| 15 | return true unless git.modified_files.grep(/#{location}/).empty? 16 | end 17 | false 18 | end 19 | 20 | def test_changes? 21 | tests = %w(spec test kitchen.yml kitchen.dokken.yml) 22 | tests.each do |location| 23 | return true unless git.modified_files.grep(/#{location}/).empty? 24 | end 25 | false 26 | end 27 | 28 | failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10 29 | 30 | warn 'This is a big Pull Request.' if git.lines_of_code > 400 31 | 32 | warn 'This is a Table Flip.' if git.lines_of_code > 2000 33 | 34 | # Require a CHANGELOG entry for non-test changes. 35 | if !git.modified_files.include?('CHANGELOG.md') && code_changes? 36 | failure 'Please include a CHANGELOG entry.' 37 | end 38 | 39 | # Require Major Minor Patch version labels 40 | unless github.pr_labels.grep /minor|major|patch/i 41 | warn 'Please add a release label to this pull request' 42 | end 43 | 44 | # A sanity check for tests. 45 | if git.lines_of_code > 5 && code_changes? && !test_changes? 46 | warn 'This Pull Request is probably missing tests.' 47 | end 48 | -------------------------------------------------------------------------------- /resources/global.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: global 4 | # 5 | # Author:: Fletcher Nichol 6 | # Author:: Dan Webb 7 | # 8 | # Copyright:: 2011-2018, Fletcher Nichol 9 | # Copyright:: 2017-2021, Dan Webb 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # 23 | provides :rbenv_global 24 | unified_mode true 25 | use '_partial/_common' 26 | 27 | property :rbenv_version, 28 | String, 29 | name_property: true, 30 | description: 'Version to set as the global Ruby.' 31 | 32 | # This sets the Global rbenv version 33 | # e.g. "rbenv global" should return the version we set 34 | 35 | action :create do 36 | rbenv_script "globals #{which_rbenv}" do 37 | code "rbenv global #{new_resource.rbenv_version}" 38 | user new_resource.user if new_resource.user 39 | root_path new_resource.root_path 40 | action :run 41 | not_if { current_global_version_correct? } 42 | end 43 | end 44 | 45 | action_class do 46 | include Chef::Rbenv::Helpers 47 | 48 | def current_global_version_correct? 49 | current_global_version == new_resource.rbenv_version 50 | end 51 | 52 | def current_global_version 53 | version_file = ::File.join(new_resource.root_path, 'version') 54 | 55 | ::File.exist?(version_file) && ::IO.read(version_file).chomp 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # to a Chef Infra Server or Supermarket. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | ehthumbs.db 9 | Icon? 10 | nohup.out 11 | Thumbs.db 12 | .envrc 13 | 14 | # EDITORS # 15 | ########### 16 | .#* 17 | .project 18 | .settings 19 | *_flymake 20 | *_flymake.* 21 | *.bak 22 | *.sw[a-z] 23 | *.tmproj 24 | *~ 25 | \#* 26 | REVISION 27 | TAGS* 28 | tmtags 29 | .vscode 30 | .editorconfig 31 | 32 | ## COMPILED ## 33 | ############## 34 | *.class 35 | *.com 36 | *.dll 37 | *.exe 38 | *.o 39 | *.pyc 40 | *.so 41 | */rdoc/ 42 | a.out 43 | mkmf.log 44 | 45 | # Testing # 46 | ########### 47 | .circleci/* 48 | .codeclimate.yml 49 | .delivery/* 50 | .foodcritic 51 | .kitchen* 52 | .mdlrc 53 | .overcommit.yml 54 | .rspec 55 | .rubocop.yml 56 | .travis.yml 57 | .watchr 58 | .yamllint 59 | azure-pipelines.yml 60 | Dangerfile 61 | examples/* 62 | features/* 63 | Guardfile 64 | kitchen*.yml 65 | mlc_config.json 66 | Procfile 67 | Rakefile 68 | spec/* 69 | test/* 70 | 71 | # SCM # 72 | ####### 73 | .git 74 | .gitattributes 75 | .gitconfig 76 | .github/* 77 | .gitignore 78 | .gitkeep 79 | .gitmodules 80 | .svn 81 | */.bzr/* 82 | */.git 83 | */.hg/* 84 | */.svn/* 85 | 86 | # Berkshelf # 87 | ############# 88 | Berksfile 89 | Berksfile.lock 90 | cookbooks/* 91 | tmp 92 | 93 | # Bundler # 94 | ########### 95 | vendor/* 96 | Gemfile 97 | Gemfile.lock 98 | 99 | # Policyfile # 100 | ############## 101 | Policyfile.rb 102 | Policyfile.lock.json 103 | 104 | # Documentation # 105 | ############# 106 | CODE_OF_CONDUCT* 107 | CONTRIBUTING* 108 | documentation/* 109 | TESTING* 110 | UPGRADING* 111 | 112 | # Vagrant # 113 | ########### 114 | .vagrant 115 | Vagrantfile 116 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_gem.md: -------------------------------------------------------------------------------- 1 | # Gem 2 | 3 | Used to install a gem into the selected rbenv environment. 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | ---------------------- | ----------------- | -------------------- | ----------------------------------------------------------------------- | 9 | | clear_sources | `true', 'false` | `true, false` | | 10 | | include_default_source | `true', 'false` | `true` | Set to false to not include Chef::Config[:rubygems_url] in the sources. | 11 | | ignore_failure | `true', 'false` | `false` | Continue running a recipe if a resource fails for any reason. | 12 | | options | `String`, `Hash` | | Options to pass to the gem command. | 13 | | package_name | `String`, `Array` | | The Gem package name to install. | 14 | | source | `String`, `Array` | | Source URL/location for gem. | 15 | | timeout | `Integer` | `300` | Timeout in seconds to wait for Gem installation. | 16 | | version | `String` | | Gem version to install. | 17 | | response_file | `String` | | Response file to reconfigure a gem. | 18 | | rbenv_version | `String` | | Which rbenv version to install the Gem to. | 19 | | user | `String` | | Which user to install gem to. | 20 | | root_path | `String` | See root_path helper | Path to install Ruby to. | 21 | 22 | ## Example 23 | 24 | ```ruby 25 | rbenv_gem 'gem_name' do 26 | user 'vagrant' 27 | end 28 | ``` 29 | -------------------------------------------------------------------------------- /kitchen.dokken.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: dokken 3 | privileged: true 4 | chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> 5 | 6 | transport: { name: dokken } 7 | provisioner: { name: dokken } 8 | 9 | platforms: 10 | - name: almalinux-8 11 | driver: 12 | image: dokken/almalinux-8 13 | pid_one_command: /usr/lib/systemd/systemd 14 | 15 | - name: almalinux-9 16 | driver: 17 | image: dokken/almalinux-9 18 | pid_one_command: /usr/lib/systemd/systemd 19 | 20 | - name: almalinux-10 21 | driver: 22 | image: dokken/almalinux-10 23 | pid_one_command: /usr/lib/systemd/systemd 24 | 25 | - name: amazonlinux-2023 26 | driver: 27 | image: dokken/amazonlinux-2023 28 | pid_one_command: /usr/lib/systemd/systemd 29 | 30 | - name: centos-stream-9 31 | driver: 32 | image: dokken/centos-stream-9 33 | pid_one_command: /usr/lib/systemd/systemd 34 | 35 | - name: centos-stream-10 36 | driver: 37 | image: dokken/centos-stream-10 38 | pid_one_command: /usr/lib/systemd/systemd 39 | 40 | - name: debian-12 41 | driver: 42 | image: dokken/debian-12 43 | pid_one_command: /bin/systemd 44 | 45 | - name: debian-13 46 | driver: 47 | image: dokken/debian-13 48 | pid_one_command: /usr/lib/systemd/systemd 49 | 50 | - name: fedora-latest 51 | driver: 52 | image: dokken/fedora-latest 53 | pid_one_command: /usr/lib/systemd/systemd 54 | 55 | - name: opensuse-leap-15 56 | driver: 57 | image: dokken/opensuse-leap-15 58 | pid_one_command: /usr/lib/systemd/systemd 59 | 60 | - name: oraclelinux-8 61 | driver: 62 | image: dokken/oraclelinux-8 63 | pid_one_command: /usr/lib/systemd/systemd 64 | 65 | - name: oraclelinux-9 66 | driver: 67 | image: dokken/oraclelinux-9 68 | pid_one_command: /usr/lib/systemd/systemd 69 | 70 | - name: rockylinux-8 71 | driver: 72 | image: dokken/rockylinux-8 73 | pid_one_command: /usr/lib/systemd/systemd 74 | 75 | - name: rockylinux-9 76 | driver: 77 | image: dokken/rockylinux-9 78 | pid_one_command: /usr/lib/systemd/systemd 79 | 80 | - name: rockylinux-10 81 | driver: 82 | image: dokken/rockylinux-10 83 | pid_one_command: /usr/lib/systemd/systemd 84 | 85 | - name: ubuntu-20.04 86 | driver: 87 | image: dokken/ubuntu-20.04 88 | pid_one_command: /bin/systemd 89 | 90 | - name: ubuntu-22.04 91 | driver: 92 | image: dokken/ubuntu-22.04 93 | pid_one_command: /bin/systemd 94 | 95 | - name: ubuntu-24.04 96 | driver: 97 | image: dokken/ubuntu-24.04 98 | pid_one_command: /bin/systemd 99 | -------------------------------------------------------------------------------- /libraries/package_deps.rb: -------------------------------------------------------------------------------- 1 | class Chef 2 | module Rbenv 3 | module PackageDeps 4 | def install_ruby_dependencies 5 | case ::File.basename(new_resource.version) 6 | when /^jruby-/ 7 | package jruby_package_deps 8 | else 9 | package_deps.each do |deps| 10 | package deps 11 | end 12 | end 13 | 14 | ensure_java_environment if new_resource.version =~ /^jruby-/ 15 | end 16 | 17 | def ensure_java_environment 18 | resource_collection.find( 19 | 'ruby_block[update-java-alternatives]' 20 | ).run_action(:create) 21 | rescue Chef::Exceptions::ResourceNotFound 22 | # have pity on my soul 23 | Chef::Log.info 'The java cookbook does not appear to in the run_list.' 24 | end 25 | 26 | def jruby_package_deps 27 | case node['platform_family'] 28 | when 'rhel', 'fedora', 'amazon' 29 | %w(make gcc-c++) 30 | when 'debian' 31 | %w(make g++) 32 | when 'freebsd' 33 | %w(alsa-lib bash dejavu expat fixesproto fontconfig freetype2 gettext-runtime giflib indexinfo inputproto java-zoneinfo javavmwrapper kbproto libICE libSM libX11 libXau libXdmcp libXext libXfixes libXi libXrender libXt libXtst libfontenc libpthread-stubs libxcb libxml2 mkfontdir mkfontscale openjdk8 recordproto renderproto xextproto xproto) 34 | end 35 | end 36 | 37 | def package_deps 38 | case node['platform_family'] 39 | when 'mac_os_x' 40 | %w(openssl makedepend pkg-config libffi) 41 | when 'rhel', 'fedora', 'amazon' 42 | %w(gcc bzip2 openssl-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel make) 43 | when 'debian' 44 | if platform?('ubuntu') && node['platform_version'].to_i >= 20 45 | %w(gcc autoconf bison build-essential libssl-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev make) 46 | elsif platform?('ubuntu') && node['platform_version'].to_i >= 18 47 | %w(gcc autoconf bison build-essential libssl-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev make) 48 | elsif platform?('debian') && node['platform_version'].to_i >= 10 49 | %w(gcc autoconf bison build-essential libssl-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev make) 50 | else 51 | %w(gcc autoconf bison build-essential libssl-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev make) 52 | end 53 | when 'suse' 54 | %w(gcc make automake gdbm-devel ncurses-devel readline-devel zlib-devel libopenssl-devel bzip2) 55 | end 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /resources/system_install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: system_install 4 | # 5 | # Author:: Dan Webb 6 | # 7 | # Copyright:: 2017-2021, Dan Webb 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | 22 | # Install rbenv to a system wide location 23 | provides :rbenv_system_install 24 | unified_mode true 25 | use '_partial/git' 26 | 27 | property :global_prefix, 28 | String, 29 | default: '/usr/local/rbenv', 30 | description: 'Location for the global Ruby.' 31 | 32 | property :update_rbenv, 33 | [true, false], 34 | default: true, 35 | description: 'Update rbenv definitions.' 36 | 37 | action :install do 38 | node.run_state['sous-chefs'] ||= {} 39 | node.run_state['sous-chefs']['ruby_rbenv'] ||= {} 40 | node.run_state['sous-chefs']['ruby_rbenv']['root_path'] ||= {} 41 | 42 | node.run_state['sous-chefs']['ruby_rbenv']['root_path']['system'] = new_resource.global_prefix 43 | 44 | package package_prerequisites 45 | 46 | directory '/etc/profile.d' do 47 | owner 'root' 48 | mode '0755' 49 | end 50 | 51 | template '/etc/profile.d/rbenv.sh' do 52 | cookbook 'ruby_rbenv' 53 | source 'rbenv.sh.erb' 54 | owner 'root' 55 | mode '0755' 56 | variables(global_prefix: new_resource.global_prefix) 57 | end 58 | 59 | git new_resource.global_prefix do 60 | repository new_resource.git_url 61 | reference new_resource.git_ref 62 | action :checkout if new_resource.update_rbenv == false 63 | notifies :run, 'ruby_block[Add rbenv to PATH]', :immediately 64 | notifies :run, 'bash[Initialize system rbenv]', :immediately 65 | end 66 | 67 | directory "#{new_resource.global_prefix}/plugins" do 68 | owner 'root' 69 | mode '0755' 70 | end 71 | 72 | # Initialize rbenv 73 | ruby_block 'Add rbenv to PATH' do 74 | block do 75 | ENV['PATH'] = "#{new_resource.global_prefix}/shims:#{new_resource.global_prefix}/bin:#{ENV['PATH']}" 76 | end 77 | action :nothing 78 | end 79 | 80 | bash 'Initialize system rbenv' do 81 | code %(PATH="#{new_resource.global_prefix}/bin:$PATH" rbenv init -) 82 | environment('RBENV_ROOT' => new_resource.global_prefix) 83 | action :nothing 84 | end 85 | end 86 | 87 | action_class do 88 | include Chef::Rbenv::Helpers 89 | end 90 | -------------------------------------------------------------------------------- /documentation/resources/rbenv_script.md: -------------------------------------------------------------------------------- 1 | # Script 2 | 3 | Runs a rbenv aware script. 4 | 5 | ## Properties 6 | 7 | | Name | Type | Default | Description | 8 | | ------------- | ------------------- | -------------------- | ---------------------------------------------------------------------------- | 9 | | rbenv_version | `String` | | Ruby version to run the script on. | 10 | | code | `String` | | Script code to run. | 11 | | creates | `String` | | Prevent the script from creating a file when that file already exists. | 12 | | cwd | `String` | | The current working directory from which the command will be run. | 13 | | environment | `Hash` | | A Hash of environment variables in the form of ({"ENV_VARIABLE" => "VALUE"}) | 14 | | group | `String` | | The group ID to run the command as. | 15 | | path | `Array` | | Path to add to environment. | 16 | | returns | `Array` | `[0]` | The return value for a command. This may be an array of accepted values. | 17 | | timeout | `Integer` | | The amount of time (in seconds) to wait for the script to complete. | 18 | | umask | `String`, `Integer` | | The file mode creation mask, or umask. | 19 | | live_stream | `true`, `false` | `false` | Live stream the output from the script to the console. | 20 | | user | `String` | | Username to run the script as. | 21 | | root_path | `String` | See root_path helper | Path to install Ruby to. | 22 | 23 | ## Examples 24 | 25 | ```ruby 26 | rbenv_script 'foo' do 27 | rbenv_version '2.5.1' 28 | user 'vagrant' 29 | returns ['1','255'] 30 | code "echo 'FOO'" 31 | end 32 | ``` 33 | 34 | Note that environment overwrites the entire variable. 35 | For example, setting the `$PATH` variable can be done like this: 36 | 37 | ```ruby 38 | rbenv_script 'bundle package' do 39 | cwd node["bundle_dir"] 40 | environment ({"PATH" => "/usr/local/rbenv/shims:/usr/local/rbenv/bin:#{ENV["PATH"]}"}) 41 | code "bundle package" 42 | end 43 | ``` 44 | 45 | Where `#{ENV["PATH"]}` appends the existing PATH to the end of the newly set PATH. 46 | -------------------------------------------------------------------------------- /resources/script.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: script 4 | # 5 | # Author:: Fletcher Nichol 6 | # Author:: Dan Webb 7 | # 8 | # Copyright:: 2011-2018, Fletcher Nichol 9 | # Copyright:: 2017-2021, Dan Webb 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # 23 | provides :rbenv_script 24 | unified_mode true 25 | use '_partial/_common' 26 | 27 | property :rbenv_version, 28 | String, 29 | description: 'Ruby version to run the script on.' 30 | 31 | property :code, 32 | String, 33 | description: 'Script code to run.' 34 | 35 | property :creates, 36 | String, 37 | description: 'Prevent the script from creating a file when that file already exists.' 38 | 39 | property :cwd, 40 | String, 41 | description: 'The current working directory from which the command will be run.' 42 | 43 | property :environment, 44 | Hash, 45 | description: 'A Hash of environment variables in the form of ({"ENV_VARIABLE" => "VALUE"}).' 46 | 47 | property :group, 48 | String, 49 | description: 'The group ID to run the command as.' 50 | 51 | property :path, 52 | Array, 53 | description: 'Path to add to environment.' 54 | 55 | property :returns, 56 | Array, default: [0], 57 | description: 'The return value for a command. This may be an array of accepted values.' 58 | 59 | property :timeout, 60 | Integer, 61 | description: 'The amount of time (in seconds) to wait for the script to complete.' 62 | 63 | property :umask, 64 | [String, Integer], 65 | description: 'The file mode creation mask, or umask.' 66 | 67 | property :live_stream, 68 | [true, false], 69 | default: false, 70 | description: 'Live stream the output from the script to the console.' 71 | 72 | action :run do 73 | bash new_resource.name do 74 | code script_code 75 | user new_resource.user if new_resource.user 76 | creates new_resource.creates if new_resource.creates 77 | cwd new_resource.cwd if new_resource.cwd 78 | group new_resource.group if new_resource.group 79 | returns new_resource.returns if new_resource.returns 80 | timeout new_resource.timeout if new_resource.timeout 81 | umask new_resource.umask if new_resource.umask 82 | environment(script_environment) 83 | live_stream new_resource.live_stream 84 | end 85 | end 86 | 87 | action_class do 88 | include Chef::Rbenv::Helpers 89 | end 90 | -------------------------------------------------------------------------------- /resources/user_install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: user_install 4 | # 5 | # Author:: Dan Webb 6 | # 7 | # Copyright:: 2017-2021, Dan Webb 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | 22 | # Install rbenv to a user location 23 | provides :rbenv_user_install 24 | unified_mode true 25 | use '_partial/_git' 26 | 27 | property :user, 28 | String, 29 | name_property: true, 30 | description: 'User to install the Ruby to.' 31 | 32 | property :group, 33 | String, 34 | default: lazy { user }, 35 | description: 'Group to create the resources with.' 36 | 37 | property :home_dir, 38 | String, 39 | default: lazy { ::File.expand_path("~#{user}") }, 40 | description: 'Directory to point user_prefix to.' 41 | 42 | property :user_prefix, 43 | String, 44 | default: lazy { ::File.join(home_dir, '.rbenv') }, 45 | description: 'Location to install Ruby.' 46 | 47 | property :update_rbenv, 48 | [true, 49 | false], default: true, 50 | description: 'Update rbenv definitions.' 51 | 52 | action :install do 53 | package package_prerequisites 54 | 55 | node.run_state['sous-chefs'] ||= {} 56 | node.run_state['sous-chefs']['ruby_rbenv'] ||= {} 57 | node.run_state['sous-chefs']['ruby_rbenv']['root_path'] ||= {} 58 | node.run_state['sous-chefs']['ruby_rbenv']['root_path'][new_resource.user] ||= new_resource.user_prefix 59 | 60 | system_prefix = node.run_state['sous-chefs']['ruby_rbenv']['root_path']['system'] 61 | 62 | template '/etc/profile.d/rbenv.sh' do 63 | cookbook 'ruby_rbenv' 64 | source 'rbenv.sh.erb' 65 | variables(global_prefix: system_prefix) if system_prefix 66 | owner 'root' 67 | mode '0755' 68 | end 69 | 70 | git new_resource.user_prefix do 71 | repository new_resource.git_url 72 | reference new_resource.git_ref 73 | action :checkout if new_resource.update_rbenv == false 74 | user new_resource.user 75 | group new_resource.group 76 | notifies :run, 'ruby_block[Add rbenv to PATH]', :immediately 77 | end 78 | 79 | %w(plugins shims versions).each do |d| 80 | directory "#{new_resource.user_prefix}/#{d}" do 81 | owner new_resource.user 82 | group new_resource.group 83 | mode '0755' 84 | end 85 | end 86 | 87 | # Initialize rbenv 88 | ruby_block 'Add rbenv to PATH' do 89 | block do 90 | ENV['PATH'] = "#{new_resource.user_prefix}/shims:#{new_resource.user_prefix}/bin:#{ENV['PATH']}" 91 | end 92 | action :nothing 93 | end 94 | 95 | bash "Initialize user #{new_resource.user} rbenv" do 96 | code %(PATH="#{new_resource.user_prefix}/bin:$PATH" rbenv init -) 97 | environment('RBENV_ROOT' => new_resource.user_prefix) 98 | action :nothing 99 | subscribes :run, "git[#{new_resource.user_prefix}]", :immediately 100 | # Subscribe because it's easier to find the resource ;) 101 | end 102 | end 103 | 104 | action_class do 105 | include Chef::Rbenv::Helpers 106 | end 107 | -------------------------------------------------------------------------------- /resources/ruby.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: ruby 4 | # 5 | # Author:: Fletcher Nichol 6 | # Author:: Dan Webb 7 | # 8 | # Copyright:: 2011-2018, Fletcher Nichol 9 | # Copyright:: 2017-2021, Dan Webb 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # 23 | provides :rbenv_ruby 24 | unified_mode true 25 | use '_partial/_common' 26 | 27 | property :version, 28 | String, 29 | name_property: true, 30 | description: 'Ruby version to install.' 31 | 32 | property :environment, 33 | Hash, 34 | description: 'Environment to pass to the Ruby script.' 35 | 36 | property :rbenv_action, 37 | String, 38 | default: 'install', 39 | description: 'Action to pass to rbenv.' 40 | 41 | property :verbose, 42 | [true, false], 43 | default: false, 44 | description: 'Build Ruby with verbose output.' 45 | 46 | property :ruby_build_git_url, 47 | String, 48 | default: 'https://github.com/rbenv/ruby-build.git', 49 | description: 'Git URL for Ruby build.' 50 | 51 | action :install do 52 | Chef::Log.fatal('Rubinius not supported by this cookbook') if new_resource.version =~ /rbx/ 53 | 54 | install_start = Time.now 55 | 56 | Chef::Log.info("Building Ruby #{new_resource.version}, this could take a while...") 57 | 58 | rbenv_plugin 'ruby-build' do 59 | git_url new_resource.ruby_build_git_url 60 | user new_resource.user if new_resource.user 61 | root_path new_resource.root_path 62 | end 63 | 64 | install_ruby_dependencies 65 | 66 | # TODO: ? 67 | # patch_command = "--patch < <(curl -sSL #{new_resource.patch_url})" if new_resource.patch_url 68 | # patch_command = "--patch < #{new_resource.patch_file}" if new_resource.patch_file 69 | command = %(rbenv #{new_resource.rbenv_action}) 70 | # From `rbenv help uninstall`: 71 | # -f Attempt to remove the specified version without prompting 72 | # for confirmation. If the version does not exist, do not 73 | # display an error message. 74 | command << ' -f' if new_resource.rbenv_action == 'uninstall' 75 | command << " #{new_resource.version}" 76 | command << ' --verbose' if new_resource.verbose 77 | 78 | rbenv_script "#{command} #{which_rbenv}" do 79 | code command 80 | user new_resource.user if new_resource.user 81 | root_path new_resource.root_path 82 | environment new_resource.environment if new_resource.environment 83 | action :run 84 | live_stream true if new_resource.verbose 85 | not_if { ruby_installed? && new_resource.rbenv_action != 'uninstall' } 86 | end 87 | 88 | log_message = new_resource.to_s 89 | log_message << if new_resource.rbenv_action == 'uninstall' 90 | ' uninstalled' 91 | else 92 | " build time was #{(Time.now - install_start) / 60.0} minutes" 93 | end 94 | Chef::Log.info(log_message) 95 | 96 | # TODO: If there is no more Ruby installed on the system, the `version` file 97 | # of rbenv still contains a version number which results in a warning. See 98 | # this issue and comment for more details: 99 | # https://github.com/rbenv/rbenv/pull/848#issuecomment-413857386 100 | end 101 | 102 | action_class do 103 | include Chef::Rbenv::Helpers 104 | include Chef::Rbenv::PackageDeps 105 | end 106 | -------------------------------------------------------------------------------- /libraries/helpers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Library:: Chef::Rbenv::ShellHelpers 4 | # 5 | # Author:: Fletcher Nichol 6 | # 7 | # Copyright:: 2011-2017, Fletcher Nichol 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | 22 | class Chef 23 | module Rbenv 24 | module Helpers 25 | def self.root_path(node, resource_user = nil) 26 | node.run_state['sous-chefs'] ||= {} 27 | node.run_state['sous-chefs']['ruby_rbenv'] ||= {} 28 | node.run_state['sous-chefs']['ruby_rbenv']['root_path'] ||= {} 29 | 30 | if resource_user 31 | node.run_state['sous-chefs']['ruby_rbenv']['root_path'][resource_user] 32 | else 33 | node.run_state['sous-chefs']['ruby_rbenv']['root_path']['system'] 34 | end 35 | end 36 | 37 | def wrap_shim_cmd(cmd) 38 | [%(export RBENV_ROOT="#{rbenv_root}"), 39 | %(export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"), 40 | %(export RBENV_VERSION="#{new_resource.rbenv_version}"), 41 | %($RBENV_ROOT/shims/#{cmd}), 42 | ].join(' && ') 43 | end 44 | 45 | def root_path 46 | Chef::Rbenv::Helpers.root_path(node, new_resource.user) 47 | end 48 | 49 | def which_rbenv 50 | "(#{new_resource.user || 'system'})" 51 | end 52 | 53 | def binary 54 | prefix = new_resource.user ? "sudo -u #{new_resource.user} " : '' 55 | "#{prefix}#{new_resource.root_path}/versions/#{new_resource.rbenv_version}/bin/gem" 56 | end 57 | 58 | def script_code 59 | script = [] 60 | script << %(export RBENV_ROOT="#{new_resource.root_path}") 61 | script << %(export PATH="${RBENV_ROOT}/bin:$PATH") 62 | script << %{eval "$(rbenv init -)"} 63 | if new_resource.rbenv_version 64 | script << %(export RBENV_VERSION="#{new_resource.rbenv_version}") 65 | end 66 | script << new_resource.code 67 | script.join("\n").concat("\n") 68 | end 69 | 70 | def script_environment 71 | script_env = { 'RBENV_ROOT' => new_resource.root_path } 72 | 73 | script_env.merge!(new_resource.environment) if new_resource.environment 74 | 75 | if new_resource.path 76 | script_env['PATH'] = "#{new_resource.path.join(':')}:#{ENV['PATH']}" 77 | end 78 | 79 | if new_resource.user 80 | script_env['USER'] = new_resource.user 81 | script_env['HOME'] = ::File.expand_path("~#{new_resource.user}") 82 | end 83 | 84 | script_env 85 | end 86 | 87 | def package_prerequisites 88 | case node['platform_family'] 89 | when 'rhel', 'fedora', 'amazon' 90 | %w(git grep tar) 91 | when 'debian', 'suse', 'arch' 92 | %w(git grep) 93 | when 'freebsd' 94 | %w(git bash) 95 | else 96 | %w(git) 97 | end 98 | end 99 | 100 | def ruby_installed? 101 | if Array(new_resource.action).include?(:reinstall) 102 | return false 103 | elsif ::File.directory?(::File.join(new_resource.root_path, 'versions', new_resource.version)) 104 | return true 105 | end 106 | 107 | false 108 | end 109 | 110 | def verbose 111 | '-v' if new_resource.verbose 112 | end 113 | end 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Chef ruby_rbenv Cookbook 2 | 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/ruby_rbenv.svg)](https://supermarket.chef.io/cookbooks/ruby_rbenv) 4 | [![CI State](https://github.com/sous-chefs/ruby_rbenv/workflows/ci/badge.svg)](https://github.com/sous-chefs/ruby_rbenv/actions?query=workflow%3Aci) 5 | [![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) 6 | [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) 7 | 8 | ## Description 9 | 10 | Manages [rbenv][rbenv_site] and its installed Rubies. 11 | 12 | ## Maintainers 13 | 14 | This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). 15 | 16 | ## Requirements 17 | 18 | ### Chef 19 | 20 | This cookbook requires Chef 13.0+. 21 | 22 | **NOTE:** Some Chef versions (>= 16 and < 16.4.41) have a bug in the git resource causing some failures (see [#289](https://github.com/sous-chefs/ruby_rbenv/issues/289)). If you experience any troubles please try a more recent version of Chef 16. 23 | 24 | ### Platform 25 | 26 | - Debian derivatives 27 | - Fedora 28 | - macOS (not currently tested) 29 | - RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux) 30 | - openSUSE and openSUSE leap 31 | 32 | ## Resources 33 | 34 | - [rbenv_gem](documentation/resources/rbenv_gem.md) 35 | - [rbenv_global](documentation/resources/rbenv_global.md) 36 | - [rbenv_plugin](documentation/resources/rbenv_plugin.md) 37 | - [rbenv_rehash](documentation/resources/rbenv_rehash.md) 38 | - [rbenv_ruby](documentation/resources/rbenv_ruby.md) 39 | - [rbenv_script](documentation/resources/rbenv_script.md) 40 | - [rbenv_system_install](documentation/resources/rbenv_system_install.md) 41 | - [rbenv_user_install](documentation/resources/rbenv_user_install.md) 42 | 43 | ## Usage 44 | 45 | Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. 46 | 47 | 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. 48 | 49 | System wide installations of rbenv are supported by this cookbook, but discouraged by the rbenv maintainer, see [these][rbenv_issue_38] [two][rbenv_issue_306] issues in the rbenv repository. 50 | 51 | ## System-Wide macOS Installation Note 52 | 53 | This cookbook takes advantage of managing profile fragments in an `/etc/profile.d` directory, common on most Unix-flavored platforms. Unfortunately, macOS does not support this idiom out of the box, so you may need to [modify][mac_profile_d] your user profile. 54 | 55 | ## Development 56 | 57 | - Source hosted at [GitHub][repo] 58 | - Report issues/Questions/Feature requests on [GitHub Issues][issues] 59 | 60 | Pull requests are very welcome! Make sure your patches are well tested. 61 | 62 | ## Contributors 63 | 64 | This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) 65 | 66 | ### Backers 67 | 68 | Thank you to all our backers! 69 | 70 | ```text 71 | http://www.apache.org/licenses/LICENSE-2.0 72 | ``` 73 | 74 | ![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) 75 | ![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) 76 | ![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) 77 | ![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) 78 | ![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) 79 | ![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) 80 | ![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) 81 | ![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) 82 | ![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) 83 | ![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) 84 | -------------------------------------------------------------------------------- /.github/copilot-instructions.md: -------------------------------------------------------------------------------- 1 | # Copilot Instructions for Sous Chefs Cookbooks 2 | 3 | ## Repository Overview 4 | 5 | **Chef cookbook** for managing software installation and configuration. Part of the Sous Chefs cookbook ecosystem. 6 | 7 | **Key Facts:** Ruby-based, Chef >= 16 required, supports various OS platforms (check metadata.rb, kitchen.yml and .github/workflows/ci.yml for which platforms to specifically test) 8 | 9 | ## Project Structure 10 | 11 | **Critical Paths:** 12 | - `recipes/` - Chef recipes for cookbook functionality (if this is a recipe-driven cookbook) 13 | - `resources/` - Custom Chef resources with properties and actions (if this is a resource-driven cookbook) 14 | - `spec/` - ChefSpec unit tests 15 | - `test/integration/` - InSpec integration tests (tests all platforms supported) 16 | - `test/cookbooks/` or `test/fixtures/` - Example cookbooks used during testing that show good examples of custom resource usage 17 | - `attributes/` - Configuration for recipe driven cookbooks (not applicable to resource cookbooks) 18 | - `libraries/` - Library helpers to assist with the cookbook. May contain multiple files depending on complexity of the cookbook. 19 | - `templates/` - ERB templates that may be used in the cookbook 20 | - `files/` - files that may be used in the cookbook 21 | - `metadata.rb`, `Berksfile` - Cookbook metadata and dependencies 22 | 23 | ## Build and Test System 24 | 25 | ### Environment Setup 26 | **MANDATORY:** Install Chef Workstation first - provides chef, berks, cookstyle, kitchen tools. 27 | 28 | ### Essential Commands (strict order) 29 | ```bash 30 | berks install # Install dependencies (always first) 31 | cookstyle # Ruby/Chef linting 32 | yamllint . # YAML linting 33 | markdownlint-cli2 '**/*.md' # Markdown linting 34 | chef exec rspec # Unit tests (ChefSpec) 35 | # Integration tests will be done via the ci.yml action. Do not run these. Only check the action logs for issues after CI is done running. 36 | ``` 37 | 38 | ### Critical Testing Details 39 | - **Kitchen Matrix:** Multiple OS platforms × software versions (check kitchen.yml for specific combinations) 40 | - **Docker Required:** Integration tests use Dokken driver 41 | - **CI Environment:** Set `CHEF_LICENSE=accept-no-persist` 42 | - **Full CI Runtime:** 30+ minutes for complete matrix 43 | 44 | ### Common Issues and Solutions 45 | - **Always run `berks install` first** - most failures are dependency-related 46 | - **Docker must be running** for kitchen tests 47 | - **Chef Workstation required** - no workarounds, no alternatives 48 | - **Test data bags needed** (optional for some cookbooks) in `test/integration/data_bags/` for convergence 49 | 50 | ## Development Workflow 51 | 52 | ### Making Changes 53 | 1. Edit recipes/resources/attributes/templates/libraries 54 | 2. Update corresponding ChefSpec tests in `spec/` 55 | 3. Also update any InSpec tests under test/integration 56 | 4. Ensure cookstyle and rspec passes at least. You may run `cookstyle -a` to automatically fix issues if needed. 57 | 5. Also always update all documentation found in README.md and any files under documentation/* 58 | 6. **Always update CHANGELOG.md** (required by Dangerfile) - Make sure this conforms with the Sous Chefs changelog standards. 59 | 60 | ### Pull Request Requirements 61 | - **PR description >10 chars** (Danger enforced) 62 | - **CHANGELOG.md entry** for all code changes 63 | - **Version labels** (major/minor/patch) required 64 | - **All linters must pass** (cookstyle, yamllint, markdownlint) 65 | - **Test updates** needed for code changes >5 lines and parameter changes that affect the code logic 66 | 67 | ## Chef Cookbook Patterns 68 | 69 | ### Resource Development 70 | - Custom resources in `resources/` with properties and actions 71 | - Include comprehensive ChefSpec tests for all actions 72 | - Follow Chef resource DSL patterns 73 | 74 | ### Recipe Conventions 75 | - Use `include_recipe` for modularity 76 | - Handle platforms with `platform_family?` conditionals 77 | - Use encrypted data bags for secrets (passwords, SSL certs) 78 | - Leverage attributes for configuration with defaults 79 | 80 | ### Testing Approach 81 | - **ChefSpec (Unit):** Mock dependencies, test recipe logic in `spec/` 82 | - **InSpec (Integration):** Verify actual system state in `test/integration/inspec/` - InSpec files should contain proper inspec.yml and controls directories so that it could be used by other suites more easily. 83 | - One test file per recipe, use standard Chef testing patterns 84 | 85 | ## Trust These Instructions 86 | 87 | These instructions are validated for Sous Chefs cookbooks. **Do not search for build instructions** unless information here fails. 88 | 89 | **Error Resolution Checklist:** 90 | 1. Verify Chef Workstation installation 91 | 2. Confirm `berks install` completed successfully 92 | 3. Ensure Docker is running for integration tests 93 | 4. Check for missing test data dependencies 94 | 95 | The CI system uses these exact commands - following them matches CI behavior precisely. 96 | -------------------------------------------------------------------------------- /resources/gem.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: ruby_rbenv 3 | # Resource:: gem 4 | # 5 | # Author:: Fletcher Nichol 6 | # Author:: Dan Webb 7 | # 8 | # Copyright:: 2011-2018, Fletcher Nichol 9 | # Copyright:: 2017-2021, Dan Webb 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # 23 | 24 | provides :rbenv_gem 25 | unified_mode true 26 | use '_partial/_common' 27 | # Standard Gem Package Options 28 | # https://docs.chef.io/resource_gem_package.html#properties 29 | property :clear_sources, 30 | [true, false], 31 | description: 'Clear the gem sources.' 32 | 33 | property :include_default_source, 34 | [true, false], 35 | default: true, 36 | description: 'Set to false to not include Chef::Config[:rubygems_url] in the sources.' 37 | 38 | property :ignore_failure, 39 | [true, false], 40 | default: false, 41 | description: 'Continue running a recipe if a resource fails for any reason.' 42 | 43 | property :options, 44 | [String, Hash], 45 | description: 'Options to pass to the gem command.' 46 | 47 | property :package_name, 48 | [String, Array], 49 | name_property: true, 50 | description: 'The Gem package name to install.' 51 | 52 | property :source, 53 | [String, Array], 54 | description: 'Source URL/location for gem.' 55 | 56 | property :timeout, 57 | Integer, 58 | default: 300, 59 | description: 'Timeout in seconds to wait for Gem installation.' 60 | 61 | property :version, 62 | String, 63 | description: 'Gem version to install.' 64 | 65 | property :response_file, 66 | String, 67 | description: 'Response file to reconfigure a gem.' 68 | 69 | property :rbenv_version, 70 | String, 71 | required: true, 72 | description: 'Which rbenv version to install the Gem to.' 73 | 74 | default_action :install 75 | 76 | action :install do 77 | gem_package new_resource.package_name do 78 | clear_sources new_resource.clear_sources if new_resource.clear_sources 79 | ignore_failure new_resource.ignore_failure if new_resource.ignore_failure 80 | include_default_source new_resource.include_default_source 81 | gem_binary binary 82 | options new_resource.options if new_resource.options 83 | package_name new_resource.package_name if new_resource.package_name 84 | source new_resource.source if new_resource.source 85 | timeout new_resource.timeout if new_resource.timeout 86 | version new_resource.version if new_resource.version 87 | action :install 88 | end 89 | end 90 | 91 | action :purge do 92 | gem_package new_resource.package_name do 93 | clear_sources new_resource.clear_sources if new_resource.clear_sources 94 | ignore_failure new_resource.ignore_failure if new_resource.ignore_failure 95 | include_default_source new_resource.include_default_source 96 | gem_binary binary 97 | options new_resource.options if new_resource.options 98 | package_name new_resource.package_name if new_resource.package_name 99 | source new_resource.source if new_resource.source 100 | timeout new_resource.timeout if new_resource.timeout 101 | version new_resource.version if new_resource.version 102 | action :purge 103 | end 104 | end 105 | 106 | action :reconfig do 107 | gem_package new_resource.package_name do 108 | clear_sources new_resource.clear_sources if new_resource.clear_sources 109 | ignore_failure new_resource.ignore_failure if new_resource.ignore_failure 110 | include_default_source new_resource.include_default_source 111 | gem_binary binary 112 | options new_resource.options if new_resource.options 113 | package_name new_resource.package_name if new_resource.package_name 114 | source new_resource.source if new_resource.source 115 | timeout new_resource.timeout if new_resource.timeout 116 | version new_resource.version if new_resource.version 117 | response if new_resource.response_file 118 | action :reconfig 119 | end 120 | end 121 | 122 | action :remove do 123 | gem_package new_resource.package_name do 124 | clear_sources new_resource.clear_sources if new_resource.clear_sources 125 | ignore_failure new_resource.ignore_failure if new_resource.ignore_failure 126 | include_default_source new_resource.include_default_source 127 | gem_binary binary 128 | options new_resource.options if new_resource.options 129 | package_name new_resource.package_name if new_resource.package_name 130 | source new_resource.source if new_resource.source 131 | timeout new_resource.timeout if new_resource.timeout 132 | version new_resource.version if new_resource.version 133 | action :remove 134 | end 135 | end 136 | 137 | action :upgrade do 138 | gem_package new_resource.package_name do 139 | clear_sources new_resource.clear_sources if new_resource.clear_sources 140 | ignore_failure new_resource.ignore_failure if new_resource.ignore_failure 141 | include_default_source new_resource.include_default_source 142 | gem_binary binary 143 | options new_resource.options if new_resource.options 144 | package_name new_resource.package_name if new_resource.package_name 145 | source new_resource.source if new_resource.source 146 | timeout new_resource.timeout if new_resource.timeout 147 | version new_resource.version if new_resource.version 148 | action :upgrade 149 | end 150 | end 151 | 152 | action_class do 153 | include Chef::Rbenv::Helpers 154 | end 155 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | Standardise files with files in sous-chefs/repo-management 6 | Standardise files with files in sous-chefs/repo-management 7 | 8 | ## [5.0.24](https://github.com/sous-chefs/ruby_rbenv/compare/5.0.23...v5.0.24) (2025-10-16) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * **ci:** Update workflows to use release pipeline ([#350](https://github.com/sous-chefs/ruby_rbenv/issues/350)) ([84a63d9](https://github.com/sous-chefs/ruby_rbenv/commit/84a63d9c25a700cc94e1f9a618fda36ab3bbf859)) 14 | 15 | ## 5.0.22 - *2024-11-18* 16 | 17 | Standardise files with files in sous-chefs/repo-management 18 | 19 | Standardise files with files in sous-chefs/repo-management 20 | 21 | Standardise files with files in sous-chefs/repo-management 22 | 23 | Standardise files with files in sous-chefs/repo-management 24 | 25 | Standardise files with files in sous-chefs/repo-management 26 | 27 | ## 5.0.19 - *2023-10-03* 28 | 29 | Update CI matrix 30 | 31 | ## 5.0.13 - *2023-04-11* 32 | 33 | Standardise files with files in sous-chefs/repo-management 34 | 35 | ## 5.0.12 - *2023-04-04* 36 | 37 | Standardise files with files in sous-chefs/repo-management 38 | 39 | ## 5.0.11 - *2023-04-01* 40 | 41 | Standardise files with files in sous-chefs/repo-management 42 | 43 | ## 5.0.10 - *2023-04-01* 44 | 45 | Standardise files with files in sous-chefs/repo-management 46 | 47 | ## 5.0.8 - *2023-03-15* 48 | 49 | Standardise files with files in sous-chefs/repo-management 50 | 51 | ## 5.0.7 - *2023-02-20* 52 | 53 | Standardise files with files in sous-chefs/repo-management 54 | 55 | ## 5.0.5 - *2023-02-14* 56 | 57 | Standardise files with files in sous-chefs/repo-management 58 | 59 | ## 5.0.2 - *2022-12-08* 60 | 61 | Standardise files with files in sous-chefs/repo-management 62 | 63 | ## 5.0.1 - *2022-02-08* 64 | 65 | * Remove delivery folder 66 | 67 | ## 5.0.0 - *2022-01-26* 68 | 69 | * Add resource partials for git and common (users and root path helper) 70 | * Bump Chef version to 16 for partials 71 | 72 | ## 4.0.1 - *2021-08-30* 73 | 74 | * Standardise files with files in sous-chefs/repo-management 75 | 76 | ## 4.0.0 - *2021-05-26* 77 | 78 | * Update platform to include CentOS 8 and Debian 10 79 | * Remove testing for CentOS 6 and Ubuntu 16.04 80 | * Add unifed mode to all resources for Chef 17 compatibility 81 | * Require Chef 15.3 for unfied mode 82 | 83 | ## 3.0.0 - *2020-11-26* 84 | 85 | * Namespace the root_path variables to avoid naming conflicts with other sous-chef cookbooks. 86 | 87 | ## 2.6.0 - 2020-10-28 88 | 89 | **NOTE:** Some Chef versions (>= 16 and < 16.4.41) have a bug in the git resource causing some failures (see [#289](https://github.com/sous-chefs/ruby_rbenv/issues/289)). If you experience any troubles please try a more recent version of Chef 16. 90 | 91 | * Remove workaround for chef bug in git resource (fixes #289) 92 | 93 | ## 2.5.1 - 2020-08-20 94 | 95 | * Add placeholder for spec directory to tests run properly 96 | * Fix InSpec tests 97 | * Fix Ubuntu 18.04 dependency: libssl-dev 98 | 99 | ## 2.5.0 - 2020-07-24 100 | 101 | * Add support for Ubuntu 20.04 102 | * Fix dependancy issue for suse 103 | 104 | ## 2.3.2 - 2020-05-05 105 | 106 | * Migrate to actions for testing 107 | 108 | ## [2.3.1] - 2019-12-17 109 | 110 | * Remove the unnecessary long_metadata value in metadata.rb 111 | * Fix Debian 10 dependency: libgdm6 112 | * Use TrueClass and FalseClass in resources 113 | 114 | ## [2.3.0] - 2019-09-30 115 | 116 | * Allow to specify the root_path so global rbenv install can run rbenv_scripts as non root (#247) 117 | 118 | ## [2.2.0] - 2019-08-08 119 | 120 | * Use CircleCI 2.0 Orb 121 | 122 | ## [2.1.3] - 2019-07-17 123 | 124 | * Update CircleCI testing orb 125 | * Update platforms, remove Debian 8 testing support 126 | 127 | ## [2.1.2] - 2018-11-09 128 | 129 | * Fix `TypeError: no implicit conversion of nil into String` for `mac_os_x` platforms 130 | 131 | ## [2.1.1] - 2018-10-08 132 | 133 | * Fixed `rbenv_action` to support actions like `uninstall` (#189) 134 | 135 | ## [2.1.0] - 2018-08-28 136 | 137 | * Drop support for Chef 12 138 | 139 | ## [2.0.9] - 2018-06-12 140 | 141 | * Fix verbose option (#220) 142 | 143 | ## [2.0.8] - 2018-06-09 144 | 145 | * Install the git package rather than the git-core package (#217) 146 | 147 | ## [2.0.7] - 2018-03-11 148 | 149 | * Adding Ubuntu 18.04 support 150 | * Move all helpers into the helper file 151 | * Remove rubinius support, that never worked anyway. 152 | 153 | ## [2.0.6] - 2018-01-08 154 | 155 | * Fix rubinius install 156 | * Add tests for rubinius 157 | 158 | ## [2.0.5] - 2017-10-17 159 | 160 | * Add missing jruby deps #191 161 | * Update README for general usage 162 | 163 | ## [2.0.4] - 2017-08-17 164 | 165 | * Group support on user install #183 166 | 167 | ## [2.0.3] - 2017-08-04 168 | 169 | * Fix rehash resource #179 170 | 171 | ## [2.0.2] - 2017-08-02 172 | 173 | * Fix gem_install resource so it can install gems to a non-global ruby gem. 174 | 175 | ## [2.0.1] - 2017-08-02 176 | 177 | * Fix user_install resource bug where the script wasn't being called with the correct environment. Fixes #175 178 | 179 | ## [2.0.0] - 2017-07-24 180 | 181 | * Switch libraries to custom resources 182 | * Use gem install from core Chef 183 | * Add rbenv_system_install resource 184 | * Remove system_install recipe. Please see the system_install test recipe for usage. 185 | * Remove user_install recipe. Please see the user_install test recipe for usage. 186 | * Removed all other recipes for consistent usage. 187 | * Remove FreeBSD "support" (the platform isn't currently tested) 188 | * Remove Arch Linux support in README. We never really supported this, and it isn't tested 189 | * Update required chef-version to the one we test with (Chef 12.19+) 190 | 191 | ### Known Current Bugs 192 | 193 | * Installing Ruby 2.3.1 on Fedora requires a patched version of 2.3.1\. As patching is currently unavailable please pin to a prior version if you need this installing. 194 | 195 | ## [1.2.1] - 2017-06-23 196 | 197 | * Fixed resource failures on Chef 13 198 | * Updated the Apache license string to a SPDX compliant string 199 | * Added Travis testing for Chef 12 and 13 200 | * Switched testing from Rake to local delivery 201 | 202 | ## [1.2.0] - 2017-04-11 203 | 204 | * Migrated maintenance of this cookbook to Sous Chefs 205 | * Remove the check to see if the homebrew provider exists since this always exists in Chef 12 and the code failed on Chef 13 206 | * Added checks to user install recipes to avoid breaking if the rbenv_home does not exist 207 | * Removed test deps from the Gemfile as we should be testing with ChefDK 208 | * Removed the "suggests 'java'" metadata as suggests was never implemented in Chef and has been removed from Chef 13 209 | * Bumped the required Chef release from 12.0 to 12.1 210 | 211 | ## [1.1.0] - 2016-06-17 212 | 213 | * Restored compatibility for platforms that don't yet support multipackage installs in Chef (BSD and OS X in particular) 214 | * Updated to Grab rbenv from the new repo URL and use https vs. git for compatibility 215 | * Added missing Chefspec matchers 216 | * Enabled use_inline_resources in all providers 217 | * Added chef_version metadata to metadata.rb 218 | * Added source_url and issues_url metadata to metadata.rb 219 | * Added bash a depedency for FreeBSD 220 | * Switched Travis testing to Kitchen Dokken 221 | * Added a chefignore file to limit the files uploaded to the chef server 222 | * Switched linting from Rubocop to Cookstyle (rubocop wrapper by Chef) 223 | 224 | ## [1.0.1] - 2015-10-24 225 | 226 | * Fixed failure with rehashing after the cookbook was renamed 227 | 228 | ## [1.0.0] - 2015-10-12 229 | 230 | ### WARNING: Cookbook has been renamed 231 | 232 | * Renamed to ruby_rbenv and uploaded to Supermarket (all attributes rename in the rbenv cookbook). If you wrap this cookbook you're going to need to update the recipes you include. All providers have been updated to keep their existing rbenv_xyz names for backwards compatibility and attributes still maintain the rbenv namespace. 233 | * Updated Travis config to run integration tests in Travis using kitchen-docker 234 | 235 | ## [0.9.0] - 2015-10-12 236 | 237 | * Fixed base platform case statement in the cookbook that set install_pkgs and user_home_root attributes. This has been converted to a platform_family statement to better support derivitive operating systems and the attributes are set at default levels so they can be overwritten in wrapper cookbooks 238 | * Updated Travis to test using Chef DK vs. Gem installs 239 | * Fixed Chefspecs and Test Kitchen bats tests to all pass 240 | * Added the Apache 2.0 license file 241 | * Updated and added new development dependencies to the Gemfile 242 | * Use Chef 12.1+ multi-package installs for the dependency packages to speed up installs 243 | * Removed the empty Vagrant recipe 244 | * Actually depend on ruby_version vs. suggests since suggests isn't implemented in Chef 245 | 246 | ## [0.8.1] - 2015-08-28 247 | 248 | * Add rbenv_action attribute to rbenv_ruby LWRP so to allow using rvm-download rbenv plugin to download ruby vs. installing ruby 249 | * Fix the ability to install gems to a specific version of ruby 250 | * Remove Chef version checks around use_inline_resources since we require Chef 12 251 | * Use default_action method in the LWRPs 252 | * Fix various rubocop warnings 253 | 254 | ## [0.8.0] - 2015-07-27 255 | 256 | * Drop support for Chef versions prior to 12 257 | * Add Arch linux support 258 | * Add Linux mint support 259 | 260 | ## [0.7.3] - (2015-07-8) 261 | 262 | * Issue [#91](https://github.com/sous-chefs/ruby_rbenv/issues/91) [#79](https://github.com/sous-chefs/ruby_rbenv/issues/79) [#92](https://github.com/sous-chefs/ruby_rbenv/pull/92): Add matchers for rbenv_gem and rbenv_ruby. ([@tduffield](https://github.com/tduffield) and many others) 263 | * Issue [#107](https://github.com/sous-chefs/ruby_rbenv/issues/107): "Option name must be a kind of String!" when installing gems. 264 | * Issue [#101](https://github.com/sous-chefs/ruby_rbenv/issues/101): Use full class name for rbenv_rehash resource 265 | * Fix undefined method `timeout' for LWRP resource rbenv_gem. ([@nathantsoi](https://github.com/nathantsoi) and others) 266 | * Issue [#110](https://github.com/sous-chefs/ruby_rbenv/issues/110): Chef 12.3.0 - undefined method `clear_sources' for Chef::Resource::RbenvGem. ([@tatat](https://github.com/tatat) and others) 267 | * Fork from 268 | 269 | ## [0.7.2] - 2012-12-31 270 | 271 | * Pull request [#26](https://github.com/sous-chefs/ruby_rbenv/pull/26): Don't call libexec commands directly. ([@mhoran]) 272 | * Add integration tests for a system Ruby version. ([@fnichol]) 273 | * Pull request [#36](https://github.com/sous-chefs/ruby_rbenv/pull/36): Use the ruby name as the definition to install ([@gsandie]) 274 | * Pull request [#55](https://github.com/sous-chefs/ruby_rbenv/pull/55): Fix some CHEF-3694 warnings when using with ruby_build ([@trinitronx]) 275 | 276 | ### New features 277 | 278 | * Pull request [#26](https://github.com/sous-chefs/ruby_rbenv/pull/26): Allow setting environment vars per ruby install ([@jasherai]) 279 | * Pull request [#37](https://github.com/sous-chefs/ruby_rbenv/pull/37): Allows use `include_recipe("ruby_build")` instead of having to put it in the `run_list` ([@tjwallace]) 280 | * Pull request [#42](https://github.com/sous-chefs/ruby_rbenv/pull/42): Load rbenv environment after install ([@msaffitz]) 281 | * Pull request [#62](https://github.com/sous-chefs/ruby_rbenv/pull/62): Add Gentoo as supported platform ([@gentooboontoo]) 282 | * Pull request [#46](https://github.com/sous-chefs/ruby_rbenv/pull/46): Add a `definition_file` attribute to the `rbenv_ruby` resource to prevent continually trying to build a custom ruby when passed a build file name instead of a built-in definition ([@jf647]) 283 | * Pull request [#60](https://github.com/sous-chefs/ruby_rbenv/pull/60): Support `definition_file` in rubies definition ([@cyu]) 284 | * Pull request [#75](https://github.com/sous-chefs/ruby_rbenv/pull/75): Update testing support and add unit tests for existing resources ([@fnichol]) 285 | * Pull request [#70](https://github.com/sous-chefs/ruby_rbenv/pull/70): Support ruby 2.1.0 ([@WhyEee]) 286 | 287 | ## [0.7.0] - 2012-11-21 288 | 289 | * Issue [#14](https://github.com/sous-chefs/ruby_rbenv/pull/14): Create /etc/profile.d on system-wide and add note for Mac. ([@fnichol]) 290 | * Pull request [#20](https://github.com/sous-chefs/ruby_rbenv/pull/20): Set an attribute to create profile.d for user install. ([@jtimberman]) 291 | * Pull request [#12](https://github.com/sous-chefs/ruby_rbenv/pull/12): Add name attribute to metadata. ([@jtimberman]) 292 | * Update foodcritic configuration and update .travis.yml. ([@fnichol]) 293 | * Update Installation section of README (welcome Berkshelf). ([@fnichol]) 294 | 295 | ## [0.6.10] - 2012-05-18 296 | 297 | * Pull request [#11](https://github.com/sous-chefs/ruby_rbenv/pull/11): Add FreeBSD support. ([@jssjr]) 298 | * Add other platform supports in metadata.rb and README. ([@fnichol]) 299 | 300 | ## [0.6.8] - 2012-05-06 301 | 302 | * Add official hook resource `log[rbenv-post-init-*]` for inter-cookbook integration. ([@fnichol]) 303 | 304 | ## [0.6.6] - 2012-05-04 305 | 306 | * Fix FC022: Resource condition within loop may not behave as expected. ([@fnichol]) 307 | * Add plaform equivalents in default attrs (FC024). ([@fnichol]) 308 | * Ensure update-java-alternatives is called before JRuby is built. ([@fnichol]) 309 | * Pull request [#8](https://github.com/sous-chefs/ruby_rbenv/pull/8): Add /etc/profile.d/rbenv.sh support for user installs. ([@thoughtless]) 310 | * Add TravisCI to run Foodcritic linter. ([@fnichol]) 311 | * Pull request [#10](https://github.com/sous-chefs/ruby_rbenv/pull/10): README proofreading. ([@jdsiegel]) 312 | * README updates. ([@fnichol]) 313 | * Confirm debian platform support. ([@fnichol]) 314 | 315 | ## [0.6.4] - 2012-02-23 316 | 317 | * Set `root_path` on rbenv_rehash in rbenv_gem provider. ([@fnichol]) 318 | * Foodcritic lint-driven code updates. ([@fnichol]) 319 | * Update Git URL in README. ([@hedgehog]) 320 | 321 | ## [0.6.2] - 2012-02-22 322 | 323 | * Issues [#1](https://github.com/sous-chefs/ruby_rbenv/issues/1), [#2](https://github.com/sous-chefs/ruby_rbenv/issues/2): Stub mixins in RbenvRubygems to avoid libraries load ordering issues. ([@fnichol]) 324 | * Pull request [#5](https://github.com/sous-chefs/ruby_rbenv/pull/5): Include user setting in rehash calls. ([@magnetised]) 325 | * Issue [#4](https://github.com/sous-chefs/ruby_rbenv/issues/4): Fix rbenv/gems hash parsing. ([@fnichol]) 326 | * Large formatting updates to README. ([@fnichol]) 327 | 328 | ## [0.6.0] - 2011-12-21 329 | 330 | The initial release. 331 | 332 | [@cyu]: https://github.com/cyu 333 | [@fnichol]: https://github.com/fnichol 334 | [@gentooboontoo]: https://github.com/gentooboontoo 335 | [@gsandie]: https://github.com/gsandie 336 | [@hedgehog]: https://github.com/hedgehog 337 | [@jasherai]: https://github.com/jasherai 338 | [@jdsiegel]: https://github.com/jdsiegel 339 | [@jf647]: https://github.com/jf647 340 | [@jssjr]: https://github.com/jssjr 341 | [@jtimberman]: https://github.com/jtimberman 342 | [@magnetised]: https://github.com/magnetised 343 | [@mhoran]: https://github.com/mhoran 344 | [@msaffitz]: https://github.com/msaffitz 345 | [@thoughtless]: https://github.com/thoughtless 346 | [@tjwallace]: https://github.com/tjwallace 347 | [@trinitronx]: https://github.com/trinitronx 348 | [@whyeee]: https://github.com/WhyEee 349 | --------------------------------------------------------------------------------