├── documentation ├── .gitkeep └── resources │ ├── install.md │ └── definition.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 ├── .envrc ├── test ├── cookbooks │ └── test │ │ ├── metadata.rb │ │ ├── recipes │ │ └── default.rb │ │ └── files │ │ └── default │ │ └── test.patch └── integration │ └── default │ ├── inspec.yml │ └── controls │ └── verify_ruby_build.rb ├── CODE_OF_CONDUCT.md ├── kitchen.exec.yml ├── Berksfile ├── TESTING.md ├── .rubocop.yml ├── .vscode └── extensions.json ├── spec ├── spec_helper.rb └── libraries │ └── cruby_spec.rb ├── CONTRIBUTING.md ├── .markdownlint-cli2.yaml ├── kitchen.macos.local.yml ├── kitchen.macos.yml ├── .yamllint ├── release-please-config.json ├── .editorconfig ├── renovate.json ├── .overcommit.yml ├── kitchen.yml ├── .gitignore ├── metadata.rb ├── kitchen.global.yml ├── resources ├── install.rb ├── homebrew_update.rb └── definition.rb ├── Dangerfile ├── chefignore ├── libraries └── package_deps.rb ├── kitchen.dokken.yml ├── README.md ├── CHANGELOG.md └── LICENSE /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 | ".": "2.5.12" 3 | } 4 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | export KITCHEN_GLOBAL_YAML=kitchen.global.yml 3 | -------------------------------------------------------------------------------- /test/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | version '1.0.0' 3 | depends 'ruby_build' 4 | -------------------------------------------------------------------------------- /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/cookbooks/test' 7 | end 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | AllCops: 3 | Exclude: 4 | - 'Dangerfile' 5 | - 'resources/homebrew_update.rb' 6 | # This will be moved into Chef Infra Core so I want to preserve the quotes 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "Shopify.ruby-lsp", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /test/integration/default/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ruby_build 3 | title: Ruby -uild tests 4 | license: Public domain 5 | copyright: None 6 | summary: Verify installation of ruby-build 7 | version: 0.0.1 8 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/default.rb: -------------------------------------------------------------------------------- 1 | apt_update 2 | homebrew_update 3 | 4 | ruby_build_install 5 | 6 | ruby_build_definition '3.0.4' do 7 | version_prefix true 8 | patch 'test.patch' 9 | end 10 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | require_relative '../libraries/package_deps' 4 | 5 | RSpec.configure do |config| 6 | config.color = true 7 | config.formatter = :documentation 8 | end 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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /kitchen.macos.local.yml: -------------------------------------------------------------------------------- 1 | --- 2 | provisioner: 3 | name: chef_zero 4 | install_strategy: once 5 | channel: current 6 | sudo: true 7 | 8 | platforms: 9 | - name: macos 10 | driver: 11 | box: damacus/macos-10.15.4 12 | provider: parallels 13 | linked_clone: true 14 | gui: false 15 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /kitchen.macos.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: exec 4 | host: localhost 5 | 6 | provisioner: 7 | require_chef_omnibus: false 8 | name: chef_zero 9 | install_strategy: skip 10 | chef_client_path: "/opt/chef-workstation/bin/chef-client" 11 | deprecations_as_errors: false 12 | sudo: true 13 | 14 | platforms: 15 | - name: macos 16 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /test/cookbooks/test/files/default/test.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/NEWS.md b/NEWS.md 2 | --- a/NEWS.md 2022-04-12 04:48:55.000000000 -0700 3 | +++ b/NEWS.md 2022-08-07 19:19:49.013462652 -0700 4 | @@ -1,5 +1,7 @@ 5 | # NEWS for Ruby 3.0.0 6 | 7 | +# FOO BAR BAZ 8 | + 9 | This document is a list of user visible feature changes 10 | since the **2.7.0** release, except for bug fixes. 11 | -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | ".": { 4 | "package-name": "ruby_build", 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | 5 | provisioner: 6 | name: chef_infra 7 | product_name: chef 8 | chef_license: accept-no-persist 9 | multiple_converge: 2 10 | enforce_idempotency: true 11 | deprecations_as_errors: true 12 | 13 | verifier: 14 | name: inspec 15 | 16 | platforms: 17 | - name: almalinux-8 18 | - name: centos-7 19 | - name: centos-stream-8 20 | - name: debian-10 21 | - name: debian-11 22 | - name: rockylinux-8 23 | - name: ubuntu-18.04 24 | - name: ubuntu-20.04 25 | - name: ubuntu-22.04 26 | 27 | suites: 28 | - name: default 29 | run_list: 30 | - recipe[test] 31 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /documentation/resources/install.md: -------------------------------------------------------------------------------- 1 | # ruby_build_install 2 | 3 | Install Ruby Build and all package dependencies 4 | 5 | Installs ruby-build binary to `/usr/local/bin/ruby-build` 6 | 7 | ## Properties 8 | 9 | | Property | Ruby Type | Default | Description | 10 | | --------- | --------- | -------- | ----------------------------------------------------------------- | 11 | | `git_ref` | `String` | `master` | Git reference to download, set to a tag to get a specific version | 12 | 13 | ## Example Usage 14 | 15 | Install Ruby 2.6.0 16 | 17 | ```ruby 18 | # recipes/default.rb 19 | ruby_build_install '' 20 | 21 | ruby_build_definition '2.6.0' 22 | ``` 23 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'ruby_build' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'Manages the ruby-build framework and its installed rubies. A LWRP is also defined.' 6 | source_url 'https://github.com/sous-chefs/ruby_build' 7 | issues_url 'https://github.com/sous-chefs/ruby_build/issues' 8 | chef_version '>= 15.0' 9 | version '2.5.12' 10 | 11 | supports 'ubuntu' 12 | supports 'debian' 13 | supports 'freebsd' 14 | supports 'redhat' 15 | supports 'centos' 16 | supports 'fedora' 17 | supports 'amazon' 18 | supports 'scientific' 19 | supports 'suse' 20 | supports 'opensuse' 21 | supports 'opensuseleap' 22 | supports 'mac_os_x' 23 | 24 | depends 'yum-epel' 25 | depends 'homebrew' 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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/integration/default/controls/verify_ruby_build.rb: -------------------------------------------------------------------------------- 1 | control 'Check definitions' do 2 | impact 1.0 3 | title 'Verify we can return a list of definitions' 4 | desc 'Verify we can get a list of Ruby definitions' 5 | describe command('/usr/local/bin/ruby-build --definitions') do 6 | its('exit_status') { should eq 0 } 7 | its('stdout') { should match /3.0.4/ } 8 | end 9 | end 10 | 11 | control 'ruby-build binary should work' do 12 | impact 1.0 13 | title 'Verify that running ruby-build works' 14 | desc 'Verify that running ruby-build will work for users' 15 | describe file('/usr/local/bin/ruby-build') do 16 | it { should be_file } 17 | it { should be_executable } 18 | end 19 | end 20 | 21 | gem_cmd = if os.darwin? 22 | 'sudo /usr/local/ruby/3.0.4/bin/gem install ffi --no-document' 23 | else 24 | '/usr/local/ruby/3.0.4/bin/gem install ffi --no-document' 25 | end 26 | 27 | control 'Install a Ruby gem' do 28 | impact 1.0 29 | title 'Verify gem install works' 30 | desc 'Verify gem install works, and the gem works after installation' 31 | 32 | describe command(gem_cmd) do 33 | its('exit_status') { should eq 0 } 34 | its('stdout') { should match /Successfully installed ffi/ } 35 | end 36 | 37 | describe command('/usr/local/ruby/3.0.4/bin/gem env') do 38 | its('exit_status') { should eq 0 } 39 | its('stdout') { should match %r{gems/3.0.0} } 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /documentation/resources/definition.md: -------------------------------------------------------------------------------- 1 | # ruby_build_install 2 | 3 | Install a Ruby Definition (Ruby version) 4 | 5 | ## Properties 6 | 7 | | Property | Ruby Type | Default | Description | 8 | | ------------- | --------- | ----------------- | ----------------------------------------------------- | 9 | | `definition` | String | | Version of Ruby to install | 10 | | `environment` | String | | Environment to pass to the ruby-build install process | 11 | | `group` | String | | Group to install as | 12 | | `prefix_path` | String | `/usr/local/ruby` | Location to install Ruby | 13 | | `user` | String | | User to install as | 14 | | `verbose` | Boolean | `false` | Print compilation status to stdout | 15 | 16 | ## Example Usage 17 | 18 | ### Install Enterprise Ruby 19 | 20 | ```ruby 21 | ruby_build_install '' 22 | 23 | ruby_build_definition "ree-1.8.7-2012.02" do 24 | environment({ 'CONFIGURE_OPTS' => '--no-tcmalloc' }) 25 | end 26 | ``` 27 | 28 | ### Install A Ruby For A User 29 | 30 | ```ruby 31 | ruby_build_definition "maglev-1.0.0" do 32 | prefix_path "/home/deploy/.rubies/maglev-1.0.0" 33 | user "deploy" 34 | group "deploy" 35 | end 36 | ``` 37 | -------------------------------------------------------------------------------- /resources/install.rb: -------------------------------------------------------------------------------- 1 | property :name, String, default: '' 2 | 3 | property :git_ref, String, 4 | default: 'master', 5 | description: 'Git reference to download, set to a tag to get a specific version' 6 | 7 | unified_mode true if respond_to? :unified_mode 8 | 9 | action :install do 10 | src_path = "#{Chef::Config['file_cache_path']}/ruby-build" 11 | 12 | if platform_family?('rhel') 13 | if node['platform_version'].to_i == 9 14 | package 'yum-utils' 15 | 16 | execute 'yum-config-manager --enable crb' do 17 | not_if 'yum-config-manager --dump crb | grep -q "enabled = 1"' 18 | end 19 | elsif node['platform_version'].to_i == 8 20 | package 'yum-utils' 21 | 22 | execute 'yum-config-manager --enable powertools' do 23 | not_if 'yum-config-manager --dump powertools | grep -q "enabled = 1"' 24 | end 25 | end 26 | 27 | include_recipe 'yum-epel' 28 | end 29 | 30 | package %w(tar bash curl git) unless platform_family?('mac_os_x', 'freebsd') 31 | 32 | git src_path do 33 | repository 'https://github.com/rbenv/ruby-build.git' 34 | revision new_resource.git_ref unless new_resource.git_ref == 'master' 35 | retries 5 36 | retry_delay 5 37 | end 38 | 39 | execute 'Install ruby-build' do 40 | cwd src_path 41 | command %(sh ./install.sh) 42 | not_if do 43 | ::File.exist?('/usr/local/bin/ruby-build') && 44 | `#{src_path}/bin/ruby-build --version` == `/usr/local/bin/ruby-build --version` 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/libraries/cruby_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe '#cruby_package_deps' do 4 | context 'CentOS' do 5 | recipe do 6 | Chef::DSL::Recipe.include(Chef::Rbenv::PackageDeps) 7 | 8 | log cruby_package_deps 9 | end 10 | 11 | context 'CentOS 7' do 12 | platform 'centos', '7' 13 | it { is_expected.to write_log('gcc, bzip2, openssl-devel, libyaml-devel, libffi-devel, readline-devel, zlib-devel, gdbm-devel, ncurses-devel, make, patch') } 14 | end 15 | 16 | context 'CentOS 8' do 17 | platform 'centos', '8' 18 | it { is_expected.to write_log('gcc, bzip2, openssl-devel, libyaml-devel, libffi-devel, readline-devel, zlib-devel, gdbm-devel, ncurses-devel, make, patch') } 19 | end 20 | 21 | context 'Debian 9' do 22 | platform 'debian', '9' 23 | it { is_expected.to write_log('gcc, autoconf, bison, build-essential, libssl-dev, libyaml-dev, libreadline6-dev, zlib1g-dev, libncurses5-dev, libffi-dev, libgdbm3, libgdbm-dev, make, patch') } 24 | end 25 | 26 | context 'Debian 10' do 27 | platform 'debian', '10' 28 | it { is_expected.to write_log('gcc, autoconf, bison, build-essential, libssl-dev, libyaml-dev, libreadline6-dev, zlib1g-dev, libncurses5-dev, libffi-dev, libgdbm6, libgdbm-dev, make, patch') } 29 | end 30 | 31 | context 'Ubuntu 16.04' do 32 | platform 'ubuntu', '16.04' 33 | it { is_expected.to write_log('gcc, autoconf, bison, build-essential, libssl-dev, libyaml-dev, libreadline6-dev, zlib1g-dev, libncurses5-dev, libffi-dev, libgdbm3, libgdbm-dev, make, patch') } 34 | end 35 | 36 | context 'Ubuntu 18.04' do 37 | platform 'ubuntu', '18.04' 38 | it { is_expected.to write_log('gcc, autoconf, bison, build-essential, libssl-dev, libyaml-dev, libreadline6-dev, zlib1g-dev, libncurses5-dev, libffi-dev, libgdbm5, libgdbm-dev, make, patch') } 39 | end 40 | 41 | context 'Ubuntu 20.04' do 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /libraries/package_deps.rb: -------------------------------------------------------------------------------- 1 | class Chef 2 | module Rbenv 3 | module MacOs 4 | def openssl_prefix 5 | `/usr/local/bin/brew --prefix openssl@1.1`.strip! 6 | end 7 | end 8 | 9 | module PackageDeps 10 | def cruby_package_deps 11 | case node['platform_family'] 12 | when 'rhel', 'fedora', 'amazon' 13 | %w( gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel make patch ) 14 | when 'debian' 15 | case node['platform'] 16 | when 'debian' 17 | if node['platform_version'].to_i >= 10 18 | %w( gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev make patch ) 19 | else 20 | %w( gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev make patch ) 21 | end 22 | when 'ubuntu' 23 | if node['platform_version'].to_i >= 20 24 | %w( gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev make patch ) 25 | elsif node['platform_version'].to_i == 18 26 | %w( gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev make patch ) 27 | else 28 | %w( gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev make patch ) 29 | end 30 | end 31 | when 'suse' 32 | %w( gcc make automake gdbm-devel libyaml-devel ncurses-devel readline-devel zlib-devel libopenssl-devel patch ) 33 | when 'mac_os_x' 34 | %w( openssl@1.1 readline ) 35 | end 36 | end 37 | 38 | def package_deps 39 | cruby_package_deps 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /resources/homebrew_update.rb: -------------------------------------------------------------------------------- 1 | unified_mode true if respond_to? :unified_mode 2 | 3 | provides :homebrew_update 4 | 5 | description 'Use the **homebrew_update** resource to manage Homebrew repository updates on MacOS.' 6 | introduced '16.2' 7 | examples <<~DOC 8 | **Update the hombrew repository data at a specified interval**: 9 | ```ruby 10 | homebrew_update 'all platforms' do 11 | frequency 86400 12 | action :periodic 13 | end 14 | ``` 15 | **Update the Homebrew repository at the start of a Chef Infra Client run**: 16 | ```ruby 17 | homebrew_update 'update' 18 | ``` 19 | DOC 20 | 21 | # allow bare homebrew_update with no name 22 | property :name, String, default: '' 23 | 24 | property :frequency, Integer, 25 | description: 'Determines how frequently (in seconds) Homebrew updates are made. Use this property when the `:periodic` action is specified.', 26 | default: 86_400 27 | 28 | default_action :periodic 29 | 30 | action_class do 31 | BREW_STAMP_DIR = '/var/lib/homebrew/periodic'.freeze 32 | BREW_STAMP = "#{BREW_STAMP_DIR}/update-success-stamp".freeze 33 | 34 | # Determines whether we need to run `homebrew update` 35 | # 36 | # @return [Boolean] 37 | def brew_up_to_date? 38 | ::File.exist?(BREW_STAMP) && 39 | ::File.mtime(BREW_STAMP) > Time.now - new_resource.frequency 40 | end 41 | 42 | def do_update 43 | directory BREW_STAMP_DIR do 44 | recursive true 45 | end 46 | 47 | file BREW_STAMP do 48 | content "BREW::Update::Post-Invoke-Success\n" 49 | action :create_if_missing 50 | end 51 | 52 | execute 'brew update' do 53 | command %w(brew update) 54 | default_env true 55 | user Homebrew.owner 56 | notifies :touch, "file[#{BREW_STAMP}]", :immediately 57 | end 58 | end 59 | end 60 | 61 | action :periodic do 62 | return unless mac_os_x? 63 | 64 | unless brew_up_to_date? 65 | converge_by 'update new lists of packages' do 66 | do_update 67 | end 68 | end 69 | end 70 | 71 | action :update do 72 | return unless mac_os_x? 73 | 74 | converge_by 'force update new lists of packages' do 75 | do_update 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: [master] 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 | - "centos-7" 27 | - "centos-stream-8" 28 | - "debian-10" 29 | - "debian-11" 30 | - "rockylinux-8" 31 | - "ubuntu-1804" 32 | - "ubuntu-2004" 33 | - "ubuntu-2204" 34 | suite: 35 | - "default" 36 | fail-fast: false 37 | 38 | steps: 39 | - name: Check out code 40 | uses: actions/checkout@v5 41 | - name: Install Chef 42 | uses: actionshub/chef-install@main 43 | - name: Dokken 44 | uses: actionshub/test-kitchen@main 45 | env: 46 | CHEF_LICENSE: accept-no-persist 47 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 48 | with: 49 | suite: ${{ matrix.suite }} 50 | os: ${{ matrix.os }} 51 | 52 | integration-macos: 53 | needs: lint-unit 54 | runs-on: macos-latest 55 | steps: 56 | - name: Check out code 57 | uses: actions/checkout@v5 58 | - name: Install Chef 59 | uses: actionshub/chef-install@main 60 | - name: Kitchen Test 61 | uses: actionshub/test-kitchen@main 62 | env: 63 | CHEF_LICENSE: accept-no-persist 64 | KITCHEN_LOCAL_YAML: kitchen.macos.yml 65 | TERM: xterm-256color 66 | with: 67 | suite: default 68 | os: macos 69 | action: test 70 | 71 | results: 72 | if: ${{ always() }} 73 | runs-on: ubuntu-latest 74 | name: Final Results 75 | needs: [integration, integration-macos] 76 | steps: 77 | - run: | 78 | result="${{ needs.integration.result }}" 79 | if [[ $result == "success" || $result == "skipped" ]]; then 80 | exit 0 81 | else 82 | exit 1 83 | fi 84 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/definition.rb: -------------------------------------------------------------------------------- 1 | include Chef::Rbenv::MacOs 2 | 3 | # for compatibility with earlier incarnations 4 | # of this resource 5 | # 6 | provides :ruby_build_ruby 7 | 8 | property :definition, String, 9 | name_property: true, 10 | description: 'Version of Ruby to install' 11 | 12 | property :prefix_path, String, 13 | default: '/usr/local/ruby', 14 | description: 'Location to install Ruby' 15 | 16 | property :verbose, [true, false], 17 | default: false, 18 | description: 'print compilation status to stdout' 19 | 20 | # NOTE: adding the Ruby version to the installation prefix 21 | # by default is unexpected and will likely lead to user 22 | # problems. Now defaults to false. 23 | # 24 | property :version_prefix, [true, false], 25 | default: false, 26 | description: 'add Ruby version to the installation prefix' 27 | 28 | property :patch, [String, nil], 29 | description: 'path to a Ruby patch file for ruby-build to use' 30 | 31 | property :environment, Hash, 32 | default: {}, 33 | description: 'Environment hash to pass to the ruby-build install process' 34 | 35 | property :user, String, 36 | description: 'User to install as' 37 | 38 | property :group, String, 39 | description: 'Group to install as' 40 | 41 | unified_mode true if respond_to? :unified_mode 42 | 43 | action :install do 44 | Chef::Log.fatal('JRuby is not a supported definition') \ 45 | if new_resource.definition.include? 'jruby' 46 | 47 | if platform_family?('mac_os_x') && Chef::VERSION < '16' 48 | Array(package_deps).each do |pkg| 49 | package pkg 50 | end 51 | else 52 | package package_deps 53 | end 54 | 55 | installation_path = if new_resource.version_prefix 56 | ::File.join(new_resource.prefix_path, new_resource.definition) 57 | else 58 | new_resource.prefix_path 59 | end 60 | 61 | env = if platform_family?('mac_os_x') 62 | extra_env = { 'RUBY_CONFIGURE_OPTS' => "--with-openssl-dir=#{openssl_prefix}" } 63 | new_resource.environment.merge extra_env 64 | else 65 | new_resource.environment 66 | end 67 | 68 | ruby_build_cmd = [ 69 | '/usr/local/bin/ruby-build', 70 | new_resource.definition, 71 | installation_path, 72 | ].join(' ') 73 | 74 | ruby_build_cmd += ' --verbose' if new_resource.verbose 75 | 76 | if new_resource.patch 77 | patch_path = "#{Chef::Config[:file_cache_path]}/#{new_resource.patch}" 78 | ruby_build_cmd += %( --patch < "#{patch_path}" ) 79 | 80 | cookbook_file patch_path do 81 | source new_resource.patch 82 | end 83 | end 84 | 85 | bash "ruby-build #{new_resource.definition}" do 86 | code ruby_build_cmd 87 | environment env 88 | user new_resource.user 89 | group new_resource.group 90 | not_if do 91 | ::Dir.exist?("#{installation_path}/bin") && 92 | new_resource.definition == `#{installation_path}/bin/ruby -e 'print RUBY_VERSION'` 93 | end 94 | live_stream true 95 | action :run 96 | end 97 | end 98 | 99 | action_class do 100 | include Chef::Rbenv::PackageDeps 101 | include Chef::Rbenv::MacOs 102 | end 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ruby-build Chef Cookbook 2 | 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/ruby_build.svg)](https://supermarket.chef.io/cookbooks/ruby_build) 4 | [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) 5 | [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) 6 | 7 | ## Description 8 | 9 | Manages the [ruby-build][rb_site] framework and its installed Rubies, through custom resources. 10 | 11 | ## Maintainers 12 | 13 | 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). 14 | 15 | ## Usage 16 | 17 | It is for use in standalone mode. If you wish to use ruby-build with rbenv, please use the [rbenv cookbook][rbenv-cookbook]. 18 | 19 | ## Requirements 20 | 21 | ### Chef 22 | 23 | - Chef 15+ 24 | 25 | ### Supported Platforms 26 | 27 | - Ubuntu 16.04+ 28 | - MacOS 29 | - debian 8+ 30 | - FreeBSD 9+ 31 | - RedHat 6+ 32 | 33 | ## Usage 34 | 35 | ```ruby 36 | # metadata.rb 37 | depends 'ruby_build' 38 | ``` 39 | 40 | ```ruby 41 | # default.rb 42 | ruby_build_install '' 43 | 44 | ruby_build_definition '2.6.0' 45 | 46 | # build 2.6.0 with a patch that lives in your cookbook's files/default dir 47 | ruby_build_definition '2.6.0' do 48 | patch 'foobar.patch' 49 | end 50 | ``` 51 | 52 | ## Resources 53 | 54 | - [ruby_build_install](https://github.com/sous-chefs/ruby_build/blob/master/documentation/resources/install.md) 55 | - [ruby_build_definition](https://github.com/sous-chefs/ruby_build/blob/master/documentation/resources/definition.md) 56 | 57 | ## License and Author 58 | 59 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 60 | 61 | ```text 62 | http://www.apache.org/licenses/LICENSE-2.0 63 | ``` 64 | 65 | ### Sponsors 66 | 67 | [rb_site]: https://github.com/rbenv/ruby-build 68 | [rbenv-cookbook]: https://github.com/sous-chefs/ruby_rbenv 69 | 70 | ![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) 71 | ![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) 72 | ![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) 73 | ![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) 74 | ![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) 75 | ![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) 76 | ![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) 77 | ![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) 78 | ![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) 79 | ![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) 80 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | Standardise files with files in sous-chefs/repo-management 9 | Standardise files with files in sous-chefs/repo-management 10 | 11 | ## [2.5.12](https://github.com/sous-chefs/ruby_build/compare/2.5.11...v2.5.12) (2025-10-16) 12 | 13 | 14 | ### Bug Fixes 15 | 16 | * **ci:** Update workflows to use release pipeline ([#187](https://github.com/sous-chefs/ruby_build/issues/187)) ([a6113b1](https://github.com/sous-chefs/ruby_build/commit/a6113b1209c610b488c3456ff17bf81df5bc92ce)) 17 | 18 | ## 2.5.11 - *2025-09-04* 19 | 20 | Standardise files with files in sous-chefs/repo-management 21 | 22 | ## 2.5.10 - *2024-11-18* 23 | 24 | Standardise files with files in sous-chefs/repo-management 25 | 26 | Standardise files with files in sous-chefs/repo-management 27 | 28 | Standardise files with files in sous-chefs/repo-management 29 | 30 | Standardise files with files in sous-chefs/repo-management 31 | 32 | Standardise files with files in sous-chefs/repo-management 33 | 34 | ## 2.5.6 - *2024-03-01* 35 | 36 | * CentOS Stream 9 uses 'crb' instead of the 'powertools' repo. 37 | 38 | ## 2.5.0 - *2023-05-16* 39 | 40 | * Allow ruby-build to recognize when it needs to be upgraded. 41 | * Allow ruby-build to reinstall Ruby if the version changes. 42 | 43 | ## 2.4.0 - *2023-05-16* 44 | 45 | * Ubuntu 18 now uses 'libssl-dev' instead of 'libssl1.0-dev' 46 | 47 | ## 2.3.13 - *2023-04-07* 48 | 49 | Standardise files with files in sous-chefs/repo-management 50 | 51 | ## 2.3.10 - *2023-04-01* 52 | 53 | Standardise files with files in sous-chefs/repo-management 54 | 55 | ## 2.3.9 - *2023-03-20* 56 | 57 | Standardise files with files in sous-chefs/repo-management 58 | 59 | ## 2.3.8 - *2023-03-15* 60 | 61 | Standardise files with files in sous-chefs/repo-management 62 | 63 | Standardise files with files in sous-chefs/repo-management 64 | 65 | ## 2.3.7 - *2023-02-27* 66 | 67 | Standardise files with files in sous-chefs/repo-management 68 | 69 | ## 2.3.6 - *2023-02-16* 70 | 71 | Standardise files with files in sous-chefs/repo-management 72 | 73 | ## 2.3.5 - *2023-02-14* 74 | 75 | Standardise files with files in sous-chefs/repo-management 76 | 77 | ## 2.3.1 - *2022-12-06* 78 | 79 | Standardise files with files in sous-chefs/repo-management 80 | 81 | ## 2.3.0 - *2022-08-08* 82 | 83 | * Add `verbose` option 84 | * Remove Delivery and move to calling RSpec directly via a reusable workflow 85 | * Use reusable workflows 86 | * Update test build to use Ruby 3.0.4 87 | * Add Alma Linux & Rocky Linux / Replace CentOS 8 with CentOS Stream 8 88 | * Standardize kitchen.dokken.yml 89 | * Add support for Ubuntu 22.04 90 | * Remove use of yum-centos and replace with use of yum-config-manager to make it easier to work with Alma/Rocky 91 | * Install openssl@1.1 on MacOS 92 | 93 | ## 2.2.3 - *2022-05-16* 94 | 95 | * Standardise files with files in sous-chefs/repo-management 96 | 97 | ## 2.2.2 - *2022-02-10* 98 | 99 | * Standardise files with files in sous-chefs/repo-management 100 | 101 | ## 2.2.1 - *2022-02-08* 102 | 103 | * Remove delivery folder 104 | 105 | ## 2.2.0 - *2021-12-27* 106 | 107 | * support Chef temporary directory being located on a volume mounted `noexec` 108 | * support Ruby installation directory being created ahead of time 109 | 110 | ## 2.1.5 - *2021-11-22* 111 | 112 | * Retry when cloning the ruby-build code repository 113 | 114 | ## 2.1.4 - *2021-08-30* 115 | 116 | * Standardise files with files in sous-chefs/repo-management 117 | 118 | ## 2.1.3 - *2021-06-01* 119 | 120 | * Standardise files with files in sous-chefs/repo-management 121 | 122 | ## 2.1.2 - *2020-12-02* 123 | 124 | * resolved cookstyle error: libraries/package_deps.rb:8:5 convention: `Layout/EmptyLineBetweenDefs` 125 | 126 | ## 2.1.1 (2020-09-16) 127 | 128 | * resolved cookstyle error: spec/libraries/cruby_spec.rb:6:7 refactor: `ChefCorrectness/IncorrectLibraryInjection` 129 | * Cookstyle Bot Auto Corrections with Cookstyle 6.16.8 130 | 131 | ## 2.1.0 (2020-06-17) 132 | 133 | * Fix package_deps being passed too many arguments 134 | * Fix switching to master when we're already on master 135 | * Add MacOS testing 136 | 137 | * fix broken environment property (needs a Hash, was set to String) 138 | * update documentation pages with new custom resource name ruby_build_definition 139 | * make the automatic addition of the Ruby version to the prefix an option 140 | * allow users to use the old ruby_build_ruby resource name, for compatibility 141 | * do not assume that users are running Chef 15.3.x and can use unified_mode 142 | * add requested feature: patch 143 | 144 | ## 2.0.0 (2020-04-21) 145 | 146 | * Remove support for JRuby, it requires an out of support Java version 147 | * Convert to a custom resource 148 | * Move test from bats to Inspec 149 | * Add support for Amazon Linux 150 | * Add support for Ubuntu 18.04 151 | 152 | ## 1.3.0 (2020-03-05) 153 | 154 | * Add debian-10 platform to test kitchen configurations 155 | * Migrate to github actions 156 | * Fix CircleCI testing, bring it up to Sous-Chefs standards 157 | * Fix Markdown 158 | * Fix YAML 159 | * Use platform? helper in the attributes file 160 | * Remove the unnecessary long_description field in metadata.rb 161 | * Fix libgdbm package name in attributes for debian 10 162 | * Fix libgdbm package name in attributes for Ubuntu 19.04 163 | 164 | ## 1.2.0 (2019-01-23) 165 | 166 | * Add debian-10 platform to test kitchen configurations 167 | * Migrate to github actions 168 | * Remove recipes 169 | * Add ruby_build_install resource 170 | * Add ruby_build_definition resource 171 | * Add unit testing 172 | 173 | ## 1.1.0 (2017-04-07) 174 | 175 | * Maintenance of this cookbook has been moved to the Sous Chefs organization - 176 | * Switched git installation to the git cookbook 177 | * Sped up converge times by using multi-package installs when available 178 | * Added Chefspec matchers 179 | * Removed a duplicate package that was causing warnings on Chef 12 / failures on Chef 13 180 | * Ensured that multi-package installs would continue on Amazon Linux with Chef 13 181 | * Removed some fragile and unnecessary code that checked to see if we were on Chef 12+ 182 | * Switched testing to Delivery local mode and removed all test gems from the Gemfile. 183 | * Added a skeleton Chefspec test suite 184 | * Updated to more modern Ruby versions to test with 185 | 186 | ## 1.0.0 (2016-07-18) 187 | 188 | * This cookbook has been moved under the chef-rbenv Github organization to allow for additional committers and further maintenance 189 | * The cookbook now requires Chef 12 due to the use of multi-package installations 190 | * Existing lists of package dependencies have been updated to match those on the ruby-build wiki. This removes several runtime dependencies such as readline, zlib, and subversion 191 | * Added support for installing Rubinius dependencies when installing Rubinius 192 | * Added dependency installation on OS X machines 193 | * Added support for FreeBSD 194 | * Added a dependency on yum-epel when on RHEL 195 | * Added Travis CI integration testing using kitchen-dokken and inspec 196 | * Added cookstyle for Ruby linting and resolved all warnings 197 | * Updated the ruby-build Github URL to the new location 198 | * Switched package dependency logic to use platform_family which supports additional derivative distros 199 | * Add source_url, issues_url, and chef_version metadata to metadata.rb 200 | * Updated the LWRP to use use_inline_resources for proper update notifications 201 | * Added a Chef 11+ style default_action to the LWRP 202 | * Updated attribute file to use default instead of node.set which avoids deprecation warnings 203 | * Updated the Berksfile to use Supermarket 204 | * Updated the Gemfile with the latest testing dependencies 205 | * Added the Apache 2.0 license file 206 | * Updated readme to remove HTML tables that don't render in Supermarket 207 | * Swapped the Rakefile for the standard Chef Rakefile 208 | 209 | ## 0.8.0 (2013-05-22) 210 | 211 | * Pull request [#8]: Remove libyaml-devel pkg dependency for Red Hat family platforms. ([@fnichol]) 212 | * Pull request [#9]: Use the HTTPS clone URL. ([@adammck]) 213 | * Pull request [#10]: Use old-form notifies to support AWS OpsWorks. ([@tsabat]) 214 | * Issue [#7]: Install Git package(s) only if Git is not previously installed. ([@fnichol], [@ChrisLundquist]) 215 | * Convert project from Jamie to Test Kitchen. ([@fnichol]) 216 | 217 | ## 0.7.2 (2012-12-31) 218 | 219 | * Fix missing package dependencies for C Ruby versions on RHEL family. ([@fnichol]) 220 | * Print Ruby build time to :info logger (formerly :debug). ([@fnichol]) 221 | * Add integration tests for commonly installed Ruby versions. ([@fnichol]) 222 | 223 | ## 0.7.0 (2012-11-21) 224 | 225 | * Add environment attr to ruby_build_ruby. This allows for adding custom compilation flags, as well as newer ruby-build environment variables, such as RUBY_BUILD_MIRROR_URL. ([@fnichol]) 226 | * Update foodcritic configuration and update .travis.yml. ([@fnichol]) 227 | * Update Installation section of README (welcome Berkshelf). ([@fnichol]) 228 | 229 | ## 0.6.2 (2012-05-03) 230 | 231 | * Fix ruby_build_ruby LWRP now notifies when updated (FC017). ([@fnichol]) 232 | * Fix Add plaform equivalents in default attrs (FC024). ([@fnichol]) 233 | * Fix JRuby requires make package on Ubuntu/Debian. ([@fnichol]) 234 | * Ensure `Chef::Config[:file_cache_path]` exists in solo mode. ([@fnichol]) 235 | * Add TravisCI to run Foodcritic linter. ([@fnichol]) 236 | * Reorganize README with section links. ([@fnichol]) 237 | 238 | ## 0.6.0 (2011-12-10) 239 | 240 | The initial release. 241 | 242 | [#10]: https://github.com/fnichol/chef-ruby_build/issues/10 243 | [#7]: https://github.com/fnichol/chef-ruby_build/issues/7 244 | [#8]: https://github.com/fnichol/chef-ruby_build/issues/8 245 | [#9]: https://github.com/fnichol/chef-ruby_build/issues/9 246 | [@adammck]: https://github.com/adammck 247 | [@chrislundquist]: https://github.com/ChrisLundquist 248 | [@fnichol]: https://github.com/fnichol 249 | [@tsabat]: https://github.com/tsabat 250 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------