from-scratch 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/.chef/knife.rb +6 -0
  3. data/.gitignore +9 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +4 -0
  6. data/Berksfile +17 -0
  7. data/Berksfile.lock +19 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +58 -0
  11. data/Rakefile +6 -0
  12. data/Thorfile +5 -0
  13. data/bin/scratchify +6 -0
  14. data/chefignore +101 -0
  15. data/cookbooks/chef_gem/CHANGELOG.md +24 -0
  16. data/cookbooks/chef_gem/README.md +38 -0
  17. data/cookbooks/chef_gem/libraries/chef_gem.rb +72 -0
  18. data/cookbooks/chef_gem/metadata.json +29 -0
  19. data/cookbooks/chef_gem/recipes/default.rb +0 -0
  20. data/cookbooks/java/.gitignore +21 -0
  21. data/cookbooks/java/.kitchen.docker.yml +15 -0
  22. data/cookbooks/java/.kitchen.yml +126 -0
  23. data/cookbooks/java/.travis.yml +6 -0
  24. data/cookbooks/java/Berksfile +10 -0
  25. data/cookbooks/java/CHANGELOG.md +398 -0
  26. data/cookbooks/java/CONTRIBUTING.md +12 -0
  27. data/cookbooks/java/Gemfile +15 -0
  28. data/cookbooks/java/ISSUES.md +43 -0
  29. data/cookbooks/java/LICENSE +201 -0
  30. data/cookbooks/java/README.md +402 -0
  31. data/cookbooks/java/Rakefile +60 -0
  32. data/cookbooks/java/TESTING.md +41 -0
  33. data/cookbooks/java/attributes/default.rb +146 -0
  34. data/cookbooks/java/libraries/helpers.rb +120 -0
  35. data/cookbooks/java/libraries/matchers.rb +5 -0
  36. data/cookbooks/java/metadata.json +69 -0
  37. data/cookbooks/java/providers/alternatives.rb +94 -0
  38. data/cookbooks/java/providers/ark.rb +255 -0
  39. data/cookbooks/java/recipes/default.rb +22 -0
  40. data/cookbooks/java/recipes/default_java_symlink.rb +19 -0
  41. data/cookbooks/java/recipes/homebrew.rb +3 -0
  42. data/cookbooks/java/recipes/ibm.rb +76 -0
  43. data/cookbooks/java/recipes/ibm_tar.rb +70 -0
  44. data/cookbooks/java/recipes/openjdk.rb +74 -0
  45. data/cookbooks/java/recipes/oracle.rb +74 -0
  46. data/cookbooks/java/recipes/oracle_i386.rb +73 -0
  47. data/cookbooks/java/recipes/oracle_jce.rb +75 -0
  48. data/cookbooks/java/recipes/oracle_rpm.rb +60 -0
  49. data/cookbooks/java/recipes/purge_packages.rb +20 -0
  50. data/cookbooks/java/recipes/set_attributes_from_version.rb +55 -0
  51. data/cookbooks/java/recipes/set_java_home.rb +44 -0
  52. data/cookbooks/java/recipes/windows.rb +82 -0
  53. data/cookbooks/java/resources/alternatives.rb +30 -0
  54. data/cookbooks/java/resources/ark.rb +58 -0
  55. data/cookbooks/java/templates/default/ibm_jdk.installer.properties.erb +3 -0
  56. data/cookbooks/java/templates/default/oracle.jinfo.erb +6 -0
  57. data/cookbooks/rvm/.foodcritic +1 -0
  58. data/cookbooks/rvm/.gitignore +7 -0
  59. data/cookbooks/rvm/.kitchen.yml +66 -0
  60. data/cookbooks/rvm/.travis.yml +9 -0
  61. data/cookbooks/rvm/Berksfile +10 -0
  62. data/cookbooks/rvm/CHANGELOG.md +253 -0
  63. data/cookbooks/rvm/CODE_OF_CONDUCT.md +12 -0
  64. data/cookbooks/rvm/CONTRIBUTING.md +26 -0
  65. data/cookbooks/rvm/Gemfile +20 -0
  66. data/cookbooks/rvm/Guardfile +12 -0
  67. data/cookbooks/rvm/README.md +1459 -0
  68. data/cookbooks/rvm/Rakefile +18 -0
  69. data/cookbooks/rvm/attributes/.gitkeep +0 -0
  70. data/cookbooks/rvm/attributes/default.rb +68 -0
  71. data/cookbooks/rvm/attributes/gem_package.rb +23 -0
  72. data/cookbooks/rvm/attributes/vagrant.rb +23 -0
  73. data/cookbooks/rvm/libraries/chef_rvm_environment_helpers.rb +55 -0
  74. data/cookbooks/rvm/libraries/chef_rvm_gemset_helpers.rb +67 -0
  75. data/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb +80 -0
  76. data/cookbooks/rvm/libraries/chef_rvm_ruby_helpers.rb +95 -0
  77. data/cookbooks/rvm/libraries/chef_rvm_set_helpers.rb +16 -0
  78. data/cookbooks/rvm/libraries/chef_rvm_shell_helpers.rb +57 -0
  79. data/cookbooks/rvm/libraries/chef_rvm_string_cache.rb +104 -0
  80. data/cookbooks/rvm/libraries/chef_rvm_string_helpers.rb +61 -0
  81. data/cookbooks/rvm/libraries/chef_rvm_version_helpers.rb +45 -0
  82. data/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
  83. data/cookbooks/rvm/libraries/provider_rvm_installation.rb +185 -0
  84. data/cookbooks/rvm/libraries/resource_rvm_installation.rb +103 -0
  85. data/cookbooks/rvm/libraries/rvm_chef_user_environment.rb +55 -0
  86. data/cookbooks/rvm/libraries/rvm_rubygems_package.rb +189 -0
  87. data/cookbooks/rvm/libraries/rvm_shell_chef_wrapper.rb +99 -0
  88. data/cookbooks/rvm/metadata.json +51 -0
  89. data/cookbooks/rvm/providers/default_ruby.rb +63 -0
  90. data/cookbooks/rvm/providers/environment.rb +78 -0
  91. data/cookbooks/rvm/providers/gemset.rb +118 -0
  92. data/cookbooks/rvm/providers/global_gem.rb +97 -0
  93. data/cookbooks/rvm/providers/ruby.rb +178 -0
  94. data/cookbooks/rvm/providers/shell.rb +121 -0
  95. data/cookbooks/rvm/providers/wrapper.rb +73 -0
  96. data/cookbooks/rvm/recipes/.gitkeep +0 -0
  97. data/cookbooks/rvm/recipes/default.rb +40 -0
  98. data/cookbooks/rvm/recipes/gem_package.rb +33 -0
  99. data/cookbooks/rvm/recipes/system.rb +37 -0
  100. data/cookbooks/rvm/recipes/system_install.rb +42 -0
  101. data/cookbooks/rvm/recipes/user.rb +43 -0
  102. data/cookbooks/rvm/recipes/user_install.rb +58 -0
  103. data/cookbooks/rvm/recipes/vagrant.rb +37 -0
  104. data/cookbooks/rvm/resources/default_ruby.rb +31 -0
  105. data/cookbooks/rvm/resources/environment.rb +31 -0
  106. data/cookbooks/rvm/resources/gem.rb +37 -0
  107. data/cookbooks/rvm/resources/gemset.rb +32 -0
  108. data/cookbooks/rvm/resources/global_gem.rb +34 -0
  109. data/cookbooks/rvm/resources/ruby.rb +32 -0
  110. data/cookbooks/rvm/resources/shell.rb +41 -0
  111. data/cookbooks/rvm/resources/wrapper.rb +34 -0
  112. data/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
  113. data/cookbooks/rvm/templates/default/vagrant-chef-client-wrapper.erb +23 -0
  114. data/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
  115. data/cookbooks/rvm/test/integration/data_bags/users/virgil1.json +4 -0
  116. data/cookbooks/rvm/test/integration/data_bags/users/virgil2.json +4 -0
  117. data/cookbooks/rvm/test/integration/data_bags/users/wigglebottom.json +3 -0
  118. data/cookbooks/rvm/test/integration/installs/bats/version_pinning.bats +13 -0
  119. data/cookbooks/rvm/test/integration/rubies/bats/_common.bash +16 -0
  120. data/cookbooks/rvm/test/integration/rubies/bats/verify_1.9.3.bats +9 -0
  121. data/cookbooks/rvm/test/integration/rubies/bats/verify_jruby.bats +12 -0
  122. data/cookbooks/rvm/test/integration/rubies/bats/verify_patch_support.bats +19 -0
  123. data/cookbooks/rvm/test/integration/rubies/bats/verify_ree.bats +9 -0
  124. data/cookbooks/rvm/test/integration/rubies/bats/verify_rubygems_version_support.bats +15 -0
  125. data/cookbooks/rvm/test/integration/stock_system_and_user/bats/system.bats +45 -0
  126. data/cookbooks/rvm/test/unit/libraries/provider_rvm_installation_spec.rb +220 -0
  127. data/cookbooks/rvm/test/unit/libraries/resource_rvm_installation_spec.rb +139 -0
  128. data/cookbooks/rvm/test/unit/spec_helper.rb +23 -0
  129. data/cookbooks/scratchify/.chef/knife.rb +9 -0
  130. data/cookbooks/scratchify/Berksfile +16 -0
  131. data/cookbooks/scratchify/Berksfile.lock +19 -0
  132. data/cookbooks/scratchify/LICENSE.txt +21 -0
  133. data/cookbooks/scratchify/README.md +41 -0
  134. data/cookbooks/scratchify/Thorfile +5 -0
  135. data/cookbooks/scratchify/bin/console +14 -0
  136. data/cookbooks/scratchify/bin/scratchify +6 -0
  137. data/cookbooks/scratchify/bin/setup +7 -0
  138. data/cookbooks/scratchify/chefignore +101 -0
  139. data/cookbooks/scratchify/data_bags/users/deploy.json +6 -0
  140. data/cookbooks/scratchify/environments/.gitkeep +0 -0
  141. data/cookbooks/scratchify/from-scratch.gemspec +36 -0
  142. data/cookbooks/scratchify/lib/from/scratch.rb +31 -0
  143. data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +35 -0
  144. data/cookbooks/scratchify/lib/from/scratch/version.rb +3 -0
  145. data/cookbooks/scratchify/metadata.json +36 -0
  146. data/cookbooks/scratchify/nodes/normfood.ru.json +75 -0
  147. data/cookbooks/scratchify/recipes/default.rb +0 -0
  148. data/cookbooks/scratchify/roles/.gitkeep +0 -0
  149. data/cookbooks/scratchify/spec/from/scratch_spec.rb +11 -0
  150. data/cookbooks/scratchify/spec/spec_helper.rb +2 -0
  151. data/cookbooks/user/.gitignore +5 -0
  152. data/cookbooks/user/.kitchen.yml +46 -0
  153. data/cookbooks/user/.travis.yml +4 -0
  154. data/cookbooks/user/Berksfile +7 -0
  155. data/cookbooks/user/CHANGELOG.md +101 -0
  156. data/cookbooks/user/Gemfile +14 -0
  157. data/cookbooks/user/README.md +447 -0
  158. data/cookbooks/user/Rakefile +21 -0
  159. data/cookbooks/user/attributes/default.rb +50 -0
  160. data/cookbooks/user/libraries/matchers.rb +26 -0
  161. data/cookbooks/user/metadata.json +46 -0
  162. data/cookbooks/user/providers/account.rb +212 -0
  163. data/cookbooks/user/recipes/data_bag.rb +59 -0
  164. data/cookbooks/user/recipes/default.rb +18 -0
  165. data/cookbooks/user/resources/account.rb +41 -0
  166. data/cookbooks/user/templates/default/authorized_keys.erb +7 -0
  167. data/from-scratch.gemspec +33 -0
  168. data/lib/from-scratch.rb +25 -0
  169. data/lib/from-scratch/version.rb +3 -0
  170. data/metadata.rb +15 -0
  171. data/recipes/default.rb +0 -0
  172. data/templates/node.json.erb +31 -0
  173. data/templates/user.json.erb +6 -0
  174. metadata +330 -0
