├── .editorconfig ├── .envrc ├── .gitattributes ├── .github ├── CODEOWNERS ├── lock.yml └── workflows │ ├── ci.yml │ └── stale.yml ├── .gitignore ├── .markdownlint-cli2.yaml ├── .mdlrc ├── .overcommit.yml ├── .vscode └── extensions.json ├── .yamllint ├── Berksfile ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dangerfile ├── Guardfile ├── LICENSE ├── README.md ├── TESTING.md ├── attributes ├── .gitkeep ├── default.rb ├── gem_package.rb └── vagrant.rb ├── chefignore ├── documentation └── .gitkeep ├── kitchen.dokken.yml ├── kitchen.exec.yml ├── kitchen.global.yml ├── kitchen.yml ├── libraries ├── provider_rvm_ruby.rb └── resource_rvm_ruby.rb ├── metadata.rb ├── recipes ├── .gitkeep ├── default.rb ├── gem_package.rb ├── system.rb ├── system_install.rb ├── user.rb ├── user_install.rb └── vagrant.rb ├── renovate.json ├── spec ├── libraries │ └── provider_rvm_ruby_spec.rb └── spec_helper.rb ├── templates └── default │ ├── rvmrc.erb │ ├── vagrant-chef-client-wrapper.erb │ └── vagrant-chef-solo-wrapper.erb └── test ├── fixtures └── cookbooks │ └── rvm_wrapper │ ├── README.md │ ├── metadata.rb │ └── recipes │ └── default.rb └── integration ├── data_bags └── users │ ├── virgil1.json │ ├── virgil2.json │ └── wigglebottom.json └── stock_system_and_user └── minitest ├── Gemfile └── test_stock_system_and_user.rb /.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 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | export KITCHEN_GLOBAL_YAML=kitchen.global.yml 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sous-chefs/maintainers 2 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | lint-unit: 12 | uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 13 | permissions: 14 | actions: write 15 | checks: write 16 | pull-requests: write 17 | statuses: write 18 | issues: write 19 | 20 | integration: 21 | needs: lint-unit 22 | runs-on: ubuntu-latest 23 | strategy: 24 | matrix: 25 | os: 26 | - "centos-7" 27 | - "debian-9" 28 | - "ubuntu-1604" 29 | - "ubuntu-1804" 30 | suite: 31 | - "server-install" 32 | fail-fast: false 33 | steps: 34 | - name: Check out code 35 | uses: actions/checkout@v4 36 | - name: Install Chef 37 | uses: actionshub/chef-install@3.0.0 38 | - name: Dokken 39 | uses: actionshub/test-kitchen@3.0.0 40 | env: 41 | CHEF_LICENSE: accept-no-persist 42 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 43 | with: 44 | suite: ${{ matrix.suite }} 45 | os: ${{ matrix.os }} 46 | -------------------------------------------------------------------------------- /.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@v9 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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | ignores: 7 | - .github/copilot-instructions.md 8 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD013", "~MD024", "~MD033", "~MD029" 2 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "rebornix.ruby", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'apt' 7 | cookbook 'yum' 8 | cookbook 'java' 9 | cookbook 'user' 10 | cookbook 'rvm_wrapper', path: 'test/fixtures/cookbooks/rvm_wrapper' 11 | end 12 | -------------------------------------------------------------------------------- /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 | ## Unreleased 9 | 10 | ## 2.0.7 - *2024-11-18* 11 | 12 | Standardise files with files in sous-chefs/repo-management 13 | 14 | Standardise files with files in sous-chefs/repo-management 15 | 16 | Standardise files with files in sous-chefs/repo-management 17 | 18 | Standardise files with files in sous-chefs/repo-management 19 | 20 | Standardise files with files in sous-chefs/repo-management 21 | 22 | ## 2.0.6 - *2024-05-02* 23 | 24 | ## 2.0.5 - *2024-05-02* 25 | 26 | ## 2.0.4 - *2023-09-29* 27 | 28 | ## 2.0.3 - *2023-09-04* 29 | 30 | ## 2.0.2 - *2023-09-04* 31 | 32 | ## 2.0.1 - *2023-05-16* 33 | 34 | ## 2.0.0 - *2023-04-17* 35 | 36 | - Standardise files with files in sous-chefs/repo-management 37 | - Require Chef 15.3 38 | 39 | ## 1.1.13 - *2023-04-04* 40 | 41 | Standardise files with files in sous-chefs/repo-management 42 | 43 | ## 1.1.12 - *2023-04-01* 44 | 45 | ## 1.1.11 - *2023-04-01* 46 | 47 | ## 1.1.10 - *2023-04-01* 48 | 49 | Standardise files with files in sous-chefs/repo-management 50 | 51 | ## 1.1.9 - *2023-03-15* 52 | 53 | Standardise files with files in sous-chefs/repo-management 54 | 55 | Standardise files with files in sous-chefs/repo-management 56 | 57 | Standardise files with files in sous-chefs/repo-management 58 | 59 | Standardise files with files in sous-chefs/repo-management 60 | 61 | ## 1.1.8 - *2023-02-18* 62 | 63 | Standardise files with files in sous-chefs/repo-management 64 | 65 | ## 1.1.7 - *2023-02-16* 66 | 67 | Standardise files with files in sous-chefs/repo-management 68 | 69 | ## 1.1.6 - *2023-02-15* 70 | 71 | ## 1.1.5 - *2023-02-15* 72 | 73 | Standardise files with files in sous-chefs/repo-management 74 | 75 | ## 1.1.4 - *2022-12-08* 76 | 77 | Standardise files with files in sous-chefs/repo-management 78 | 79 | ## 1.1.3 - *2022-04-20* 80 | 81 | Standardise files with files in sous-chefs/repo-management 82 | 83 | ## 1.1.2 - *2022-02-17* 84 | 85 | - Standardise files with files in sous-chefs/repo-management 86 | - Update tested platforms 87 | 88 | ## 1.1.1 - *2022-02-08* 89 | 90 | - Remove delivery folder 91 | 92 | ## 1.1.0 - *2022-01-18* 93 | 94 | - resolved cookstyle error: libraries/provider_rvm_ruby.rb:13:11 refactor: `Chef/RedundantCode/UseCreateIfMissing` 95 | 96 | ## 1.0.1 - *2021-08-30* 97 | 98 | - Standardise files with files in sous-chefs/repo-management 99 | 100 | ## 1.0.0 (2020-09-16) 101 | 102 | - resolved cookstyle error: attributes/default.rb:70:18 refactor: `ChefCorrectness/InvalidPlatformInCase` 103 | - resolved cookstyle error: recipes/user_install.rb:29:48 convention: `Layout/TrailingWhitespace` 104 | - resolved cookstyle error: recipes/user_install.rb:29:49 refactor: `ChefModernize/FoodcriticComments` 105 | - resolved cookstyle error: libraries/provider_rvm_ruby.rb:6:7 refactor: `ChefModernize/RespondToProvides` 106 | 107 | ### Breaking Changes 108 | 109 | - Re-factored the libraries and shell wrappers to more of an [LWRP][] ([@fnichol][]) 110 | 111 | ### Improvements 112 | 113 | - Updated default ruby to 1.9.3-p547 ([@martinisoft][]) 114 | - Added a repository Code of Conduct (See CODE\_OF\_CONDUCT.md) ([@martinisoft][]) 115 | 116 | ### Documentation 117 | 118 | - Pull request [#246](https://github.com/sous-chefs/chef-rvm/pull/246): Updated README.md documenting use with librarian-chef ([@ncreuschling][]) 119 | - Update URLs to point to sous-chefs GitHub org 120 | - Update the maintainer to be Sous Chefs 121 | 122 | ### Bug Fixes 123 | 124 | - Pull request [#285](https://github.com/sous-chefs/chef-rvm/pull/285): Use GPG for rvm verification. ([@lukeasrodgers][]) 125 | - Pull request [#284](https://github.com/sous-chefs/chef-rvm/pull/284): Use full class name for rvm_environment resource usage inside Chef::Provider::Package:RVMRubygems class. ([@nomadium][]) 126 | - Pull request [#300](https://github.com/sous-chefs/chef-rvm/pull/300): Ability to configure key server and home did for rvm gpg_key ([@lesniakania][]) 127 | - Pull request [#298](https://github.com/sous-chefs/chef-rvm/pull/298): Add GPG check for user installs ([@cmluciano][]) 128 | - Pull request [#325](https://github.com/sous-chefs/chef-rvm/pull/325): Fix ruby block to align with new style ([@cmluciano][]) 129 | - Remove unnecessary actions method in the rvm_ruby resource 130 | - Remove deprecated `ChefSpec::Coverage.report!` ChefSpec report 131 | 132 | ## 0.9.2 (March 31, 2014) 133 | 134 | ### Bug fixes 135 | 136 | - Pull request [#137](https://github.com/sous-chefs/chef-rvm/pull/137): Fix patch attribute support in rvm\_ruby. ([@mariussturm][]) 137 | - Pull request [#140](https://github.com/sous-chefs/chef-rvm/pull/140): Update MRI package requirements for scientific-6 platforms. ([@aaronjensen][]) 138 | - Pull request [#134](https://github.com/sous-chefs/chef-rvm/pull/134): Fix vagrant\_ruby default location on modern vagrant baseboxes. ([@mveytsman][]) 139 | - Pull request [#129](https://github.com/sous-chefs/chef-rvm/pull/129): Fix broken example in README. ([@zacharydanger][]) 140 | - Pull request [#188](https://github.com/sous-chefs/chef-rvm/pull/188): Added missing dependencies. ([@fmfdias][]) 141 | - Pull request [#151](https://github.com/sous-chefs/chef-rvm/pull/151): Add Berkshelf installation instructions. ([@justincampbell][]) 142 | - Pull request [#128](https://github.com/sous-chefs/chef-rvm/pull/128): Allow for universal rvmrc settings to be used in the user\_install. ([@firebelly][]) 143 | - Pull request [#204](https://github.com/sous-chefs/chef-rvm/pull/204): Minor spelling mistake ([@dosire][]) 144 | - Pull request [#183](https://github.com/sous-chefs/chef-rvm/pull/183): Only log install when it actually happens ([@zsol][]) 145 | 146 | ### New features 147 | 148 | - Pull request [#100](https://github.com/sous-chefs/chef-rvm/pull/100): Add rubygems\_version attribute to rvm\_ruby resource. ([@cgriego][]) 149 | - Pull request [#125](https://github.com/sous-chefs/chef-rvm/pull/125): Omnibus support (via chef\_gem). ([@gondoi][], [@cgriego][], [@jblatt-verticloud][], [@jschneiderhan][]) 150 | - Set name attribute in metadata.rb, which may help certain LWRP auto-naming issues when directory name does not match 'rvm' (FC045). ([@fnichol][]) 151 | 152 | ### Improvements 153 | 154 | - Refactor foodcritic setup. ([@fnichol][]) 155 | - Now suggests the [homebrew](http://community.opscode.com/cookbooks/homebrew) cookbook ([@martinisoft][]) 156 | 157 | ## 0.9.0 (May 15, 2012) 158 | 159 | ### RVM API tracking updates 160 | 161 | - Drop rake 0.9.2 from default global gems to match upstream default. ([@fnichol][]) 162 | - Use RVM stable (stable/head) by default. ([@fnichol][]) 163 | - Pull request [#84](https://github.com/sous-chefs/chef-rvm/pull/84): Add stable support to installer. ([@xdissent][]) 164 | - Pull request [#102](https://github.com/sous-chefs/chef-rvm/pull/102): Switch URLs to rvm.io and add "rvm get stable". ([@mpapis][]) 165 | 166 | ### Bug fixes 167 | 168 | - Pull request [#64](https://github.com/sous-chefs/chef-rvm/pull/64): Fix check for rvm in user install. ([@dokipen][]) 169 | - Issue [#61](https://github.com/sous-chefs/chef-rvm/issues/61): Include Chef::RVM::StringHelpers to provide select_ruby function. ([@jheth][]) 170 | - Pull request [#94](https://github.com/sous-chefs/chef-rvm/pull/94): Prevent rvm from reinstalling each chef run. ([@xdissent][]) 171 | - Pull request [#66](https://github.com/sous-chefs/chef-rvm/pull/66): Fixing NoMethodError when using system wide rvm and the gem_package resource. ([@kristopher][]) 172 | - Pull request [#95](https://github.com/sous-chefs/chef-rvm/pull/95): Fix missing `patch` resource attributes. ([@xdissent][]) 173 | - Pull request [#96](https://github.com/sous-chefs/chef-rvm/pull/96): Fix wrapper paths, now works for both system and user installs. ([@xdissent][]) 174 | - LWRPs now notify when updated (FC017). ([@fnichol][]) 175 | - Node attribute access style (FC019). ([@fnichol][]) 176 | - FC023: Prefer conditional attributes. ([@fnichol][]) 177 | 178 | ### New features 179 | 180 | - Update default Ruby to ruby-1.9.3-p194 (it's time). ([@fnichol][]) 181 | - Pull request [#86](https://github.com/sous-chefs/chef-rvm/pull/76): Add patch attribute to rvm_ruby. ([@smdern][]) 182 | - Pull request [#76](https://github.com/sous-chefs/chef-rvm/pull/76): Add wrapper for chef-client. ([@bryanstearns][]) 183 | 184 | ### Improvements 185 | 186 | - Add TravisCI support for Foodcritic. ([@fnichol][]) 187 | - Large formatting updates to README. ([@fnichol][]) 188 | - Add gh-pages branch for sectioned README at . ([@fnichol][]) 189 | - Issue [#98](https://github.com/sous-chefs/chef-rvm/issues/98): Support installs of x.y.z versions & more permissive upgrade options. ([@fnichol][]) 190 | - Now rvm\_global\_gem respects version attr in global.gems file. ([@fnichol][]) 191 | - Pull request [#88](https://github.com/sous-chefs/chef-rvm/pull/88): Mac OS X Server support. ([@rhenning][]) 192 | - Pull request [#90](https://github.com/sous-chefs/chef-rvm/pull/90): Scientific Linux support. ([@TrevorBramble][]) 193 | 194 | ## 0.8.6 (November 28, 2011) 195 | 196 | ### RVM API tracking updates 197 | 198 | - Issue [#56](https://github.com/sous-chefs/chef-rvm/issues/56): Ensure that RVM version strings can be converted to RubyGems format. ([@fnichol][]) 199 | - Issue [#53](https://github.com/sous-chefs/chef-rvm/issues/53): Update rvm/installer\_url default to latest URL. ([@fnichol][]) 200 | 201 | ### Bug fixes 202 | 203 | - Issue [#54](https://github.com/sous-chefs/chef-rvm/issues/54), Pull request [#55](https://github.com/sous-chefs/chef-rvm/pull/55): Fix if statement typo in `RVM::RubyGems::Package`. ([@bradphelan][]) 204 | - Pull request [#57](https://github.com/sous-chefs/chef-rvm/pull/57): Fix typo in `RVM::RubyGems::Package`. ([@bradphelan][]) 205 | 206 | ### Improvements 207 | 208 | - Add note to README warning that chef 0.8.x will not work. ([@fnichol][]) 209 | - Issue [#48](https://github.com/sous-chefs/chef-rvm/issues/48): Add example of local gem source installation in README. ([@fnichol][]) 210 | 211 | ## 0.8.4 (October 16, 2011) 212 | 213 | ### RVM API tracking updates 214 | 215 | - Issue [#43](https://github.com/sous-chefs/chef-rvm/issues/43), Pull request [#46](https://github.com/sous-chefs/chef-rvm/pull/46): Make explicit use of `exec` for RVM versions older than 1.8.6 and `do` for newer versions. ([@ryansch][], [@fnichol][]) 216 | 217 | ### Bug fixes 218 | 219 | - Pull request [#39](https://github.com/sous-chefs/chef-rvm/pull/39): Fix rvm_ruby provider on Ubuntu/Debian when installing JRuby. ([@exempla][]) 220 | - Issues [#38](https://github.com/sous-chefs/chef-rvm/issues/38), [#42](https://github.com/sous-chefs/chef-rvm/issues/42): Update user_installs attribute to be an array of hashes in README. ([@fnichol][]) 221 | 222 | ### New features 223 | 224 | - Pull request [#47](https://github.com/sous-chefs/chef-rvm/pull/47): Handle installing a gem from a local file. ([@ryansch][]) 225 | 226 | ### Improvements 227 | 228 | - Pull request [#44](https://github.com/sous-chefs/chef-rvm/pull/44): Add Amazon's Linux AMI support. ([@adrianpike][]) 229 | 230 | ## 0.8.2 (August 24, 2011) 231 | 232 | ### Bug fixes 233 | 234 | - Ensure Ruby/gemset is installed in rvm_shell provider. ([@fnichol][]) 235 | - Issue [#35](https://github.com/sous-chefs/chef-rvm/issues/35): Detect if user has RVM installed in rvm_shell provider. ([@fnichol][]) 236 | 237 | ### Improvements 238 | 239 | - Array-ize node['rvm']['user_installs']. ([@fnichol][]) 240 | 241 | ## 0.8.0 (August 22, 2011) 242 | 243 | ### Bug fixes 244 | 245 | - Pull request [#22](https://github.com/sous-chefs/chef-rvm/pull/22): Expand list of sane rubies to include `"ree"` and `"kiji"`. ([@juzzin][]) 246 | - Pull request [#26](https://github.com/sous-chefs/chef-rvm/pull/26): RVM is installed in compilation phase when gem_package recipe is included. ([@temujin9][], [@fnichol][]) 247 | - Update rvm/vagrant/system_chef_solo default attribute value to match newest Vagrant lucid32 basebox. ([@fnichol][]) 248 | - Pull request [#27](https://github.com/sous-chefs/chef-rvm/pull/27): Explicitly handle the unmanaged 'system' ruby. ([@temujin9][]). 249 | - Pull request [#28](https://github.com/sous-chefs/chef-rvm/pull/28): Fix bug when no RVM rubies had yet been installed. ([@relistan][]). 250 | - Pull request [#30](https://github.com/sous-chefs/chef-rvm/pull/30): Implement 'group_users' support. ([@phlipper][]). 251 | - Update ruby compilation dependencies for debian/ubuntu. ([@fnichol][]) 252 | 253 | ### New features 254 | 255 | - Issue [#4](https://github.com/sous-chefs/chef-rvm/issues/4): Per-user RVM installs with support in all LWRPs. ([@fnichol][]) 256 | - Refactor system and user installs into: system_install, system, user_install, user ([reference](https://github.com/sous-chefs/chef-rvm/commit/69027cafbe8e25251a797f1dcf11e5bc4c96275b)). ([@fnichol][]) 257 | - Support Mac OS X platform for system-wide and per-user installs. ([@fnichol][]) 258 | - Issue [#23](https://github.com/sous-chefs/chef-rvm/issues/24): Let gem_package resource target multiple RVM rubies. ([@fnichol][]) 259 | - Pull request [#26](https://github.com/sous-chefs/chef-rvm/pull/26): Add new attribute `group_id`. ([@temujin9][]) 260 | - General refactoring and re-modularizing. ([@fnichol][]) 261 | 262 | ### Improvements 263 | 264 | - Pull request [#26](https://github.com/sous-chefs/chef-rvm/pull/26): RVM unix group is created in compilation phase if GID is provided. ([@temujin9][]) 265 | - Revamp CHANGELOG in the style of [guard](https://github.com/guard/guard). ([@fnichol][]) 266 | - Pull request [#27](https://github.com/sous-chefs/chef-rvm/pull/27): Improve gem_package logging message to include full list of selected rubies. ([@temujin9][]) 267 | - RVM gem installed using opscode cookbook conventions (via gem_package). ([@fnichol][]) 268 | - Add RVM::Shell::ChefWrapper based on chef's popen4 impl. ([@fnichol][]) 269 | - Create RVM::ChefUserEnvironment which can be injected with a user. ([@fnichol][]) 270 | - Normalize 'missing gem' logging notices. ([@fnichol][]) 271 | - Add Chef::RVM::StringCache to get and cache canonical RVM strings. ([@fnichol][]) 272 | - Modularize `libraries/helpers.rb` in modules. ([@fnichol][]) 273 | - Issue [#25](https://github.com/sous-chefs/chef-rvm/issues/25): Add installation options/instructions to README. ([@fnichol][]) 274 | 275 | ## 0.7.1 (May 15, 2011) 276 | 277 | ### Bug fixes 278 | 279 | - Issue [#20](https://github.com/sous-chefs/chef-rvm/issues/20): Update metadata.rb to not include README.md (too long). ([@fnichol][]) 280 | 281 | ### New features 282 | 283 | - Add Rakefile for opscode platform deploy builds. ([@fnichol][]) 284 | 285 | ### Improvements 286 | 287 | - Update metadata.rb properties. ([@fnichol][]) 288 | 289 | ## 0.7.0 (May 14, 2011) 290 | 291 | ### Bug fixes 292 | 293 | - Issue [#20](https://github.com/sous-chefs/chef-rvm/issues/20): Update rvm/install_rubies attr to "true"/"false". ([@fnichol][]) 294 | - Issue [#14](https://github.com/sous-chefs/chef-rvm/issues/14): Allow no default RVM ruby (i.e. use system ruby). ([@fnichol][]) 295 | - Issue [#12](https://github.com/sous-chefs/chef-rvm/issues/12): Update RVM install to use SSL URL. ([@fnichol][]) 296 | - Now /etc/rvmrc has export for rvm/rvmrc key/value pairs. ([@fnichol][]) 297 | 298 | ### New features 299 | 300 | - Issue [#13](https://github.com/sous-chefs/chef-rvm/issues/13): Speed up install by disabling RDOC generation. ([@fnichol][]) 301 | - New experimental recipe gem_package which patches gem_package resource. ([@fnichol][]) 302 | - Add rvm_global_gem resource. ([@fnichol][]) 303 | 304 | ### Improvements 305 | 306 | - Issue [#3](https://github.com/sous-chefs/chef-rvm/issues/3): Revamp and update README.md. ([@fnichol][]) 307 | - Issue [#3](https://github.com/sous-chefs/chef-rvm/issues/5): Add CHANGELOG.md. ([@fnichol][]) 308 | - Issue [#19](https://github.com/sous-chefs/chef-rvm/issues/19): Attr rvm/upgrade accepts "none", false and nil as same value. ([@fnichol][]) 309 | - Update rvm/skip_docs_on_install attr to rvm/rvm_gem_options. ([@fnichol][]) 310 | - Refactor of rvm_gem provider to leverage Chef::Provider::Package::Rubygems. ([@fnichol][]) 311 | 312 | ## Previous releases 313 | 314 | The changelog began with version 0.6.0 so any changes prior to that can be 315 | seen by checking the tagged releases and reading git commit messages. 316 | 317 | [LWRP]: https://docs.getchef.com/lwrp.html 318 | [@aaronjensen]: https://github.com/aaronjensen 319 | [@adrianpike]: https://github.com/adrianpike 320 | [@bradphelan]: https://github.com/bradphelan 321 | [@bryanstearns]: https://github.com/bryanstearns 322 | [@cgriego]: https://github.com/cgriego 323 | [@dokipen]: https://github.com/dokipen 324 | [@exempla]: https://github.com/exempla 325 | [@fnichol]: https://github.com/sous-chefs 326 | [@gondoi]: https://github.com/gondoi 327 | [@jblatt-verticloud]: https://github.com/jblatt-verticloud 328 | [@jheth]: https://github.com/jheth 329 | [@jschneiderhan]: https://github.com/jschneiderhan 330 | [@juzzin]: https://github.com/juzzin 331 | [@kristopher]: https://github.com/kristopher 332 | [@mariussturm]: https://github.com/mariussturm 333 | [@mpapis]: https://github.com/mpapis 334 | [@mveytsman]: https://github.com/mveytsman 335 | [@phlipper]: https://github.com/phlipper 336 | [@relistan]: https://github.com/relistan 337 | [@rhenning]: https://github.com/rhenning 338 | [@ryansch]: https://github.com/ryansch 339 | [@smdern]: https://github.com/smdern 340 | [@temujin9]: https://github.com/temujin9 341 | [@TrevorBramble]: https://github.com/TrevorBramble 342 | [@xdissent]: https://github.com/xdissent 343 | [@zacharydanger]: https://github.com/zacharydanger 344 | [@fmfdias]: https://github.com/fmfdias 345 | [@justincampbell]: https://github.com/justincampbell 346 | [@firebelly]: https://github.com/firebelly 347 | [@martinisoft]: https://github.com/sous-chefs 348 | [@dosire]: https://github.com/dosire 349 | [@zsol]: https://github.com/zsol 350 | [@ncreuschling]: https://github.com/ncreuschling 351 | [@lukeasrodgers]: https://github.com/lukeasrodgers 352 | [@nomadium]: https://github.com/nomadium 353 | [@lesniakania]: https://github.com/lesniakania 354 | [@cmluciano]: https://github.com/cmluciano 355 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Guidelines 2 | 3 | This project follows the Chef Community Guidelines 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | guard :rspec, cmd: 'bundle exec rspec' do 2 | watch(%r{^spec/.+_spec\.rb$}) 3 | watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/recipes/#{m[1]}_spec.rb" } 4 | watch(%r{^(libraries)/(.+)\.rb$}) { |m| "spec/libraries/#{m[1]}_spec.rb" } 5 | watch('spec/spec_helper.rb') { 'spec' } 6 | end 7 | 8 | guard :foodcritic, cli: "-X 'test/**/*' -X 'spec/**/*'", cookbook_paths: '.' do 9 | watch(%r{^attributes/.+\.rb$}) 10 | watch(%r{^libraries/.+\.rb$}) 11 | watch(%r{^recipes/.+\.rb$}) 12 | watch('metadata.rb') 13 | end 14 | -------------------------------------------------------------------------------- /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 2010-2017 Aaron Kalin 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RVM 2 | 3 | chef-rvm [![Build Status](https://secure.travis-ci.org/martinisoft/chef-rvm.png?branch=master)](http://travis-ci.org/martinisoft/chef-rvm) 4 | 5 | **WARNING** - Please read! 6 | 7 | There is currently a _major_ rewrite going on with this cookbook to simplify 8 | the interface to RVM with Chef. Expect the master branch to be very broken 9 | until there is a 1.0 release. All previous pull requests will need to rebase 10 | to the newer master to contribute to the newly re-factored resources. 11 | 12 | ## Description 13 | 14 | Manages system-wide and per-user [RVM][rvm]s and manages installed Rubies. 15 | Several resources are defined to accomplish these tasks. 16 | 17 | ## Requirements 18 | 19 | ### Chef 20 | 21 | Tested on 12.5.1 but older versions of chef may not work due to the changes 22 | in the resource model. You are welcome to submit a pull request to add this 23 | support. 24 | 25 | File an [issue][issues] if this isn't the case. 26 | 27 | ### Platform 28 | 29 | The following platforms have been tested with this cookbook, meaning that 30 | the recipes and LWRPs run on these platforms without error: 31 | 32 | * ubuntu (12.04 and higher) 33 | * debian (6.0 and newer) 34 | * mac_os_x (10.6/10.7) (See [Platform Notes](#platform-notes-osx)) 35 | * mac_os_x_server (See [Platform Notes](#platform-notes-osx)) 36 | * suse (openSUSE, SLES) 37 | * centos 38 | * amazon (2011.09) 39 | * scientific 40 | * redhat 41 | * fedora 42 | * gentoo 43 | 44 | Please [report][issues] any additional platforms so they can be added. 45 | 46 | ### Platform Notes 47 | 48 | #### OSX 49 | 50 | This cookbook suggests the [homebrew](http://community.opscode.com/cookbooks/homebrew) cookbook, which is needed to install 51 | any additional packages needed to compile ruby. RVM now ships binary rubies, 52 | but will require homebrew to install any additional libraries. 53 | 54 | ### Cookbooks 55 | 56 | If you are installing [JRuby][jruby] then a Java runtime will need to be 57 | installed. The Opscode [java cookbook][java_cb] can be used on supported 58 | platforms. 59 | 60 | ## Installation 61 | 62 | Depending on the situation and use case there are several ways to install 63 | this cookbook. All the methods listed below assume a tagged version release 64 | is the target, but omit the tags to get the head of development. A valid 65 | Chef repository structure like the [Opscode repo][chef_repo] is also assumed. 66 | 67 | ### Using Berkshelf 68 | 69 | [Berkshelf][berkshelf] is a way to manage a cookbook or an application's 70 | cookbook dependencies. Include the cookbook in your Berksfile, and then run 71 | `berks install`. To install using Berkshelf: 72 | 73 | ```shell 74 | gem install berkshelf 75 | cd chef-repo 76 | berks init 77 | echo "cookbook 'rvm', github: 'fnichol/chef-rvm'" >> Berksfile 78 | berks install 79 | ``` 80 | 81 | ### Using Librarian-Chef 82 | 83 | [Librarian-Chef][librarian] is a bundler for your Chef cookbooks. 84 | Include a reference to the cookbook in a [Cheffile][cheffile] and run 85 | `librarian-chef install`. To install Librarian-Chef: 86 | 87 | ```shell 88 | gem install librarian-chef 89 | cd chef-repo 90 | librarian-chef init 91 | cat >> Cheffile < 'git://github.com/fnichol/chef-rvm.git', :ref => 'v0.10.1' 94 | END_OF_CHEFFILE 95 | librarian-chef install 96 | ``` 97 | 98 | ## Recipes 99 | 100 | ### default 101 | 102 | Installs the RVM gem and initializes Chef to use the Resources in this cookbook 103 | for installing and managing RVM. 104 | 105 | ## Contributing 106 | 107 | See the CONTRIBUTING.md file 108 | 109 | ### Testing 110 | 111 | Make sure you have the following requirements setup: 112 | 113 | * [Vagrant][vagrant] 114 | * [vagrant-berkshelf][vagrant-berkshelf] 115 | 116 | After you `bundle install` run `rake` for unit tests and `kitchen test` for 117 | integration level tests. 118 | 119 | ## License and Authors 120 | 121 | Authors:: [Aaron Kalin][martinisoft] () 122 | 123 | Contributors:: 124 | 125 | Copyright:: 2010 - 2017, Aaron Kalin 126 | 127 | Licensed under the Apache License, Version 2.0 (the "License"); 128 | you may not use this file except in compliance with the License. 129 | You may obtain a copy of the License at 130 | 131 | 132 | 133 | Unless required by applicable law or agreed to in writing, software 134 | distributed under the License is distributed on an "AS IS" BASIS, 135 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136 | See the License for the specific language governing permissions and 137 | limitations under the License. 138 | 139 | [berkshelf]: http://berkshelf.com 140 | [chef_repo]: https://github.com/chef/chef 141 | [cheffile]: https://github.com/applicationsonline/librarian/blob/master/lib/librarian/chef/templates/Cheffile 142 | [martinisoft]: https://github.com/martinisoft 143 | [java_cb]: http://supermarket.chef.io/cookbooks/java 144 | [jruby]: http://jruby.org/ 145 | [librarian]: https://github.com/applicationsonline/librarian#readme 146 | [rvm]: https://rvm.io 147 | [vagrant]: http://vagrantup.com 148 | [vagrant-berkshelf]: https://github.com/berkshelf/vagrant-berkshelf 149 | 150 | [issues]: https://github.com/sous-chefs/chef-rvm/issues 151 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /attributes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/rvm/822fecc980dc2a24651cd400a69d58ca6d0a2ab0/attributes/.gitkeep -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Attributes:: default 4 | # 5 | # Author:: Fletcher Nichol 6 | # 7 | # Copyright:: 2010, 2011, 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 | # ruby that will get installed and set to `rvm use default`. 23 | default['rvm']['default_ruby'] = 'ruby-1.9.3-p547' 24 | default['rvm']['user_default_ruby'] = 'ruby-1.9.3-p547' 25 | 26 | # list of additional rubies that will be installed 27 | default['rvm']['rubies'] = [] 28 | default['rvm']['user_rubies'] = [] 29 | 30 | # list of gems to be installed in global gemset of all rubies 31 | global_gems = [ 32 | { 'name' => 'bundler' }, 33 | ] 34 | default['rvm']['global_gems'] = global_gems.dup 35 | default['rvm']['user_global_gems'] = global_gems.dup 36 | 37 | # hash of gemsets and their list of additional gems to be installed. 38 | default['rvm']['gems'] = {} 39 | default['rvm']['user_gems'] = {} 40 | 41 | # hash of rvmrc options 42 | default['rvm']['rvmrc_env'] = { 'rvm_gem_options' => '--no-ri --no-rdoc' } 43 | 44 | # a hash of user hashes, each an isolated per-user RVM installation 45 | default['rvm']['installs'] = {} 46 | 47 | # system-wide installer options 48 | default['rvm']['installer_url'] = 'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer' 49 | default['rvm']['version'] = 'stable' 50 | 51 | # GPG key for rvm verification 52 | default['rvm']['gpg_key'] = 'D39DC0E3' 53 | default['rvm']['gpg_key_server'] = 'hkp://keys.gnupg.net' 54 | 55 | # Autolib mode, see https://rvm.io/rvm/autolibs 56 | default['rvm']['autolib_mode'] = 3 57 | 58 | # extra system-wide tunables 59 | default['rvm']['root_path'] = '/usr/local/rvm' 60 | default['rvm']['group_id'] = 'default' 61 | default['rvm']['group_users'] = [] 62 | 63 | case node['platform'] 64 | when 'redhat', 'centos', 'fedora', 'scientific', 'amazon', 'oracle' 65 | node.override['rvm']['install_pkgs'] = %w(sed grep tar gzip bzip2 bash curl git) 66 | when 'debian', 'ubuntu', 'suse' 67 | node.override['rvm']['install_pkgs'] = %w(sed grep tar gzip bzip2 bash curl git-core) 68 | when 'gentoo' 69 | node.override['rvm']['install_pkgs'] = %w(git) 70 | when 'mac_os_x' 71 | node.override['rvm']['install_pkgs'] = %w(git) 72 | end 73 | -------------------------------------------------------------------------------- /attributes/gem_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Attributes:: gem_package 4 | # 5 | # Author:: Fletcher Nichol 6 | # 7 | # Copyright:: 2010, 2011, 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 | # rvm ruby that will be used for gem_package resources 23 | default['rvm']['gem_package']['rvm_string'] = node['rvm']['default_ruby'] 24 | -------------------------------------------------------------------------------- /attributes/vagrant.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Attributes:: vagrant 4 | # 5 | # Author:: Fletcher Nichol 6 | # 7 | # Copyright:: 2010, 2011, 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 | default['rvm']['vagrant']['system_chef_client'] = '/opt/vagrant_ruby/bin/chef-client' 23 | default['rvm']['vagrant']['system_chef_solo'] = '/opt/vagrant_ruby/bin/chef-solo' 24 | -------------------------------------------------------------------------------- /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/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/rvm/822fecc980dc2a24651cd400a69d58ca6d0a2ab0/documentation/.gitkeep -------------------------------------------------------------------------------- /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-11 41 | driver: 42 | image: dokken/debian-11 43 | pid_one_command: /bin/systemd 44 | 45 | - name: debian-12 46 | driver: 47 | image: dokken/debian-12 48 | pid_one_command: /bin/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: ubuntu-20.04 81 | driver: 82 | image: dokken/ubuntu-20.04 83 | pid_one_command: /bin/systemd 84 | 85 | - name: ubuntu-22.04 86 | driver: 87 | image: dokken/ubuntu-22.04 88 | pid_one_command: /bin/systemd 89 | 90 | - name: ubuntu-24.04 91 | driver: 92 | image: dokken/ubuntu-24.04 93 | pid_one_command: /bin/systemd 94 | -------------------------------------------------------------------------------- /kitchen.exec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: { name: exec } 3 | transport: { name: exec } 4 | 5 | platforms: 6 | - name: macos-latest 7 | - name: windows-latest 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver_plugin: vagrant 3 | driver_config: 4 | require_chef_omnibus: true 5 | platforms: 6 | - 7 | name: ubuntu-14.04 8 | run_list: 9 | - 'recipe[apt]' 10 | - 11 | name: ubuntu-12.04 12 | run_list: 13 | - 'recipe[apt]' 14 | - 15 | name: ubuntu-10.04 16 | run_list: 17 | - 'recipe[apt]' 18 | - 19 | name: debian-7.6 20 | - 21 | name: centos-6.4 22 | suites: 23 | - 24 | name: stock_system_and_user 25 | run_list: 26 | - 'recipe[user::data_bag]' 27 | - 'recipe[rvm::system]' 28 | - 'recipe[rvm::user]' 29 | attributes: 30 | users: [wigglebottom] 31 | rvm: {user_installs: [{user: wigglebottom, default_ruby: 2.1.5}]} 32 | - 33 | name: rubies 34 | run_list: 35 | - 'recipe[java]' 36 | - 'recipe[rvm::system]' 37 | attributes: 38 | rvm: {default_ruby: system, rubies: [2.1.5, jruby, ree]} 39 | - 40 | name: rbx 41 | run_list: 42 | - 'recipe[rvm::system]' 43 | attributes: 44 | rvm: {default_ruby: rbx} 45 | - 46 | name: installs 47 | run_list: 48 | - 'recipe[user::data_bag]' 49 | - 'recipe[rvm::user_install]' 50 | attributes: 51 | users: [virgil1, virgil2] 52 | rvm: {installs: {virgil1: {installer_flags: '--version 1.19.6'}, virgil2: {installer_flags: '--version 1.21.20'}}} # yamllint disable-line 53 | -------------------------------------------------------------------------------- /libraries/provider_rvm_ruby.rb: -------------------------------------------------------------------------------- 1 | require 'chef/provider/lwrp_base' 2 | 3 | class Chef 4 | class Provider 5 | class RvmRuby < Chef::Provider::LWRPBase 6 | provides :rvm_ruby 7 | 8 | action :install do 9 | remote_file 'rvm_installer' do 10 | path "#{Chef::Config[:file_cache_path]}/rvm_installer.sh" 11 | source node['rvm']['installer_url'] 12 | mode '755' 13 | action :create_if_missing 14 | end 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /libraries/resource_rvm_ruby.rb: -------------------------------------------------------------------------------- 1 | require 'chef/resource/lwrp_base' 2 | 3 | class Chef 4 | class Resource 5 | class RvmRuby < Chef::Resource::LWRPBase 6 | provides :rvm_ruby 7 | 8 | self.resource_name = :rvm_ruby 9 | default_action :install 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'rvm' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'Manages system-wide and per-user RVMs and manages installed Rubies via Chef Resources.' 6 | version '2.0.7' 7 | source_url 'https://github.com/sous-chefs/rvm' 8 | issues_url 'https://github.com/sous-chefs/rvm/issues' 9 | 10 | chef_version '>= 15.3' 11 | 12 | supports 'amazon' 13 | supports 'centos' 14 | supports 'debian' 15 | supports 'fedora' 16 | supports 'oracle' 17 | supports 'redhat' 18 | supports 'scientific' 19 | supports 'ubuntu' 20 | -------------------------------------------------------------------------------- /recipes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/rvm/822fecc980dc2a24651cd400a69d58ca6d0a2ab0/recipes/.gitkeep -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: default 4 | # 5 | # Copyright:: 2010, 2011, Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | # install rvm api gem during chef compile phase 21 | chef_gem 'rvm' do 22 | action :install 23 | version '>= 1.11.3.6' 24 | end 25 | require 'rvm' 26 | 27 | create_rvm_shell_chef_wrapper 28 | create_rvm_chef_user_environment 29 | 30 | class Chef::Resource 31 | # mix in #rvm_cmd_wrap helper into resources 32 | include Chef::RVM::ShellHelpers 33 | end 34 | 35 | class Chef::Recipe 36 | # mix in recipe helpers 37 | include Chef::RVM::ShellHelpers 38 | include Chef::RVM::RecipeHelpers 39 | include Chef::RVM::StringHelpers 40 | end 41 | -------------------------------------------------------------------------------- /recipes/gem_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: gem_package 4 | # 5 | # Copyright:: 2011, Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | node_val = node['rvm']['gem_package']['rvm_string'] 21 | case node_val 22 | when String 23 | rvm_descriptor = node_val + ' RVM Ruby' 24 | when Array 25 | last = node_val.pop 26 | rvm_descriptor = [ node_val.join(', '), last ].join(' & ') + ' RVM Rubies' 27 | end 28 | 29 | patch_gem_package 30 | 31 | ::Chef::Log.info 'gem_package resource has been patched to use provider ' \ 32 | 'Chef::Provider::Package::RVMRubygems and will install gems to ' \ 33 | "the #{rvm_descriptor}." 34 | -------------------------------------------------------------------------------- /recipes/system.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: system 4 | # 5 | # Copyright:: 2010, 2011 Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe 'rvm::system_install' 21 | 22 | perform_install_rubies = node['rvm']['install_rubies'] == true || 23 | node['rvm']['install_rubies'] == 'true' 24 | 25 | if perform_install_rubies 26 | install_rubies rubies: node['rvm']['rubies'], 27 | default_ruby: node['rvm']['default_ruby'], 28 | global_gems: node['rvm']['global_gems'], 29 | gems: node['rvm']['gems'] 30 | end 31 | 32 | # add users to rvm group 33 | group 'rvm' do 34 | members node['rvm']['group_users'] 35 | 36 | only_if { node['rvm']['group_users'].any? } 37 | end 38 | -------------------------------------------------------------------------------- /recipes/system_install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: system_install 4 | # 5 | # Copyright:: 2010, 2011 Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe 'rvm' 21 | 22 | # Build the rvm group ahead of time, if it is set. This allows avoiding 23 | # collision with later processes which may set a guid explicitly 24 | if node['rvm']['group_id'] != 'default' 25 | g = group 'rvm' do 26 | group_name 'rvm' 27 | gid node['rvm']['group_id'] 28 | action :nothing 29 | end 30 | g.run_action(:create) 31 | end 32 | 33 | key_server = node['rvm']['gpg']['keyserver'] || 'hkp://keys.gnupg.net' 34 | home_dir = "#{node['rvm']['gpg']['homedir'] || '~'}/.gnupg" 35 | 36 | execute 'Adding gpg key' do 37 | command "`which gpg2 || which gpg` --keyserver #{key_server} --homedir #{home_dir} --recv-keys #{node['rvm']['gpg_key']}" 38 | only_if 'which gpg2 || which gpg' 39 | not_if { node['rvm']['gpg_key'].empty? } 40 | end 41 | 42 | rvm_installation('root') 43 | -------------------------------------------------------------------------------- /recipes/user.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: user 4 | # 5 | # Copyright:: 2011 Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe 'rvm::user_install' 21 | 22 | Array(node['rvm']['user_installs']).each do |rvm_user| 23 | perform_install_rubies = rvm_user['install_rubies'] == true || 24 | rvm_user['install_rubies'] == 'true' || 25 | node['rvm']['user_install_rubies'] == true || 26 | node['rvm']['user_install_rubies'] == 'true' 27 | rubies = rvm_user['rubies'] || 28 | node['rvm']['user_rubies'] 29 | default_ruby = rvm_user['default_ruby'] || 30 | node['rvm']['user_default_ruby'] 31 | global_gems = rvm_user['global_gems'] || 32 | node['rvm']['user_global_gems'] 33 | gems = rvm_user['gems'] || 34 | node['rvm']['user_gems'] 35 | 36 | next unless perform_install_rubies 37 | install_rubies rubies: rubies, 38 | default_ruby: default_ruby, 39 | global_gems: global_gems, 40 | gems: gems, 41 | user: rvm_user['user'] 42 | end 43 | -------------------------------------------------------------------------------- /recipes/user_install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: user_install 4 | # 5 | # Copyright:: 2011, 2012, 2013 Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe 'rvm' 21 | 22 | node['rvm']['installs'].each do |user, opts| 23 | # if user hash is falsy (nil, false) then we're not installing 24 | next unless opts 25 | 26 | # if user hash is not a hash (i.e. set to true), init an empty Hash 27 | opts = {} if opts == true 28 | 29 | ruby_block 'Conditionally add RVM gpg key' do 30 | block do 31 | cmd = Mixlib::ShellOut.new('which gpg2 || which gpg') 32 | cmd.run_command 33 | 34 | if cmd.exitstatus == 0 35 | gpg_command = cmd.stdout.chomp 36 | 37 | exec = Chef::Resource::Execute.new 'Add RVM gpg key', run_context 38 | exec.command "#{gpg_command} --keyserver hkp://keys.gnupg.net --recv-keys #{node['rvm']['gpg_key']}" 39 | exec.user user['user'] 40 | exec.environment 'HOME' => user['home'] 41 | exec.guard_interpreter :bash 42 | exec.not_if "#{gpg_command} -k #{node['rvm']['gpg_key']} > /dev/null", user: user['user'], environment: { 'HOME' => user['home'] } 43 | exec.run_action :run 44 | else 45 | Chef::Log.info 'Skipping adding RVM key because gpg/gpg2 not installed' 46 | end 47 | end 48 | end 49 | 50 | rvm_installation(user.to_s) do 51 | %w(installer_url installer_flags install_pkgs rvmrc_template_source 52 | rvmrc_template_cookbook rvmrc_env action 53 | ).each do |attr| 54 | # if user hash attr is set, then set the resource attr 55 | send(attr, opts[attr]) if opts.fetch(attr, false) 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /recipes/vagrant.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: rvm 3 | # Recipe:: vagrant 4 | # 5 | # Copyright:: 2011, Fletcher Nichol 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | template '/usr/local/bin/chef-client' do 21 | source 'vagrant-chef-client-wrapper.erb' 22 | owner 'root' 23 | group 'root' 24 | mode '0755' 25 | end 26 | 27 | template '/usr/local/bin/chef-solo' do 28 | source 'vagrant-chef-solo-wrapper.erb' 29 | owner 'root' 30 | group 'root' 31 | mode '0755' 32 | end 33 | 34 | group 'rvm' do 35 | members ['vagrant'] 36 | append true 37 | end 38 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/libraries/provider_rvm_ruby_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'rvm_ruby' do 4 | let(:rvm_ruby_default) do 5 | ChefSpec::SoloRunner.new( 6 | platform: 'ubuntu', 7 | step_into: ['rvm_ruby'] 8 | ).converge('rvm_wrapper::default') 9 | end 10 | 11 | context 'without rvm installed' do 12 | it 'fetches the latest installer' do 13 | expect(rvm_ruby_default).to create_if_missing_remote_file("#{Chef::Config[:file_cache_path]}/rvm_installer.sh") 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | -------------------------------------------------------------------------------- /templates/default/rvmrc.erb: -------------------------------------------------------------------------------- 1 | # rvm configuration 2 | # 3 | # Generated by Chef for <%= @user %>@<%= node['fqdn'] %> 4 | # Local modifications will be overwritten. 5 | # 6 | <% if @user == "root" -%> 7 | umask u=rwx,g=rwx,o=rx 8 | <% end -%> 9 | export rvm_path="<%= @rvm_path %>" 10 | 11 | <% @rvmrc_env.each_pair do |k,v| -%> 12 | <% next unless v -%> 13 | export <%= k %>="<%= v %>" 14 | <% end -%> 15 | -------------------------------------------------------------------------------- /templates/default/vagrant-chef-client-wrapper.erb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # RVM-aware chef-client wrapper 4 | # 5 | # Generated by Chef for <%= node['fqdn'] %> 6 | # Local modifications will be overridden 7 | 8 | if [[ -d "<%= node['rvm']['root_path'] %>" ]] ; then 9 | export PATH="/bin:<%= node['rvm']['root_path'] %>:$PATH" 10 | rvm_path='<%= node['rvm']['root_path'] %>' 11 | export rvm_path 12 | unset RUBY_VERSION 13 | unset GEM_HOME 14 | unset GEM_PATH 15 | unset MY_RUBY_HOME 16 | unset IRBRC 17 | rvm_ruby_string='system' 18 | export rvm_ruby_string 19 | unset rvm_gemset_name 20 | unset MAGLEV_HOME 21 | fi 22 | 23 | exec <%= node['rvm']['vagrant']['system_chef_client'] %> "$@" 24 | -------------------------------------------------------------------------------- /templates/default/vagrant-chef-solo-wrapper.erb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # RVM-aware chef-solo wrapper 4 | # 5 | # Generated by Chef for <%= node['fqdn'] %> 6 | # Local modifications will be overridden 7 | 8 | if [[ -d "<%= node['rvm']['root_path'] %>" ]] ; then 9 | export PATH="/bin:<%= node['rvm']['root_path'] %>:$PATH" 10 | rvm_path='<%= node['rvm']['root_path'] %>' 11 | export rvm_path 12 | unset RUBY_VERSION 13 | unset GEM_HOME 14 | unset GEM_PATH 15 | unset MY_RUBY_HOME 16 | unset IRBRC 17 | rvm_ruby_string='system' 18 | export rvm_ruby_string 19 | unset rvm_gemset_name 20 | unset MAGLEV_HOME 21 | fi 22 | 23 | exec <%= node['rvm']['vagrant']['system_chef_solo'] %> "$@" 24 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/rvm_wrapper/README.md: -------------------------------------------------------------------------------- 1 | This is a wrapper cookbook meant to test various configurations of chef-rvm 2 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/rvm_wrapper/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'rvm_wrapper' 2 | version '0.0.1' 3 | 4 | depends 'rvm' 5 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/rvm_wrapper/recipes/default.rb: -------------------------------------------------------------------------------- 1 | rvm_ruby '2.3.0' 2 | -------------------------------------------------------------------------------- /test/integration/data_bags/users/virgil1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "virgil1" 3 | } 4 | 5 | -------------------------------------------------------------------------------- /test/integration/data_bags/users/virgil2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "virgil2" 3 | } 4 | 5 | -------------------------------------------------------------------------------- /test/integration/data_bags/users/wigglebottom.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "wigglebottom" 3 | } 4 | -------------------------------------------------------------------------------- /test/integration/stock_system_and_user/minitest/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'mixlib-shellout' 4 | -------------------------------------------------------------------------------- /test/integration/stock_system_and_user/minitest/test_stock_system_and_user.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'minitest/pride' 3 | require 'mixlib/shellout' 4 | 5 | def exec_with_env(cmd, user = 'root') 6 | home_dir = etc_user(user).dir 7 | opts = { 8 | user: user, 9 | group: etc_user(user).gid, 10 | cwd: home_dir, 11 | env: { 'HOME' => home_dir, 12 | 'USER' => user, 13 | 'TERM' => 'dumb' }, 14 | } 15 | exec_cmd = Mixlib::ShellOut.new(cmd.to_s, opts) 16 | exec_cmd.run_command 17 | exec_cmd 18 | end 19 | 20 | def exec_with_rvm(cmd, user = 'root') 21 | exec_with_env(%(#{rvm_path(user)}/bin/rvm #{cmd}), user) 22 | end 23 | 24 | def rvm_path(user = 'root') 25 | if user == 'root' 26 | '/usr/local/rvm' 27 | else 28 | ::File.join(etc_user(user).dir, '.rvm') 29 | end 30 | end 31 | 32 | def etc_user(user = 'root') 33 | Etc.getpwnam(user) 34 | end 35 | 36 | describe 'A system installation' do 37 | it 'creates a system install RVM directory' do 38 | assert File.exist?('/usr/local/rvm') 39 | end 40 | 41 | it 'sources into environment' do 42 | assert_nil exec_with_env("bash -lc 'type rvm 1>/dev/null 2>&1'").error! 43 | end 44 | 45 | it 'installs 2.1.3' do 46 | assert_match(/2\.1\.3/, exec_with_rvm('list strings', 'wigglebottom').stdout) 47 | end 48 | end 49 | --------------------------------------------------------------------------------