@@ -0,0 +1,12 @@
1
+ # Contributor Code of Conduct
2
+ ## Version 0.4
3
+
4
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
5
+
6
+ If any participant in this project has issues or takes exception with a contribution, they are obligated to provide constructive feedback and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
7
+
8
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
9
+
10
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
11
+
12
+ We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, ability or disability, ethnicity, religion, age, location, native language, or level of experience.
@@ -0,0 +1,26 @@
1
+ # Contributing to chef-rvm
2
+
3
+ Source is hosted at [GitHub][repo]
4
+ Report issues/Questions/Feature requests on [GitHub Issues][issues]
5
+
6
+ ## Please don't
7
+
8
+ * Modify the version in the metadata.rb file (we'll handle that for releases)
9
+ * Modify the CHANGELOG (we'll also handle that for releases)
10
+
11
+ ## Please do
12
+
13
+ * Follow the guidelines in the `CODE_OF_CONDUCT.md` file
14
+ * Document as much as possible, even for simple changes. This will help with understanding your patch and reasoning.
15
+ * Add test coverage for changes where applicable
16
+
17
+ ## Steps to contributing
18
+
19
+ 1. Fork it
20
+ 2. Create your feature branch (git checkout -b my-new-feature)
21
+ 3. Commit your changes (git commit -am 'Added some feature')
22
+ 4. Push to the branch (git push origin my-new-feature)
23
+ 5. Create new Pull Request
24
+
25
+ [repo]: https://github.com/fnichol/chef-rvm
26
+ [issues]: https://github.com/fnichol/chef-rvm/issues
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'foodcritic', '~> 3.0.3'
4
+ gem 'minitest'
5
+ gem 'rake'
6
+ gem 'rspec', '= 3.0.0'
7
+ gem 'guard-rspec'
8
+
9
+ # allow CI to override the version of Chef for matrix testing
10
+ gem 'chef', (ENV['CHEF_VERSION'] || '>= 0.10.10')
11
+
12
+ group :development do
13
+ gem 'emeril'
14
+ end
15
+
16
+ group :integration do
17
+ gem 'berkshelf', '~> 3.1.5'
18
+ gem 'test-kitchen', '~> 1.2.1'
19
+ gem 'kitchen-vagrant', '~> 0.15.0'
20
+ end
@@ -0,0 +1,12 @@
1
+ guard :rspec, spec_paths: "test/unit" do
2
+ watch(%r{^test/unit/.+_spec\.rb$})
3
+ watch(%r{^libraries/(.+)\.rb$}) { |m| "test/unit/libraries/#{m[1]}_spec.rb" }
4
+ watch('test/unit/spec_helper.rb') { "spec" }
5
+ end
6
+
7
+ # guard :rspec do
8
+ # watch(%r{^spec/.+_spec\.rb$})
9
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
10
+ # watch('spec/spec_helper.rb') { "spec" }
11
+ # end
12
+
@@ -0,0 +1,1459 @@
1
+ # <a name="title"></a> chef-rvm [![Build Status](https://secure.travis-ci.org/martinisoft/chef-rvm.png?branch=master)](http://travis-ci.org/martinisoft/chef-rvm)
2
+
3
+ ## <a name="description"></a> Description
4
+
5
+ Manages system-wide and per-user [RVM][rvm]s and manages installed Rubies.
6
+ Several lightweight resources and providers ([LWRP][lwrp]) are also defined.
7
+
8
+ ## <a name="usage"></a> Usage
9
+
10
+ ### <a name="usage-system-rubies"></a> RVM Installed System-Wide with Rubies
11
+
12
+ Most likely, this is the typical case. Include `recipe[rvm::system]` in your
13
+ run_list and override the defaults you want changed. See below for more
14
+ details.
15
+
16
+ ### <a name="usage-user-rubies"></a> RVM Installed For A Specific User with Rubies
17
+
18
+ If you want a per-user install (like on a Mac/Linux workstation for
19
+ development), include `recipe[rvm::user]` in your run_list and add a user
20
+ hash to the `installs` attribute hash. For example:
21
+
22
+ node.set["rvm"]["installs"] = {
23
+ "wigglebottom" => {
24
+ "default_ruby" => "rbx",
25
+ "rubies" => ["1.9.2", "1.8.7"]
26
+ }
27
+ }
28
+
29
+ See below for more details.
30
+
31
+ ### <a name="usage-system"></a> RVM Installed System-Wide and LWRPs Defined
32
+
33
+ If you want to manage your own RVM environment with the provided [LWRP][lwrp]s,
34
+ then include `recipe[rvm::system_install]` in your run_list to prevent
35
+ a default RVM Ruby being installed. See the **Resources and Providers**
36
+ section for more details.
37
+
38
+ ### <a name="usage-user"></a> RVM Installed For A Specific User and LWRPs Defined
39
+
40
+ If you want to manage your own RVM environment for users with the provided
41
+ LWRPs, then include `recipe[rvm::user_install]` in your run_list and add a
42
+ user hash to the `installs` attribute hash. For example:
43
+
44
+ node.set["rvm"]["installs"] = {
45
+ "wigglebottom" => true
46
+ }
47
+
48
+ See the **Resources and Providers** section for more details.
49
+
50
+ ### <a name="usage-minimal"></a> Ultra-Minimal Access To LWRPs
51
+
52
+ Simply include `recipe[rvm]` in your run_list and the LWRPs will be available
53
+ to use in other cookbooks. See the **Resources and Providers** section for
54
+ more details.
55
+
56
+ ### <a name="usage-other"></a> Other Use Cases
57
+
58
+ * If node is running in a Vagrant VM, then including `recipe[rvm::vagrant]`
59
+ in your run_list can help with resolving the *chef-solo* binary on subsequent
60
+ provision executions.
61
+ * If you want other Chef cookbooks to install RubyGems in RVM-managed Rubies,
62
+ you can try including `recipe[rvm::gem_package]` in your run_list. Please
63
+ read the recipe details before attempting.
64
+
65
+ ## <a name="requirements"></a> Requirements
66
+
67
+ ### <a name="requirements-chef"></a> Chef
68
+
69
+ Tested on 11.6.0 but newer and older versions (of 10/11)
70
+ should work just fine. Due to the `rvm_gem` implementation, versions 0.8.x
71
+ of Chef currently will **not** work (see [GH-50][gh50]).
72
+
73
+ File an [issue][issues] if this isn't the case.
74
+
75
+ ### <a name="requirements-platform"></a> Platform
76
+
77
+ The following platforms have been tested with this cookbook, meaning that
78
+ the recipes and LWRPs run on these platforms without error:
79
+
80
+ * ubuntu (10.04/10.10/11.04/12.04)
81
+ * debian (6.0)
82
+ * mac_os_x (10.6/10.7) (See [Platform Notes](#platform-notes-osx))
83
+ * mac_os_x_server (See [Platform Notes](#platform-notes-osx))
84
+ * suse (openSUSE, SLES)
85
+ * centos
86
+ * amazon (2011.09)
87
+ * scientific
88
+ * redhat
89
+ * fedora
90
+ * gentoo
91
+
92
+ Please [report][issues] any additional platforms so they can be added.
93
+
94
+ ### Platform Notes
95
+
96
+ #### <a name="platform-notes-osx"></a> OSX
97
+
98
+ This cookbook suggests the [homebrew](http://community.opscode.com/cookbooks/homebrew) cookbook, which is needed to install
99
+ any additional packages needed to compile ruby. RVM now ships binary rubies,
100
+ but will require homebrew to install any additional libraries.
101
+
102
+ ### <a name="requirements-cookbooks"></a> Cookbooks
103
+
104
+ This cookbook depends on the following external cookbooks:
105
+
106
+ * [chef\_gem][chef_gem_cb]
107
+
108
+ If you are installing [JRuby][jruby] then a Java runtime will need to be
109
+ installed. The Opscode [java cookbook][java_cb] can be used on supported
110
+ platforms.
111
+
112
+ ## <a name="installation"></a> Installation
113
+
114
+ Depending on the situation and use case there are several ways to install
115
+ this cookbook. All the methods listed below assume a tagged version release
116
+ is the target, but omit the tags to get the head of development. A valid
117
+ Chef repository structure like the [Opscode repo][chef_repo] is also assumed.
118
+
119
+ ### <a name="installation-berkshelf"></a> Using Berkshelf
120
+
121
+ [Berkshelf][berkshelf] is a way to manage a cookbook or an application's
122
+ cookbook dependencies. Include the cookbook in your Berksfile, and then run
123
+ `berks install`. To install using Berkshelf:
124
+
125
+ gem install berkshelf
126
+ cd chef-repo
127
+ berks init
128
+ echo "cookbook 'rvm', github: 'fnichol/chef-rvm'" >> Berksfile
129
+ berks install
130
+
131
+ ### <a name="installation-librarian"></a> Using Librarian-Chef
132
+
133
+ [Librarian-Chef][librarian] is a bundler for your Chef cookbooks.
134
+ Include a reference to the cookbook in a [Cheffile][cheffile] and run
135
+ `librarian-chef install`. To install Librarian-Chef:
136
+
137
+ gem install librarian-chef
138
+ cd chef-repo
139
+ librarian-chef init
140
+ cat >> Cheffile <<END_OF_CHEFFILE
141
+ cookbook 'rvm',
142
+ :git => 'git://github.com/fnichol/chef-rvm.git', :ref => 'v0.9.0'
143
+ END_OF_CHEFFILE
144
+ librarian-chef install
145
+
146
+ ### <a name="installation-kgc"></a> Using knife-github-cookbooks
147
+
148
+ The [knife-github-cookbooks][kgc] gem is a plugin for *knife* that supports
149
+ installing cookbooks directly from a GitHub repository. To install with the
150
+ plugin:
151
+
152
+ gem install knife-github-cookbooks
153
+ cd chef-repo
154
+ knife cookbook github install fnichol/chef-rvm/v0.9.0
155
+
156
+ ### <a name="installation-gitsubmodule"></a> As a Git Submodule
157
+
158
+ A common practice (which is getting dated) is to add cookbooks as Git
159
+ submodules. This is accomplishes like so:
160
+
161
+ cd chef-repo
162
+ git submodule add git://github.com/fnichol/chef-rvm.git cookbooks/rvm
163
+ git submodule init && git submodule update
164
+
165
+ **Note:** the head of development will be linked here, not a tagged release.
166
+
167
+ ### <a name="installation-tarball"></a> As a Tarball
168
+
169
+ If the cookbook needs to downloaded temporarily just to be uploaded to a Chef
170
+ Server or Opscode Hosted Chef, then a tarball installation might fit the bill:
171
+
172
+ cd chef-repo/cookbooks
173
+ curl -Ls https://github.com/fnichol/chef-rvm/tarball/v0.9.0 | tar xfz - && \
174
+ mv fnichol-chef-rvm-* rvm
175
+
176
+ ### <a name="installation-platform"></a> From the Opscode Community Platform
177
+
178
+ This cookbook is not currently available on the site due to the flat
179
+ namespace for cookbooks. There is some community work to be done here.
180
+
181
+ ## <a name="recipes"></a> Recipes
182
+
183
+ ### <a name="recipes-default"></a> default
184
+
185
+ Installs the RVM gem and initializes Chef to use the Lightweight Resources
186
+ and Providers ([LWRPs][lwrp]).
187
+
188
+ Use this recipe explicitly if you only want access to the LWRPs provided.
189
+
190
+ ### <a name="recipes-system-install"></a> system_install
191
+
192
+ Installs the RVM codebase system-wide (that is, into `/usr/local/rvm`). This
193
+ recipe includes *default*.
194
+
195
+ Use this recipe by itself if you want RVM installed system-wide but want
196
+ to handle installing Rubies, invoking LWRPs, etc..
197
+
198
+ ### <a name="recipes-system"></a> system
199
+
200
+ Installs the RVM codebase system-wide (that is, into `/usr/local/rvm`) and
201
+ installs Rubies, global gems, and specific gems driven off attribute metadata.
202
+ This recipe includes *default* and *system_install*.
203
+
204
+ Use this recipe by itself if you want RVM system-wide with Rubies installed,
205
+ etc.
206
+
207
+ ### <a name="recipes-user-install"></a> user_install
208
+
209
+ Installs the RVM codebase for a list of users (selected from the
210
+ `node['rvm']['installs']` hash). This recipe includes *default*.
211
+
212
+ Use this recipe by itself if you want RVM installed for specific users in
213
+ isolation but want each user to handle installing Rubies, invoking LWRPs, etc.
214
+
215
+ ### <a name="recipes-user"></a> user
216
+
217
+ Installs the RVM codebase for a list of users (selected from the
218
+ `node['rvm']['installs']` hash) and installs Rubies, global gems, and
219
+ specific gems driven off attribute metadata. This recipe includes *default*
220
+ and *user_install*.
221
+
222
+ Use this recipe by itself if you want RVM installed for specific users in
223
+ isolation with Rubies installed, etc.
224
+
225
+ ### <a name="recipes-vagrant"></a> vagrant
226
+
227
+ An optional recipe if Chef is installed in a non-RVM Ruby in a
228
+ [Vagrant][vagrant] virtual machine. This recipe adds the default *vagrant*
229
+ user to the RVM unix group and installs a `chef-solo` wrapper script so Chef
230
+ doesn't need to be re-installed in the default RVM Ruby.
231
+
232
+ ### <a name="recipes-gem-package"></a> gem_package
233
+
234
+ An experimental recipe that patches the [gem_package resource][gem_package]
235
+ to use the `Chef::Provider::Package::RVMRubygems` provider. An attribute
236
+ `rvm/gem_package/rvm_string` will determine which RVM Ruby is used for
237
+ install/remove/upgrade/purge actions. This may help when using a third
238
+ party or upstream cookbook that assumes a non-RVM managed system Ruby.
239
+
240
+ **Note:** When this recipe is included it will force RVM to be
241
+ installed in the [compilation phase][compilation]. This will ensure that all
242
+ Rubies can be available if any `gem_package` resource calls are issued from
243
+ other cookbooks during the compilation phase.
244
+
245
+ **Warning:** [Here be dragons][dragons]! This is either brilliant or the
246
+ dumbest idea ever, so feedback is appreciated.
247
+
248
+ ## <a name="attributes"></a> Attributes
249
+
250
+ ### <a name="attributes-default-ruby"></a> default_ruby
251
+
252
+ The default Ruby for RVM installed system-wide. If the RVM Ruby is not
253
+ installed, it will be built as a pre-requisite. The value can also contain a
254
+ gemset in the form of `"ruby-1.8.7-p352@awesome"`.
255
+
256
+ The default is `"ruby-1.9.3-p547"`. To disable a default Ruby from being
257
+ set, use an empty string (`""`) or a value of `"system"`.
258
+
259
+ ### <a name="attributes-user-default-ruby"></a> user_default_ruby
260
+
261
+ The default Ruby for RVMs installed per-user when not explicitly set for that
262
+ user. If the RVM Ruby is not installed, it will be built as a pre-requisite.
263
+ The value can also contain a gemset in the form of `"ruby-1.8.7-p352@awesome"`.
264
+
265
+ The default is `"ruby-1.9.3-p547"`. To disable a default Ruby from being
266
+ set, use an empty string (`""`) or a value of `"system"`.
267
+
268
+ ### <a name="attributes-rubies"></a> rubies
269
+
270
+ A list of additional RVM system-wide Rubies to be built and installed. This
271
+ list does not need to necessarily contain your default Ruby as the
272
+ `rvm_default_ruby` resource will take care of installing itself. You may also
273
+ include patch info and a rubygems version. For example:
274
+
275
+ node['rvm']['rubies'] = [
276
+ "ree-1.8.7",
277
+ "jruby",
278
+ {
279
+ 'version' => '1.9.3-p125-perf',
280
+ 'patch' => 'falcon',
281
+ 'rubygems_version' => '1.5.2'
282
+ }
283
+ ]
284
+
285
+ The default is an empty array: `[]`.
286
+
287
+ ### <a name="attributes-user-rubies"></a> user_rubies
288
+
289
+ A list of additional RVM Rubies to be built and installed per-user when not
290
+ explicitly set. This list does not need to necessarily contain your default
291
+ Ruby as the `rvm_default_ruby` resource will take care of installing itself.
292
+ For example:
293
+
294
+ node['rvm']['user_rubies'] = [ "ree-1.8.7", "jruby" ]
295
+
296
+ The default is an empty array: `[]`.
297
+
298
+ ### <a name="attributes-global-gems"></a> global_gems
299
+
300
+ A list of gem hashes to be installed into the *global* gemset in each
301
+ installed RVM Ruby sytem-wide. The **global.gems** files will be added to and
302
+ all installed Rubies will be iterated over to ensure full installation
303
+ coverage. See the `rvm_gem` resource for more details about the options for
304
+ each gem hash.
305
+
306
+ The default puts bundler and rake in each Ruby:
307
+
308
+ node['rvm']['global_gems'] = [
309
+ { 'name' => 'bundler' },
310
+ { 'name' => 'rake',
311
+ 'version' => '0.9.2'
312
+ },
313
+ { 'name' => 'rubygems-bundler',
314
+ 'action' => 'remove'
315
+ }
316
+ ]
317
+
318
+ ### <a name="attributes-user-global-gems"></a> user_global_gems
319
+
320
+ A list of gem hashes to be installed into the *global* gemset in each
321
+ installed RVM Ruby for each user when not explicitly set. The
322
+ **global.gems** files will be added to and all installed Rubies will be
323
+ iterated over to ensure full installation coverage. See the `rvm_gem`
324
+ resource for more details about the options for each gem hash.
325
+
326
+ The default puts bundler and rake in each Ruby:
327
+
328
+ node['rvm']['user_global_gems'] = [
329
+ { 'name' => 'bundler' },
330
+ { 'name' => 'rake',
331
+ 'version' => '0.9.2'
332
+ },
333
+ { 'name' => 'rubygems-bundler',
334
+ 'action' => 'remove'
335
+ }
336
+ ]
337
+
338
+ ### <a name="attributes-gems"></a> gems
339
+
340
+ A list of gem hashes to be installed into arbitrary RVM Rubies and gemsets
341
+ system-wide. See the `rvm_gem` resource for more details about the options for
342
+ each gem hash and target Ruby environment. For example:
343
+
344
+ node['rvm']['gems'] = {
345
+ 'ruby-1.9.2-p280' => [
346
+ { 'name' => 'vagrant' },
347
+ { 'name' => 'veewee' },
348
+ { 'name' => 'rake',
349
+ 'version' => '0.9.2'
350
+ }
351
+ ],
352
+ 'ruby-1.9.2-p280@empty-gemset' => [],
353
+ 'jruby' => [
354
+ { 'name' => 'nokogiri',
355
+ 'version' => '1.5.0.beta.2'
356
+ },
357
+ { 'name' => 'warbler' }
358
+ ]
359
+ }
360
+
361
+ The default is an empty hash: `{}`.
362
+
363
+ ### <a name="attributes-user-gems"></a> user_gems
364
+
365
+ A list of gem hashes to be installed into arbitrary RVM Rubies and gemsets
366
+ for each user when not explicitly set. See the `rvm_gem` resource for more
367
+ details about the options for each gem hash and target Ruby environment. See
368
+ the `gems` attribute for an example.
369
+
370
+ The default is an empty hash: `{}`.
371
+
372
+ ### <a name="attributes-rvmrc-env"></a> rvmrc\_env
373
+
374
+ A hash of system-wide `rvmrc` options. The key is the RVM setting name
375
+ (in String or Symbol form) and the value is the desired setting value.
376
+ If the value is set to `false` or `nil` then this value will not be
377
+ included. An example used on a build box might be:
378
+
379
+ node.set['rvm']['rvmrc_env'] = {
380
+ 'rvm_project_rvmrc' => 1,
381
+ 'rvm_gemset_create_on_use_flag' => 1,
382
+ 'rvm_trust_rvmrcs_flag' => 1,
383
+ 'rvm_gem_options' => false
384
+ }
385
+
386
+ The default is: `{ "rvm_gem_options" => "--no-ri --no-rdoc" }`.
387
+
388
+ ### <a name="attributes-installs"></a> installs
389
+
390
+ A hash of user specific RVM installation hashes. The `user_install` and
391
+ `user` recipes use this attribute to determine per-user installation settings.
392
+ The hash keys correspond to the default/system equivalents. For example:
393
+
394
+ node["rvm"]["installs"] = {
395
+ "jdoe" => {
396
+ "rvmrc_env" => {
397
+ "rvm_gem_options" => false
398
+ },
399
+ "action" => "force",
400
+ "default_ruby" => "ree",
401
+ "global_gems" => [
402
+ { "name" => "bundler",
403
+ "version" => "1.1.pre.7"
404
+ },
405
+ { "name" => "rake" }
406
+ ]
407
+ },
408
+ "jenkins" => {
409
+ "installer_flags" => "--version 1.19.0",
410
+ "default_ruby" => "jruby-1.6.3",
411
+ "rubies" => [
412
+ "ree-1.8.7",
413
+ "jruby",
414
+ {
415
+ "version" => "1.9.3-p125-perf",
416
+ "patch" => "falcon",
417
+ "rubygems_version" => "1.5.2"
418
+ }
419
+ ],
420
+ "rvmrc_env" => {
421
+ "rvm_project_rvmrc" => 1,
422
+ "rvm_gemset_create_on_use_flag" => 1,
423
+ "rvm_pretty_print_flag" => 1
424
+ },
425
+ "global_gems" => [
426
+ { "name" => "bundler",
427
+ "version" => "1.1.pre.7"
428
+ },
429
+ { "name" => "rake",
430
+ "version" => "0.8.7"
431
+ }
432
+ ]
433
+ }
434
+ }
435
+
436
+ The default is an empty hash: `{}`.
437
+
438
+ ### <a name="attributes-installer-url"></a> installer\_url
439
+
440
+ The URL that provides the RVM installer.
441
+
442
+ The default is `"https://get.rvm.io"`.
443
+
444
+ ### <a name="attributes-installer-flags"></a> installer\_flags
445
+
446
+ The default string of arguments passed to an RVM installation script. The value
447
+ will be used as the default flag string for all
448
+ [rvm_installation][#resources-rvm-installation] resources.
449
+
450
+ The default is `"stable"`.
451
+
452
+ ### <a name="attributes-group-id"></a> group_id
453
+
454
+ The Unix *GID* to be used for the `rvm` group. If this attribute is set,
455
+ the group will be created in the compilation phase to avoid any collisions
456
+ with expected *GID*s in other cookbooks. If left at the default value,
457
+ the RVM installer will create this group as normal.
458
+
459
+ The default is `default`.
460
+
461
+ ### <a name="attributes-group-users"></a> group_users
462
+
463
+ A list of users that will be added to the `rvm` group. These users
464
+ will then be able to manage RVM in a system-wide installation.
465
+
466
+ The default is an empty list: `[]`.
467
+
468
+ ### <a name="attributes-gem-package-rvm-string"></a> gem_package/rvm_string
469
+
470
+ If using the `gem_package` recipe, this determines which Ruby or Rubies will
471
+ be used by the `gem_package` resource in other cookbooks. The value can be
472
+ either a *String* (for example `ruby-1.8.7-p334`) or an *Array* of RVM Ruby
473
+ strings (for example `['ruby-1.8.7-p334', 'system']`). To target an underlying
474
+ unmanaged system Ruby you can use `system`.
475
+
476
+ The default is the value of the `default_ruby` attribute.
477
+
478
+ ### <a name="attributes-vagrant-system-chef-solo"></a> vagrant/system_chef_solo
479
+
480
+ If using the `vagrant` recipe, this sets the path to the package-installed
481
+ *chef-solo* binary.
482
+
483
+ The default is `"/opt/ruby/bin/chef-solo"`.
484
+
485
+ ## <a name="lwrps"></a> Resources and Providers
486
+
487
+ ### <a name="lwrps-rvmruby"></a> rvm_ruby
488
+
489
+ #### <a name="lwrps-rvmruby-actions"></a> Actions
490
+
491
+ <table>
492
+ <thead>
493
+ <tr>
494
+ <th>Action</th>
495
+ <th>Description</th>
496
+ <th>Default</th>
497
+ </tr>
498
+ </thead>
499
+ <tbody>
500
+ <tr>
501
+ <td>install</td>
502
+ <td>
503
+ Build and install an RVM Ruby. See RVM rubies/installing<sup>(1)</sup>
504
+ for more details.
505
+ </td>
506
+ <td>Yes</td>
507
+ </tr>
508
+ <tr>
509
+ <td>remove</td>
510
+ <td>
511
+ Remove the Ruby, source files and optional gemsets/archives. See RVM
512
+ rubies/removing<sup>(2)</sup> for more details.
513
+ </td>
514
+ <td>&nbsp;</td>
515
+ </tr>
516
+ <tr>
517
+ <td>uninstall</td>
518
+ <td>
519
+ Just remove the Ruby and leave everything else. See RVM rubies/removing<sup>(3)</sup> for more details.
520
+ </td>
521
+ <td>&nbsp;</td>
522
+ </tr>
523
+ </tbody>
524
+ </table>
525
+
526
+ 1. [RVM rubies/installing][rvm_ruby_install]
527
+ 2. [RVM rubies/removing][rvm_remove]
528
+ 3. [RVM rubies/removing][rvm_remove]
529
+
530
+ #### <a name="lwrps-rvmruby-actions"></a> Attributes
531
+
532
+ <table>
533
+ <thead>
534
+ <tr>
535
+ <th>Attribute</th>
536
+ <th>Description</th>
537
+ <th>Default Value</th>
538
+ </tr>
539
+ </thead>
540
+ <tbody>
541
+ <tr>
542
+ <td>ruby_string</td>
543
+ <td>
544
+ <b>Name attribute:</b> an RVM Ruby string that could contain a gemset.
545
+ If a gemset is given (for example,
546
+ <code>"ruby-1.8.7-p330@awesome"</code>), then it will be stripped.
547
+ </td>
548
+ <td><code>nil</code></td>
549
+ </tr>
550
+ <tr>
551
+ <td>user</td>
552
+ <td>
553
+ A users's isolated RVM installation on which to apply an action. The
554
+ default value of <code>nil</code> denotes a system-wide RVM
555
+ installation is being targeted. <b>Note:</b> if specified, the user
556
+ must already exist.
557
+ </td>
558
+ <td><code>nil</code></td>
559
+ </tr>
560
+ </tbody>
561
+ </table>
562
+
563
+ #### <a name="lwrps-rvmruby-examples"></a> Examples
564
+
565
+ ##### Install Ruby
566
+
567
+ rvm_ruby "ree" do
568
+ action :install
569
+ end
570
+
571
+ rvm_ruby "jruby-1.6.3"
572
+
573
+ **Note:** the install action is default, so the second example is a more common
574
+ usage.
575
+
576
+ ##### Remove Ruby
577
+
578
+ rvm_ruby "ree-1.8.7-2011.01" do
579
+ action :remove
580
+ end
581
+
582
+ **Note:** the RVM documentation mentions that this method is far preferred to
583
+ using uninstall since it purges almost everything.
584
+
585
+ ##### Uninstall Ruby
586
+
587
+ rvm_ruby "ree-1.8.7-2011.01" do
588
+ action :uninstall
589
+ user "jenkins"
590
+ end
591
+
592
+ **Note:** The RVM installation for the *jenkins* user will be acted upon.
593
+
594
+ ### <a name="lwrps-rvmdefaultruby"></a> rvm_default_ruby
595
+
596
+ This resource sets the default RVM Ruby, optionally with gemset. The given
597
+ Ruby will be installed if it isn't already and a gemset will be created in
598
+ none currently exist. If multiple declarations are used then the last executed
599
+ one "wins".
600
+
601
+ #### <a name="lwrps-rvmdefaultruby-actions"></a> Actions
602
+
603
+ <table>
604
+ <thead>
605
+ <tr>
606
+ <th>Action</th>
607
+ <th>Description</th>
608
+ <th>Default</th>
609
+ </tr>
610
+ </thead>
611
+ <tbody>
612
+ <tr>
613
+ <td>create</td>
614
+ <td>
615
+ Set the default RVM Ruby. See RVM rubies/default<sup>(1)</sup> for
616
+ more details.
617
+ </td>
618
+ <td>Yes</td>
619
+ </tr>
620
+ </tbody>
621
+ </table>
622
+
623
+ 1. [RVM rubies/default][rvm_default]
624
+
625
+ #### <a name="lwrps-rvmdefaultruby-attributes"></a> Attributes
626
+
627
+ <table>
628
+ <thead>
629
+ <tr>
630
+ <th>Attribute</th>
631
+ <th>Description</th>
632
+ <th>Default Value</th>
633
+ </tr>
634
+ </thead>
635
+ <tbody>
636
+ <tr>
637
+ <td>ruby_string</td>
638
+ <td>
639
+ <b>Name attribute:</b> an RVM Ruby string that could contain a gemset.
640
+ If a gemset is given (for example,
641
+ <code>"ruby-1.8.7-p330@awesome"</code>), then it will be included.
642
+ </td>
643
+ <td><code>nil</code></td>
644
+ </tr>
645
+ <tr>
646
+ <td>user</td>
647
+ <td>
648
+ A users's isolated RVM installation on which to apply an action. The
649
+ default value of <code>nil</code> denotes a system-wide RVM
650
+ installation is being targeted. <b>Note:</b> if specified, the
651
+ user must already exist.
652
+ </td>
653
+ <td><code>nil</code></td>
654
+ </tr>
655
+ </tbody>
656
+ </table>
657
+
658
+ #### <a name="lwrps-rvmdefaultruby-examples"></a> Examples
659
+
660
+ ##### Setting The Default Ruby
661
+
662
+ rvm_default_ruby "ree" do
663
+ action :create
664
+ end
665
+
666
+ rvm_default_ruby "jruby-1.5.6"
667
+
668
+ **Note:** the create action is default, so the second example is a more common
669
+ usage.
670
+
671
+ ### <a name="lwrps-rvmenvironment"></a> rvm_environment
672
+
673
+ This resource ensures that the specified RVM Ruby is installed and the optional
674
+ gemset is created. It is a convenience resource which wraps `rvm_ruby` and
675
+ `rvm_gemset` so it can be used as a sort of *über Ruby* resource which
676
+ parallels the `rvm_default_ruby` resource.
677
+
678
+ #### <a name="lwrps-rvmenvironment-actions"></a> Actions
679
+
680
+ <table>
681
+ <thead>
682
+ <tr>
683
+ <th>Action</th>
684
+ <th>Description</th>
685
+ <th>Default</th>
686
+ </tr>
687
+ </thead>
688
+ <tbody>
689
+ <tr>
690
+ <td>create</td>
691
+ <td>Installs the specified RVM Ruby and gemset.</td>
692
+ <td>Yes</td>
693
+ </tr>
694
+ </tbody>
695
+ </table>
696
+
697
+ #### <a name="lwrps-rvmenvironment-attributes"></a> Attributes
698
+
699
+ <table>
700
+ <thead>
701
+ <tr>
702
+ <th>Attribute</th>
703
+ <th>Description</th>
704
+ <th>Default Value</th>
705
+ </tr>
706
+ </thead>
707
+ <tbody>
708
+ <tr>
709
+ <td>ruby_string</td>
710
+ <td>
711
+ <b>Name attribute:</b> an RVM Ruby string that could contain a gemset.
712
+ If a gemset is given (for example,
713
+ <code>"ruby-1.8.7-p330@awesome"</code>), then it will be used.
714
+ </td>
715
+ <td><code>nil</code></td>
716
+ </tr>
717
+ <tr>
718
+ <td>user</td>
719
+ <td>
720
+ A users's isolated RVM installation on which to apply an action. The
721
+ default value of <code>nil</code> denotes a system-wide RVM
722
+ installation is being targeted. <b>Note:</b> if specified, the
723
+ user must already exist.
724
+ </td>
725
+ <td><code>nil</code></td>
726
+ </tr>
727
+ </tbody>
728
+ </table>
729
+
730
+ #### <a name="lwrps-rvmenvironment-examples"></a> Examples
731
+
732
+ ##### Creating A Passenger Environment In Production
733
+
734
+ rvm_environment "ree-1.8.7-2011.01@passenger"
735
+
736
+ ### <a name="lwrps-rvmgemset"></a> rvm_gemset
737
+
738
+ See [RVM gemsets][rvm_gemsets] for more background concerning gemsets.
739
+
740
+ #### <a name="lwrps-rvmgemset-actions"></a> Actions
741
+
742
+ <table>
743
+ <thead>
744
+ <tr>
745
+ <th>Action</th>
746
+ <th>Description</th>
747
+ <th>Default</th>
748
+ </tr>
749
+ </thead>
750
+ <tbody>
751
+ <tr>
752
+ <td>create</td>
753
+ <td>
754
+ Creates a new gemset in a given RVM Ruby. See RVM
755
+ gemsets/creating<sup>(1)</sup> for more details.
756
+ </td>
757
+ <td>Yes</td>
758
+ </tr>
759
+ <tr>
760
+ <td>update</td>
761
+ <td>
762
+ Update all gems installed to the gemset in a given RVM Ruby.
763
+ </td>
764
+ <td>&nbsp;</td>
765
+ </tr>
766
+ <tr>
767
+ <td>empty</td>
768
+ <td>
769
+ Remove all gems installed to the gemset in a given RVM Ruby. See RVM
770
+ gemsets/emptying<sup>(2)</sup> for more details.
771
+ </td>
772
+ <td>&nbsp;</td>
773
+ </tr>
774
+ <tr>
775
+ <td>delete</td>
776
+ <td>
777
+ Delete gemset from the given RVM Ruby. See RVM
778
+ gemsets/deleting<sup>(3)</sup> for more details.
779
+ </td>
780
+ <td>&nbsp;</td>
781
+ </tr>
782
+ </tbody>
783
+ </table>
784
+
785
+ 1. [RVM gemsets/creating][rvm_create_gemset]
786
+ 2. [RVM gemsets/emptying][rvm_empty_gemset]
787
+ 3. [RVM gemsets/deleting][rvm_delete_gemset]
788
+
789
+ #### <a name="lwrps-rvmgemset-attributes"></a> Attributes
790
+
791
+ <table>
792
+ <thead>
793
+ <tr>
794
+ <th>Attribute</th>
795
+ <th>Description</th>
796
+ <th>Default Value</th>
797
+ </tr>
798
+ </thead>
799
+ <tbody>
800
+ <tr>
801
+ <td>gemset</td>
802
+ <td>
803
+ <b>Name attribute:</b> Either an RVM Ruby string containing a gemset
804
+ or a bare gemset name. If only the gemset name is given, then the
805
+ <code>ruby_string</code> attribute must be used to indicate which
806
+ RVM Ruby to target.
807
+ </td>
808
+ <td><code>nil</code></td>
809
+ </tr>
810
+ <tr>
811
+ <td>ruby_string</td>
812
+ <td>
813
+ An RVM Ruby string that should not contain a gemset.
814
+ </td>
815
+ <td><code>nil</code></td>
816
+ </tr>
817
+ <tr>
818
+ <td>user</td>
819
+ <td>
820
+ A users's isolated RVM installation on which to apply an action. The
821
+ default value of <code>nil</code> denotes a system-wide RVM
822
+ installation is being targeted. <b>Note:</b> if specified, the
823
+ user must already exist.
824
+ </td>
825
+ <td><code>nil</code></td>
826
+ </tr>
827
+ </tbody>
828
+ </table>
829
+
830
+ #### <a name="lwrps-rvmgemset-examples"></a> Examples
831
+
832
+ ##### Creating A Gemset
833
+
834
+ rvm_gemset "rails" do
835
+ ruby_string "ruby-1.9.2-p136"
836
+ action :create
837
+ end
838
+
839
+ rvm_gemset "ruby-1.9.2-p136@rails"
840
+
841
+ **Note:** the create action is default, so the second example is a more common
842
+ usage.
843
+
844
+ ##### Updating A Gemset
845
+
846
+ rvm_gemset "jruby-1.6.0.RC2@development" do
847
+ action :update
848
+ end
849
+
850
+ ##### Emptying A Gemset
851
+
852
+ rvm_gemset "development" do
853
+ ruby_string "jruby-1.6.3"
854
+ action :empty
855
+ end
856
+
857
+ ##### Deleting A Gemset
858
+
859
+ rvm_gemset "ruby-1.9.2-p136@rails" do
860
+ action :delete
861
+ end
862
+
863
+ ### <a name="lwrps-rvmgem"></a> rvm_gem
864
+
865
+ This resource is a close analog to the `gem_package` provider/resource which
866
+ is RVM-aware. See the Opscode [package resource][package_resource] and
867
+ [gem package options][gem_package_options] pages for more details.
868
+
869
+ #### <a name="lwrps-rvmgem-actions"></a> Actions
870
+
871
+ <table>
872
+ <thead>
873
+ <tr>
874
+ <th>Action</th>
875
+ <th>Description</th>
876
+ <th>Default</th>
877
+ </tr>
878
+ </thead>
879
+ <tbody>
880
+ <tr>
881
+ <td>install</td>
882
+ <td>
883
+ Install a gem - if version is provided, install that specific version.
884
+ </td>
885
+ <td>Yes</td>
886
+ </tr>
887
+ <tr>
888
+ <td>upgrade</td>
889
+ <td>
890
+ Upgrade a gem - if version is provided, upgrade to that specific
891
+ version
892
+ </td>
893
+ <td>&nbsp;</td>
894
+ </tr>
895
+ <tr>
896
+ <td>remove</td>
897
+ <td>
898
+ Remove a gem.
899
+ </td>
900
+ <td>&nbsp;</td>
901
+ </tr>
902
+ <tr>
903
+ <td>purge</td>
904
+ <td>
905
+ Purge a gem.
906
+ </td>
907
+ <td>&nbsp;</td>
908
+ </tr>
909
+ </tbody>
910
+ </table>
911
+
912
+ #### <a name="lwrps-rvmgem-attributes"></a> Attributes
913
+
914
+ <table>
915
+ <thead>
916
+ <tr>
917
+ <th>Attribute</th>
918
+ <th>Description</th>
919
+ <th>Default Value</th>
920
+ </tr>
921
+ </thead>
922
+ <tbody>
923
+ <tr>
924
+ <td>package_name</td>
925
+ <td>
926
+ <b>Name attribute:</b> the name of the gem to install.
927
+ </td>
928
+ <td><code>nil</code></td>
929
+ </tr>
930
+ <tr>
931
+ <td>version</td>
932
+ <td>
933
+ The specific version of the gem to install/upgrade.
934
+ </td>
935
+ <td><code>nil</code></td>
936
+ </tr>
937
+ <tr>
938
+ <td>options</td>
939
+ <td>
940
+ Add additional options to the underlying gem command.
941
+ </td>
942
+ <td><code>nil</code></td>
943
+ </tr>
944
+ <tr>
945
+ <td>source</td>
946
+ <td>
947
+ Provide an additional source for gem providers (such as RubyGems).
948
+ </td>
949
+ <td><code>nil</code></td>
950
+ </tr>
951
+ <tr>
952
+ <td>gem_binary</td>
953
+ <td>
954
+ A gem_package attribute to specify a gem binary.
955
+ </td>
956
+ <td><code>"gem"</code></td>
957
+ </tr>
958
+ <tr>
959
+ <td>user</td>
960
+ <td>
961
+ A users's isolated RVM installation on which to apply an action. The
962
+ default value of <code>nil</code> denotes a system-wide RVM
963
+ installation is being targeted. <b>Note:</b> if specified, the
964
+ user must already exist.
965
+ </td>
966
+ <td><code>nil</code></td>
967
+ </tr>
968
+ </tbody>
969
+ </table>
970
+
971
+ #### <a name="lwrps-rvmgem-examples"></a> Examples
972
+
973
+ ##### Install A Gem
974
+
975
+ rvm_gem "thor" do
976
+ ruby_string "ruby-1.8.7-p352"
977
+ action :install
978
+ end
979
+
980
+ rvm_gem "json" do
981
+ ruby_string "ruby-1.8.7-p330@awesome"
982
+ end
983
+
984
+ rvm_gem "nokogiri" do
985
+ ruby_string "jruby-1.5.6"
986
+ version "1.5.0.beta.4"
987
+ action :install
988
+ end
989
+
990
+ **Note:** the install action is default, so the second example is a more common
991
+ usage. Gemsets can also be specified.
992
+
993
+ ##### Install A Gem From A Local File
994
+
995
+ rvm_gem "json" do
996
+ ruby_string "ree@project"
997
+ source "/tmp/json-1.5.1.gem"
998
+ version "1.5.1"
999
+ end
1000
+
1001
+ ##### Keep A Gem Up To Date
1002
+
1003
+ rvm_gem "homesick" do
1004
+ action :upgrade
1005
+ end
1006
+
1007
+ **Note:** the default RVM Ruby will be targeted if no `ruby_string` attribute
1008
+ is given.
1009
+
1010
+ ##### Remove A Gem
1011
+
1012
+ rvm_gem "nokogiri" do
1013
+ ruby_string "jruby-1.5.6"
1014
+ version "1.4.4.2"
1015
+ action :remove
1016
+ end
1017
+
1018
+ ### <a name="lwrps-rvmglobalgem"></a> rvm_global_gem
1019
+
1020
+ This resource will use the `rvm_gem` resource to manage a gem in the *global*
1021
+ gemset accross all RVM Rubies. An entry will also be made/removed in RVM's
1022
+ *global.gems* file. See the Opscode [package resource][package_resource] and
1023
+ [gem package options][gem_package_options] pages for more details.
1024
+
1025
+ #### <a name="lwrps-rvmglobalgem-actions"></a> Actions
1026
+
1027
+ <table>
1028
+ <thead>
1029
+ <tr>
1030
+ <th>Action</th>
1031
+ <th>Description</th>
1032
+ <th>Default</th>
1033
+ </tr>
1034
+ </thead>
1035
+ <tbody>
1036
+ <tr>
1037
+ <td>install</td>
1038
+ <td>
1039
+ Install a gem across all Rubies - if version is provided, install that
1040
+ specific version.
1041
+ </td>
1042
+ <td>Yes</td>
1043
+ </tr>
1044
+ <tr>
1045
+ <td>upgrade</td>
1046
+ <td>
1047
+ Upgrade a gem across all Rubies - if version is provided, upgrade to
1048
+ that specific version.
1049
+ </td>
1050
+ <td>&nbsp;</td>
1051
+ </tr>
1052
+ <tr>
1053
+ <td>remove</td>
1054
+ <td>
1055
+ Remove a gem across all Rubies.
1056
+ </td>
1057
+ <td>&nbsp;</td>
1058
+ </tr>
1059
+ <tr>
1060
+ <td>purge</td>
1061
+ <td>
1062
+ Purge a gem across all Rubies.
1063
+ </td>
1064
+ <td>&nbsp;</td>
1065
+ </tr>
1066
+ </tbody>
1067
+ </table>
1068
+
1069
+ #### <a name="lwrps-rvmglobalgem-attributes"></a> Attributes
1070
+
1071
+ <table>
1072
+ <thead>
1073
+ <tr>
1074
+ <th>Attribute</th>
1075
+ <th>Description</th>
1076
+ <th>Default Value</th>
1077
+ </tr>
1078
+ </thead>
1079
+ <tbody>
1080
+ <tr>
1081
+ <td>package_name</td>
1082
+ <td>
1083
+ <b>Name attribute:</b> the name of the gem to install.
1084
+ </td>
1085
+ <td><code>nil</code></td>
1086
+ </tr>
1087
+ <tr>
1088
+ <td>ruby_string</td>
1089
+ <td>
1090
+ An RVM Ruby string that could contain a gemset. If a gemset is given
1091
+ (for example, <code>"ruby-1.8.7-p330@awesome"</code>), then it will
1092
+ be used.
1093
+ </td>
1094
+ <td><code>"default"</code></td>
1095
+ </tr>
1096
+ <tr>
1097
+ <td>version</td>
1098
+ <td>
1099
+ The specific version of the gem to install/upgrade.
1100
+ </td>
1101
+ <td><code>nil</code></td>
1102
+ </tr>
1103
+ <tr>
1104
+ <td>options</td>
1105
+ <td>
1106
+ Add additional options to the underlying gem command.
1107
+ </td>
1108
+ <td><code>nil</code></td>
1109
+ </tr>
1110
+ <tr>
1111
+ <td>source</td>
1112
+ <td>
1113
+ Provide an additional source for gem providers (such as RubyGems).
1114
+ This can also include a file system path to a <code>.gem</code> file
1115
+ such as <code>/tmp/json-1.5.1.gem</code>.
1116
+ </td>
1117
+ <td><code>nil</code></td>
1118
+ </tr>
1119
+ <tr>
1120
+ <td>user</td>
1121
+ <td>
1122
+ A users's isolated RVM installation on which to apply an action. The
1123
+ default value of <code>nil</code> denotes a system-wide RVM
1124
+ installation is being targeted. <b>Note:</b> if specified, the
1125
+ user must already exist.
1126
+ </td>
1127
+ <td><code>nil</code></td>
1128
+ </tr>
1129
+ </tbody>
1130
+ </table>
1131
+
1132
+ ### <a name="lwrps-rvmshell"></a> rvm_shell
1133
+
1134
+ This resource is a wrapper for the `script` resource which wraps the code block
1135
+ in an RVM-aware environment.. See the Opscode
1136
+ [script resource][script_resource] page for more details.
1137
+
1138
+ #### <a name="lwrps-rvmshell-actions"></a> Actions
1139
+
1140
+ <table>
1141
+ <thead>
1142
+ <tr>
1143
+ <th>Action</th>
1144
+ <th>Description</th>
1145
+ <th>Default</th>
1146
+ </tr>
1147
+ </thead>
1148
+ <tbody>
1149
+ <tr>
1150
+ <td>run</td>
1151
+ <td>Run the script</td>
1152
+ <td>Yes</td>
1153
+ </tr>
1154
+ <tr>
1155
+ <td>nothing</td>
1156
+ <td>Do not run this command</td>
1157
+ <td>&nbsp;</td>
1158
+ </tr>
1159
+ </tbody>
1160
+ </table>
1161
+
1162
+ Use `action :nothing` to set a command to only run if another resource
1163
+ notifies it.
1164
+
1165
+ #### <a name="lwrps-rvmshell-attributes"></a> Attributes
1166
+
1167
+ <table>
1168
+ <thead>
1169
+ <tr>
1170
+ <th>Attribute</th>
1171
+ <th>Description</th>
1172
+ <th>Default Value</th>
1173
+ </tr>
1174
+ </thead>
1175
+ <tbody>
1176
+ <tr>
1177
+ <td>name</td>
1178
+ <td>
1179
+ <b>Name attribute:</b> Name of the command to execute.
1180
+ </td>
1181
+ <td><code>name</code></td>
1182
+ </tr>
1183
+ <tr>
1184
+ <td>ruby_string</td>
1185
+ <td>
1186
+ An RVM Ruby string that could contain a gemset. If a gemset is given
1187
+ (for example, <code>"ruby-1.8.7-p330@awesome"</code>), then it will
1188
+ be used.
1189
+ </td>
1190
+ <td><code>"default"</code></td>
1191
+ </tr>
1192
+ <tr>
1193
+ <td>code</td>
1194
+ <td>
1195
+ Quoted script of code to execute.
1196
+ </td>
1197
+ <td><code>nil</code></td>
1198
+ </tr>
1199
+ <tr>
1200
+ <td>creates</td>
1201
+ <td>
1202
+ A file this command creates - if the file exists, the command will not
1203
+ be run.
1204
+ </td>
1205
+ <td><code>nil</code></td>
1206
+ </tr>
1207
+ <tr>
1208
+ <td>cwd</td>
1209
+ <td>
1210
+ Current working director to run the command from.
1211
+ </td>
1212
+ <td><code>nil</code></td>
1213
+ </tr>
1214
+ <tr>
1215
+ <td>environment</td>
1216
+ <td>
1217
+ A hash of environment variables to set before running this command.
1218
+ </td>
1219
+ <td><code>nil</code></td>
1220
+ </tr>
1221
+ <tr>
1222
+ <td>group</td>
1223
+ <td>
1224
+ A group or group ID that we should change to before running this command.
1225
+ </td>
1226
+ <td><code>nil</code></td>
1227
+ </tr>
1228
+ <tr>
1229
+ <td>path</td>
1230
+ <td>
1231
+ An array of paths to use when searching for the command.
1232
+ </td>
1233
+ <td><code>nil</code>, uses system path</td>
1234
+ </tr>
1235
+ <tr>
1236
+ <td>returns</td>
1237
+ <td>
1238
+ The return value of the command (may be an array of accepted values) -
1239
+ this resource raises an exception if the return value(s) do not match.
1240
+ </td>
1241
+ <td><code>0</code></td>
1242
+ </tr>
1243
+ <tr>
1244
+ <td>timeout</td>
1245
+ <td>
1246
+ How many seconds to let the command run before timing out.
1247
+ </td>
1248
+ <td><code>nil</code></td>
1249
+ </tr>
1250
+ <tr>
1251
+ <td>user</td>
1252
+ <td>
1253
+ A user name or user ID that we should change to before running this command.
1254
+ </td>
1255
+ <td><code>nil</code></td>
1256
+ </tr>
1257
+ <tr>
1258
+ <td>user</td>
1259
+ <td>
1260
+ A users's isolated RVM installation on which to apply an action. The
1261
+ default value of <code>nil</code> denotes a system-wide RVM
1262
+ installation is being targeted. <b>Note:</b> if specified, the
1263
+ user must already exist.
1264
+ </td>
1265
+ <td><code>nil</code></td>
1266
+ </tr>
1267
+ <tr>
1268
+ <td>umask</td>
1269
+ <td>
1270
+ Umask for files created by the command.
1271
+ </td>
1272
+ <td><code>nil</code></td>
1273
+ </tr>
1274
+ </tbody>
1275
+ </table>
1276
+
1277
+ #### <a name="lwrps-rvmshell-examples"></a> Examples
1278
+
1279
+ ##### Run A Rake Task
1280
+
1281
+ rvm_shell "migrate_rails_database" do
1282
+ ruby_string "1.8.7-p352@webapp"
1283
+ user "deploy"
1284
+ group "deploy"
1285
+ cwd "/srv/webapp/current"
1286
+ code %{rake RAILS_ENV=production db:migrate}
1287
+ end
1288
+
1289
+ ### <a name="lwrps-rvmwrapper"></a> rvm_wrapper
1290
+
1291
+ This resource creates a wrapper script for a binary or list of binaries in
1292
+ a given RVM Ruby (and optional gemset). The given Ruby will be installed if
1293
+ it isn't already and a gemset will be created in none currently exist.
1294
+
1295
+ #### <a name="lwrps-rvmwrapper-actions"></a> Actions
1296
+
1297
+ <table>
1298
+ <thead>
1299
+ <tr>
1300
+ <th>Action</th>
1301
+ <th>Description</th>
1302
+ <th>Default</th>
1303
+ </tr>
1304
+ </thead>
1305
+ <tbody>
1306
+ <tr>
1307
+ <td>create</td>
1308
+ <td>Creates on or more wrapper scripts.</td>
1309
+ <td>Yes</td>
1310
+ </tr>
1311
+ </tbody>
1312
+ </table>
1313
+
1314
+ #### <a name="lwrps-rvmwrapper-attributes"></a> Attributes
1315
+
1316
+ <table>
1317
+ <thead>
1318
+ <tr>
1319
+ <th>Attribute</th>
1320
+ <th>Description</th>
1321
+ <th>Default Value</th>
1322
+ </tr>
1323
+ </thead>
1324
+ <tbody>
1325
+ <tr>
1326
+ <td>prefix</td>
1327
+ <td>
1328
+ <b>Name attribute:</b> a prefix string for the wrapper script name.
1329
+ </td>
1330
+ <td><code>nil</code></td>
1331
+ </tr>
1332
+ <tr>
1333
+ <td>ruby_string</td>
1334
+ <td>
1335
+ An RVM Ruby string that could contain a gemset. If a gemset is given
1336
+ (for example, <code>"ruby-1.8.7-p330@awesome"</code>), then it will
1337
+ be used.
1338
+ </td>
1339
+ <td><code>nil</code></td>
1340
+ </tr>
1341
+ <tr>
1342
+ <td>binary</td>
1343
+ <td>
1344
+ A single binary to be wrapped. If this attribute is used do not set
1345
+ values for the <code>binaries</code> attribute.
1346
+ </td>
1347
+ <td><code>nil</code></td>
1348
+ </tr>
1349
+ <tr>
1350
+ <td>binaries</td>
1351
+ <td>
1352
+ A list of binaries to be wrapped. If this attribute is used do not set
1353
+ a value for the <code>binary</code> attribute.
1354
+ </td>
1355
+ <td><code>nil</code></td>
1356
+ </tr>
1357
+ <tr>
1358
+ <td>user</td>
1359
+ <td>
1360
+ A users's isolated RVM installation on which to apply an action. The
1361
+ default value of <code>nil</code> denotes a system-wide RVM
1362
+ installation is being targeted. <b>Note:</b> if specified, the user
1363
+ must already exist.
1364
+ </td>
1365
+ <td><code>nil</code></td>
1366
+ </tr>
1367
+ </tbody>
1368
+ </table>
1369
+
1370
+ **Note:** only `binary` or `binaries` should be used by themselves (never at
1371
+ the same time).
1372
+
1373
+ #### <a name="lwrps-rvmwrapper-examples"></a> Examples
1374
+
1375
+ ##### Wrapping A Ruby CLI
1376
+
1377
+ rvm_wrapper "sys" do
1378
+ ruby_string "jruby@utils"
1379
+ binary "thor"
1380
+ end
1381
+
1382
+ This will create a wrapper script called `sys_thor` in the `bin` directory
1383
+ under `node['rvm']['root_path']`.
1384
+
1385
+ ##### Wrapping A List Of Binaries
1386
+
1387
+ rvm_wrapper "test" do
1388
+ ruby_string "default@testing"
1389
+ binaries [ "rspec", "cucumber" ]
1390
+ action :create
1391
+ end
1392
+
1393
+ ## <a name="contributing"></a> Contributing
1394
+
1395
+ See the CONTRIBUTING.md file
1396
+
1397
+ ### Testing
1398
+
1399
+ Make sure you have the following requirements setup:
1400
+
1401
+ * [Vagrant][vagrant]
1402
+ * [vagrant-berkshelf][vagrant-berkshelf]
1403
+
1404
+ After you `bundle install` run `rake` for unit tests and `kitchen test` for
1405
+ integration level tests.
1406
+
1407
+ ## <a name="license"></a> License and Author
1408
+
1409
+ Author:: [Fletcher Nichol][fnichol] (<fnichol@nichol.ca>) [![endorse](http://api.coderwall.com/fnichol/endorsecount.png)](http://coderwall.com/fnichol)
1410
+
1411
+
1412
+ Contributors:: https://github.com/fnichol/chef-rvm/contributors
1413
+
1414
+ Copyright:: 2010 - 2014, Fletcher Nichol
1415
+
1416
+ Licensed under the Apache License, Version 2.0 (the "License");
1417
+ you may not use this file except in compliance with the License.
1418
+ You may obtain a copy of the License at
1419
+
1420
+ http://www.apache.org/licenses/LICENSE-2.0
1421
+
1422
+ Unless required by applicable law or agreed to in writing, software
1423
+ distributed under the License is distributed on an "AS IS" BASIS,
1424
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1425
+ See the License for the specific language governing permissions and
1426
+ limitations under the License.
1427
+
1428
+ [berkshelf]: http://berkshelf.com
1429
+ [chef_gem_cb]: http://community.opscode.com/cookbooks/chef_gem
1430
+ [chef_repo]: https://github.com/opscode/chef-repo
1431
+ [cheffile]: https://github.com/applicationsonline/librarian/blob/master/lib/librarian/chef/templates/Cheffile
1432
+ [compilation]: http://wiki.opscode.com/display/chef/Evaluate+and+Run+Resources+at+Compile+Time
1433
+ [dragons]: http://en.wikipedia.org/wiki/Here_be_dragons
1434
+ [gem_package]: http://wiki.opscode.com/display/chef/Resources#Resources-Package
1435
+ [gem_package_options]: http://wiki.opscode.com/display/chef/Resources#Resources-GemPackageOptions
1436
+ [gh50]: https://github.com/fnichol/chef-rvm/issues/50
1437
+ [fnichol]: https://github.com/fnichol
1438
+ [java_cb]: http://community.opscode.com/cookbooks/java
1439
+ [jruby]: http://jruby.org/
1440
+ [kgc]: https://github.com/websterclay/knife-github-cookbooks#readme
1441
+ [librarian]: https://github.com/applicationsonline/librarian#readme
1442
+ [lwrp]: http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+%28LWRP%29
1443
+ [package_resource]: http://wiki.opscode.com/display/chef/Resources#Resources-Package
1444
+ [rvm]: https://rvm.io
1445
+ [rvm_create_gemset]: https://rvm.io/gemsets/creating/
1446
+ [rvm_delete_gemset]: https://rvm.io/gemsets/deleting/
1447
+ [rvm_empty_gemset]: https://rvm.io/gemsets/emptying/
1448
+ [rvm_default]: https://rvm.io/rubies/default/
1449
+ [rvm_gemsets]: https://rvm.io/gemsets/
1450
+ [rvm_install]: https://rvm.io/rvm/install/
1451
+ [rvm_remove]: https://rvm.io/rubies/removing/
1452
+ [rvm_ruby_install]: https://rvm.io/rubies/installing/
1453
+ [rvm_upgrading]: https://rvm.io/rvm/upgrading/
1454
+ [script_resource]: http://wiki.opscode.com/display/chef/Resources#Resources-Script
1455
+ [vagrant]: http://vagrantup.com
1456
+ [vagrant-berkshelf]: https://github.com/RiotGames/vagrant-berkshelf
1457
+
1458
+ [repo]: https://github.com/fnichol/chef-rvm
1459
+ [issues]: https://github.com/fnichol/chef-rvm/issues