flombe 0.1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/Flombefile +9 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +57 -0
- data/LICENSE +20 -0
- data/Rakefile +33 -0
- data/bin/flombe +17 -0
- data/config/rake.rb +38 -0
- data/cookbooks/homebrew/README.rdoc +8 -0
- data/cookbooks/homebrew/metadata.rb +8 -0
- data/cookbooks/homebrew/providers/homebrew.rb +39 -0
- data/cookbooks/homebrew/recipes/default.rb +42 -0
- data/cookbooks/homebrew/resources/homebrew.rb +14 -0
- data/cookbooks/mysql/README.rdoc +8 -0
- data/cookbooks/mysql/metadata.rb +6 -0
- data/cookbooks/mysql/recipes/default.rb +43 -0
- data/cookbooks/mysql/recipes/timezone.rb +10 -0
- data/cookbooks/redis/README.rdoc +8 -0
- data/cookbooks/redis/metadata.rb +6 -0
- data/cookbooks/redis/recipes/2.0.4.rb +24 -0
- data/cookbooks/redis/recipes/default.rb +7 -0
- data/cookbooks/rvm/CHANGELOG.md +19 -0
- data/cookbooks/rvm/README.md +564 -0
- data/cookbooks/rvm/Rakefile +35 -0
- data/cookbooks/rvm/attributes/default.rb +54 -0
- data/cookbooks/rvm/attributes/gem_package.rb +23 -0
- data/cookbooks/rvm/attributes/vagrant.rb +22 -0
- data/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
- data/cookbooks/rvm/libraries/helpers.rb +334 -0
- data/cookbooks/rvm/libraries/rvm_rubygems_package.rb +108 -0
- data/cookbooks/rvm/metadata.json +271 -0
- data/cookbooks/rvm/metadata.rb +95 -0
- data/cookbooks/rvm/providers/default_ruby.rb +46 -0
- data/cookbooks/rvm/providers/environment.rb +50 -0
- data/cookbooks/rvm/providers/gemset.rb +135 -0
- data/cookbooks/rvm/providers/global_gem.rb +99 -0
- data/cookbooks/rvm/providers/ruby.rb +100 -0
- data/cookbooks/rvm/providers/shell.rb +68 -0
- data/cookbooks/rvm/providers/wrapper.rb +58 -0
- data/cookbooks/rvm/recipes/default.rb +73 -0
- data/cookbooks/rvm/recipes/gem_package.rb +23 -0
- data/cookbooks/rvm/recipes/system.rb +69 -0
- data/cookbooks/rvm/recipes/user.rb +47 -0
- data/cookbooks/rvm/recipes/vagrant.rb +30 -0
- data/cookbooks/rvm/resources/default_ruby.rb +29 -0
- data/cookbooks/rvm/resources/environment.rb +29 -0
- data/cookbooks/rvm/resources/gem.rb +36 -0
- data/cookbooks/rvm/resources/gemset.rb +30 -0
- data/cookbooks/rvm/resources/global_gem.rb +33 -0
- data/cookbooks/rvm/resources/ruby.rb +29 -0
- data/cookbooks/rvm/resources/shell.rb +40 -0
- data/cookbooks/rvm/resources/wrapper.rb +32 -0
- data/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
- data/cookbooks/utils/README.rdoc +8 -0
- data/cookbooks/utils/metadata.rb +6 -0
- data/cookbooks/utils/recipes/default.rb +10 -0
- data/cookbooks/utils/recipes/dotfiles.rb +21 -0
- data/cookbooks/utils/templates/default/dot.profile.erb +36 -0
- data/flombe.gemspec +28 -0
- data/lib/flombe/dsl.rb +66 -0
- data/lib/flombe.rb +107 -0
- data/spec/dsl_spec.rb +111 -0
- data/spec/flombe_spec.rb +30 -0
- data/spec/quality_spec.rb +11 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/helpers.rb +18 -0
- data/spec/support/matchers.rb +9 -0
- data/spec/support/path.rb +21 -0
- data/templates/chef_solo.erb +11 -0
- metadata +154 -0
@@ -0,0 +1,271 @@
|
|
1
|
+
{
|
2
|
+
"name": "rvm",
|
3
|
+
"description": "Installs and manages RVM. Includes several LWRPs.",
|
4
|
+
"long_description": "# DESCRIPTION\n\nInstalls a system-wide RVM and manages installed rubies. Several lightweight\nresources and providers (LWRP) are also defined.\n\n# REQUIREMENTS\n\n## Platform\n\nTested on Ubuntu 10.04/10.10, Debian 6.0, and OpenSuSE 11.4. Also reported\nto work on CentOS, Redhat and Fedora.\n\n## Cookbooks\n\nThere are no explicit external cookbook dependencies. However, the Opscode\n*java* cookbook can be used when installing JRuby.\n\n# RECIPES\n\n## default\n\nInstalls RVM system-wide, builds RVM Rubies, sets a default Ruby, installs\nany gems and global gems. **Note** that the `system` recipe is included to\ninstall RVM.\n\n## system\n\nInstalls any package dependencies and installs RVM system-wide.\n\n## vagrant\n\nAn optional recipe if Chef is installed in a non-RVM Ruby in a\n[Vagrant](http://vagrantup.com) virtual machine. This recipe adds the\ndefault vagrant user to the RVM unix group and installs a `chef-solo`\nwrapper script so Chef doesn't need to be re-installed in the default\nRVM Ruby.\n\n## gem_package\n\nAn experimental recipe that patches the\n[gem_package resource](http://wiki.opscode.com/display/chef/Resources#Resources-Package)\nto use the `Chef::Provider::Package::RVMRubygems` provider. An attribute\n`rvm/gem_package/rvm_string` will determine which RVM ruby is used for\ninstall/remove/upgrade/purge actions. This may help when using a third\nparty or upstream cookbook that assumes a non-RVM managed system ruby.\n\n**Warning:** Here be dragons! This is either brilliant or the dumbest idea\never, so feedback is appreciated.\n\n# USAGE\n\nThe typical case will be to include the `rvm` recipe which will install RVM\nsystem-wide, install all listed RVM rubies and gems and set a default RVM ruby.\n\nIf node is running in a Vagrant VM, then the `rvm::vagrant` recipe can help\nwith resolving the *chef-solo* binary on subsequent provision executions.\n\nThere are also several resources declared which can be used in other recipes\nthat are RVM-supported. See below for more details.\n\n# ATTRIBUTES\n\n## `default_ruby`\n\nThe default ruby for RVM. If the RVM ruby is not installed, it will be\nbuilt as a pre-requisite. The value can also contain a gemset in the form of\n`\"ruby-1.8.7-p330@awesome\"`.\n\n**Note:** a fully qualified RVM string name needs to be used, which can be\nfound when running `rvm list known`.\n\nThe default is `\"ruby-1.9.2-p180\"`. To disable a default ruby from being\nset, use an empty string (`\"\"`) or a value of `\"system\"`.\n\n## `rubies`\n\nA list of additional RVM rubies to be built and installed. This list does not need to\nnecessarily contain your default ruby as the `rvm_default_ruby` resource will take\ncare of installing itself. For example:\n\n node['rvm']['rubies'] = [ \"ree-1.8.7\", \"jruby-1.5.6\" ]\n\n**Note:** a fully qualified RVM string name needs to be used, which can be\nfound when running `rvm list known`.\n\nThe default is an empty array. To disable a default ruby from being\ninstalled, see the `install_rubies` attribute.\n\n## `install_rubies`\n\nCan enable or disable installation of a default ruby and additional rubies set\nattribute metadata. The primary use case for this attribute is when you don't\nwant any rubies installed (but you want RVM installed). To do so:\n\n node['rvm']['install_rubies'] = \"false\"\n\nThe default is `\"true\"`.\n\n## `global_gems`\n\nA list of gem hashes to be installed into the *global* gemset in each\ninstalled RVM ruby. The RVM global.gems files will be added to and all\ninstalled rubies will be iterated over to ensure full installation coverage.\nSee the `rvm_gem` resource for more details about the options for each\ngem hash. The default puts bundler in each ruby:\n\n node['rvm']['global_gems'] = [\n { 'name' => \"bundler\" }\n ]\n\n## `gems`\n\nA list of gem hashes to be installed into arbitrary RVM rubies and gemsets.\nSee the `rvm_gem` resource for more details about the options for each gem\nhash and target ruby environment. The default is an empty hash.\n\n## `rvmrc`\n\nA hash of system-wide `rvmrc` options. The key is the RVM setting name\n(in String or Symbol form) and the value is the desired setting value.\nAn example used on a build box might be:\n\n node['rvm']['rvmrc'] = {\n 'rvm_gemset_create_on_use_flag' => 1,\n 'rvm_trust_rvmrcs_flag' => 1\n }\n\nThe default is an empty hash.\n\n## `branch`\n\nA specific git branch to use when installing system-wide. For example:\n\n node['rvm']['branch'] = \"crazy\"\n\nThe default is `nil` which corresponds to the master branch.\n\n## `version`\n\nA specific tagged version to use when installing system-wide. This value is\npassed directly to the `rvm-installer` script and current valid values are:\n`\"head\"` (the default, last git commit), `\"latest\"` (last tagged release\nversion) and a specific tagged version of the form `\"1.2.3\"`. You may want\nto use a specific version of RVM to prevent differences in deployment from\none day to the next (RVM head moves pretty darn quickly):\n\n node['rvm']['version'] = \"1.5.3\"\n\nThe default is `nil`, which corresponds to RVM `\"head\"`.\n\n## `upgrade`\n\nDetermines how to handle installing updates to the RVM framework. There are\ncurrently 3 valid values:\n\n* `\"none\"`, `false`, or `nil`: will not update RVM and leave it in its\n current state. **Note** that this is the default.\n* `\"latest\"`: runs `rvm get latest` which downloads and installs the latest\n *\"stable\"* RVM release listed by\n [http://rvm.beginrescueend.com/releases/stable-version.txt](http://rvm.beginrescueend.com/releases/stable-version.txt).\n* `\"head\"`: runs the infamous `rvm get head` which clones (via git) and installs\n the latest RVM repository HEAD.\n\n## `root_path`\n\nThe path prefix to RVM in a system-wide installation. The default is\n`\"/usr/local/rvm\"`.\n\n## `installer_url`\n\nThe URL that provides the RVM installer. The default is\n`http://rvm.beginrescueend.com/install/rvm`.\n\n## `group_users`\n\nA list of users that will be added to the `rvm` group. These users\nwill then be able to manage RVM in a system-wide installation. The default\nis an empty list.\n\n## `rvm_gem_options`\n\nThese options are passed to the *gem* command in a RVM environment.\nIn the interest of speed, rdoc and ri docs will not be generated by default.\nTo re-enable the documentation generation set:\n\n node['rvm']['rvm_gem_options'] = \"--rdoc --ri\"\n\nThe default is `\"--no-rdoc --no-ri\"`.\n\n## `vagrant/system_chef_solo`\n\nIf using the `vagrant` recipe, this sets the path to the package-installed\n*chef-solo* binary. The default is `\"/usr/bin/chef-solo\"`.\n\n## `gem_package/rvm_string`\n\nIf using the `gem_package` recipe, this determines which ruby will be used by the\n`gem_package` resource in other cookbooks. The default is the value of the\n`default_ruby` attribute.\n\n# RESOURCES AND PROVIDERS\n\n## rvm_ruby\n\n### Actions\n\nAction |Description |Default\n----------|------------------------------|-------\ninstall |Build and install an RVM ruby. See [RVM rubies/installing](http://rvm.beginrescueend.com/rubies/installing/) for more details. |Yes\nremove |Remove the ruby, source files and optional gemsets/archives. See [RVM rubies/removing](http://rvm.beginrescueend.com/rubies/removing/) for more details. |\nuninstall |Just remove the ruby and leave everything else. See [RVM rubies/removing](http://rvm.beginrescueend.com/rubies/removing/) for more details. |\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\nruby_string |**Name attribute:** a fully qualified RVM ruby string that could contain a gemset. See the section *RVM Ruby Strings* for more details. If a gemset is given (for example, `\"ruby-1.8.7-p330@awesome\"`), then it will be stripped. |`nil`\n\n### Examples\n\n#### Install Ruby\n\n rvm_ruby \"ree-1.8.7-2011.01\" do\n action :install\n end\n\n rvm_ruby \"jruby-1.5.6\"\n\n**Note:** the install action is default, so the second example is a more common\nusage.\n\n#### Remove Ruby\n\n rvm_ruby \"ree-1.8.7-2011.01\" do\n action :remove\n end\n\n**Note:** the RVM documentation mentions that this method is far preferred to\nusing uninstall since it purges almost everything.\n\n#### Uninstall Ruby\n\n rvm_ruby \"ree-1.8.7-2011.01\" do\n action :uninstall\n end\n\n## rvm_default_ruby\n\nThis resource sets the default RVM ruby, optionally with gemset. The given\nruby will be installed if it isn't already and a gemset will be created in\nnone currently exist. If multiple declarations are used then the last executed\none \"wins\".\n\n### Actions\n\nAction |Description |Default\n----------|------------------------------|-------\ncreate |Set the default RVM ruby. See [RVM rubies/default](http://rvm.beginrescueend.com/rubies/default/) for more details. |Yes\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\nruby_string |**Name attribute:** a fully qualified RVM ruby string that could contain a gemset. See the section *RVM Ruby Strings* for more details. If a gemset is given (for example, `\"ruby-1.8.7-p330@awesome\"`), then it will be included. |`nil`\n\n### Examples\n\n#### Setting The Default Ruby\n\n rvm_default_ruby \"ree-1.8.7-2011.01\" do\n action :create\n end\n\n rvm_default_ruby \"jruby-1.5.6\"\n\n**Note:** the create action is default, so the second example is a more common\nusage.\n\n## rvm_environment\n\nThis resource ensures that the specified RVM ruby is installed and the optional\ngemset is created. It is a convenience resource which wraps `rvm_ruby` and\n`rvm_gemset` so it can be used as a sort of *über ruby* resource which\nparallels the `rvm_default_ruby` resource.\n\n### Actions\n\nAction |Description |Default\n-------|------------------------------|-------\ncreate |Installs the specified RVM ruby and gemset. |Yes\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\nruby_string |**Name attribute:** a fully qualified RVM ruby string that could contain a gemset. See the section *RVM Ruby Strings* for more details. If a gemset is given (for example, `\"ruby-1.8.7-p330@awesome\"`), then it will be used. |`nil`\n\n### Examples\n\n#### Creating A Passenger Environment In Production\n\n rvm_environment \"ree-1.8.7-2011.01@passenger\"\n\n## rvm_gemset\nSee [RVM gemsets](http://rvm.beginrescueend.com/gemsets/) for more background\nconcerning gemsets.\n\n### Actions\n\nAction |Description |Default\n----------|------------------------------|-------\ncreate |Creates a new gemset in a given RVM ruby. See [RVM gemsets/creating](http://rvm.beginrescueend.com/gemsets/creating/) for more details. |Yes\nupdate |Update all gems installed to the gemset in a given RVM ruby. |\nempty |Remove all gems installed to the gemset in a given RVM ruby. See [RVM gemsets/emptying](http://rvm.beginrescueend.com/gemsets/emptying/) for more details. |\ndelete |Delete gemset from the given RVM ruby. See [RVM gemsets/deleting](http://rvm.beginrescueend.com/gemsets/deleting/) for more details. |\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\ngemset |**Name attribute:** Either a fully qualified RVM ruby string containing a gemset or a bare gemset name. If only the gemset name is given, then the `ruby_string` attribute must be used to indicate which RVM ruby to target. |`nil`\nruby_string |A fully qualified RVM ruby string that should not contain a gemset. See the section *RVM Ruby Strings* for more details. |`nil`\n\n### Examples\n\n#### Creating A Gemset\n\n rvm_gemset \"rails\" do\n ruby_string \"ruby-1.9.2-p136\"\n action :create\n end\n\n rvm_gemset \"ruby-1.9.2-p136@rails\"\n\n**Note:** the create action is default, so the second example is a more common\nusage.\n\n#### Updating A Gemset\n\n rvm_gemset \"jruby-1.6.0.RC2@development\" do\n action :update\n end\n\n#### Emptying A Gemset\n\n rvm_gemset \"development\" do\n ruby_string \"jruby-1.6.0.RC2\"\n action :empty\n end\n\n#### Deleting A Gemset\n\n rvm_gemset \"ruby-1.9.2-p136@rails\" do\n action :delete\n end\n\n## rvm_gem\nThis resource is a close analog to the `gem_package` provider/resource which\nis RVM-aware. See the Opscode\n[package resource](http://wiki.opscode.com/display/chef/Resources#Resources-Package)\nand [gem package options](http://wiki.opscode.com/display/chef/Resources#Resources-GemPackageOptions)\npages for more details.\n\n### Actions\n\nAction |Description |Default\n----------|------------------------------|-------\ninstall |Install a gem - if version is provided, install that specific version. |Yes\nupgrade |Upgrade a gem - if version is provided, upgrade to that specific version.|\nremove |Remove a gem.|\npurge |Purge a gem.|\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\npackage_name |**Name Attribute:** the name of the gem to install.|`nil`\nruby_string |A fully qualified RVM ruby string that could contain a gemset. See the section *RVM Ruby Strings* for more details. If a gemset is given (for example, `\"ruby-1.8.7-p330@awesome\"`), then it will be used. |`\"default\"`\nversion |The specific version of the gem to install/upgrade. |`nil`\noptions |Add additional options to the underlying gem command. |`nil`\nsource |Provide an additional source for gem providers (such as rubygems). |`nil`\n\n### Examples\n\n#### Install A Gem\n\n rvm_gem \"thor\" do\n ruby_string \"ruby-1.8.7-p330\"\n action :install\n end\n\n rvm_gem \"json\" do\n ruby_string \"ruby-1.8.7-p330@awesome\"\n end\n\n rvm_gem \"nokogiri\" do\n ruby_string \"jruby-1.5.6\"\n version \"1.5.0.beta.4\"\n action :install\n end\n\n**Note:** the install action is default, so the second example is a more common\nusage. Gemsets can also be specified.\n\n#### Keep A Gem Up To Date\n\n rvm_gem \"homesick\" do\n action :upgrade\n end\n\n**Note:** the default RVM ruby will be targetted if no `ruby_string` attribute\nis given.\n\n#### Remove A Gem\n\n rvm_gem \"nokogiri\" do\n ruby_string \"jruby-1.5.6\"\n version \"1.4.4.2\"\n action :remove\n end\n\n## rvm_global_gem\nThis resource will use the `rvm_gem` resource to manage a gem in the *global*\ngemset accross all RVM rubies. An entry will also be made/removed in RVM's\n*global.gems* file. See the Opscode\n[package resource](http://wiki.opscode.com/display/chef/Resources#Resources-Package)\nand [gem package options](http://wiki.opscode.com/display/chef/Resources#Resources-GemPackageOptions)\npages for more details.\n\n### Actions\n\nAction |Description |Default\n----------|------------------------------|-------\ninstall |Install a gem across all rubies - if version is provided, install that specific version. |Yes\nupgrade |Upgrade a gem across all rubies - if version is provided, upgrade to that specific version.|\nremove |Remove a gem across all rubies.|\npurge |Purge a gem across all rubies.|\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\npackage_name |**Name Attribute:** the name of the gem to install.|`nil`\nversion |The specific version of the gem to install/upgrade. |`nil`\noptions |Add additional options to the underlying gem command. |`nil`\nsource |Provide an additional source for gem providers (such as rubygems). |`nil`\ngem_binary |A gem_package attribute to specify a gem binary. |`gem`\n\n## rvm_shell\nThis resource is a wrapper for the `script` resource which wraps the code block\nin an RVM-aware environment.. See the Opscode [script resource](http://wiki.opscode.com/display/chef/Resources#Resources-Script) page for more details.\n\n### Actions\n\nAction |Description |Default\n----------|------------------------------|-------\nrun |Run the script |Yes\nnothing |Do not run this command |\n\nUse `action :nothing` to set a command to only run if another resource\nnotifies it.\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\nname |**Name Attribute:** Name of the command to execute. |name\nruby_string |A fully qualified RVM ruby string that could contain a gemset. See the section *RVM Ruby Strings* for more details. If a gemset is given (for example, `\"ruby-1.8.7-p330@awesome\"`), then it will be used. |`\"default\"`\ncode |Quoted script of code to execute. |`nil`\ncreates |A file this command creates - if the file exists, the command will not be run. |`nil`\ncwd |Current working director to run the command from. |`nil`\nenvironment |A has of environment variables to set before running this command. |`nil`\ngroup |A group or group ID that we should change to before running this command. |`nil`\npath |An array of paths to use when searching for the command. |`nil`, uses system path\nreturns |The return value of the command (may be an array of accepted values) - this resource raises an exception if the return value(s) do not match. |`0`\ntimeout |How many seconds to let the command run before timing out. |`nil`\nuser |A user name or user ID that we should change to before running this command. |`nil`\numask |Umask for files created by the command. |`nil`\n\n### Examples\n\n#### Run A Rake Task\n\n rvm_shell \"migrate_rails_database\" do\n ruby_string \"ruby-1.8.7-p334@webapp\"\n user \"deploy\"\n group \"deploy\"\n cwd \"/srv/webapp/current\"\n code %{rake RAILS_ENV=production db:migrate}\n end\n\n## rvm_wrapper\n\nThis resource creates a wrapper script for a binary or list of binaries in\na given RVM ruby (and optional gemset). The given ruby will be installed if\nit isn't already and a gemset will be created in none currently exist.\n\n### Actions\n\nAction |Description |Default\n-------|------------------------------|-------\ncreate |Creates one or more wrapper scripts. |Yes\n\n### Attributes\n\nAttribute |Description |Default value\n------------|------------|-------------\nprefix |**Name attribute:** a prefix string for the wrapper script name. |`nil`\nruby_string |A fully qualified RVM ruby string that could contain a gemset. See the section *RVM Ruby Strings* for more details. If a gemset is given (for example, `\"ruby-1.8.7-p330@awesome\"`), then it will be used. |`nil`\nbinary |A single binary to be wrapped. If this attribute is used do not set values for the `binaries` attribute. |`nil`\nbinaries |A list of binaries to be wrapped. If this attribute is used do not set a value for the `binary` attribute. |`nil`\n\n**Note:** only `binary` or `binaries` should be used by themselves (never at\nthe same time).\n\n### Examples\n\n#### Wrapping A Ruby CLI\n\n rvm_wrapper \"sys\" do\n ruby_string \"jruby-1.5.6@utils\"\n binary \"thor\"\n end\n\nThis will create a wrapper script called `sys_thor` in the `bin` directory\nunder `node['rvm']['root_path']`.\n\n#### Wrapping A List Of Binaries\n\n rvm_wrapper \"test\" do\n ruby_string \"default@testing\"\n binaries [ \"rspec\", \"cucumber\" ]\n action :create\n end\n\n# DEVELOPMENT\n\n* Source hosted at [GitHub](https://github.com/fnichol/chef-rvm)\n* Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/fnichol/chef-rvm/issues)\n\nPull requests are very welcome! Make sure your patches are well tested.\nIdeally create a topic branch for every seperate change you make.\n\n# LICENSE and AUTHOR\n\nAuthor:: Fletcher Nichol (<fnichol@nichol.ca>)\n\nContributors:: Bram Swenson (<bram@craniumisajar.com>)\n\nContributors:: Phil Cohen (http://phlippers.net/)\n\nCopyright:: 2010, 2011, Fletcher Nichol\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
5
|
+
"maintainer": "Fletcher Nichol",
|
6
|
+
"maintainer_email": "fnichol@nichol.ca",
|
7
|
+
"license": "Apache 2.0",
|
8
|
+
"platforms": {
|
9
|
+
"debian": [
|
10
|
+
|
11
|
+
],
|
12
|
+
"ubuntu": [
|
13
|
+
|
14
|
+
],
|
15
|
+
"suse": [
|
16
|
+
|
17
|
+
],
|
18
|
+
"centos": [
|
19
|
+
|
20
|
+
],
|
21
|
+
"redhat": [
|
22
|
+
|
23
|
+
],
|
24
|
+
"fedora": [
|
25
|
+
|
26
|
+
]
|
27
|
+
},
|
28
|
+
"dependencies": {
|
29
|
+
},
|
30
|
+
"recommendations": {
|
31
|
+
},
|
32
|
+
"suggestions": {
|
33
|
+
},
|
34
|
+
"conflicting": {
|
35
|
+
},
|
36
|
+
"providing": {
|
37
|
+
},
|
38
|
+
"replacing": {
|
39
|
+
},
|
40
|
+
"attributes": {
|
41
|
+
"rvm/default_ruby": {
|
42
|
+
"display_name": "Default ruby",
|
43
|
+
"description": "The default ruby for RVM. If the RVM ruby is not installed, it will be built as a pre-requisite.",
|
44
|
+
"default": "ruby-1.9.2-p180",
|
45
|
+
"choice": [
|
46
|
+
|
47
|
+
],
|
48
|
+
"calculated": false,
|
49
|
+
"type": "string",
|
50
|
+
"required": "optional",
|
51
|
+
"recipes": [
|
52
|
+
|
53
|
+
]
|
54
|
+
},
|
55
|
+
"rvm/rubies": {
|
56
|
+
"display_name": "Installed RVM rubies",
|
57
|
+
"description": "A list of RVM rubies to be built and installed. If this list is emptied then no rubies (not even the default) will be built and installed. The default is the an array containing the value of rvm/default_ruby.",
|
58
|
+
"type": "array",
|
59
|
+
"default": [
|
60
|
+
"node[:rvm][:default_ruby]"
|
61
|
+
],
|
62
|
+
"choice": [
|
63
|
+
|
64
|
+
],
|
65
|
+
"calculated": false,
|
66
|
+
"required": "optional",
|
67
|
+
"recipes": [
|
68
|
+
|
69
|
+
]
|
70
|
+
},
|
71
|
+
"rvm/install_rubies": {
|
72
|
+
"display_name": "Can enable or disable installation of a default ruby and additional rubies set attribute metadata.",
|
73
|
+
"description": "Can enable or disable installation of a default ruby and additional rubies set attribute metadata. The primary use case for this attribute is when you don't want any rubies installed (but you want RVM installed).",
|
74
|
+
"default": "true",
|
75
|
+
"choice": [
|
76
|
+
|
77
|
+
],
|
78
|
+
"calculated": false,
|
79
|
+
"type": "string",
|
80
|
+
"required": "optional",
|
81
|
+
"recipes": [
|
82
|
+
|
83
|
+
]
|
84
|
+
},
|
85
|
+
"rvm/global_gems": {
|
86
|
+
"display_name": "Global gems to be installed in all RVM rubies",
|
87
|
+
"description": "A list of gem hashes to be installed into the *global* gemset in each installed RVM ruby. The RVM global.gems files will be added to and all installed rubies will be iterated over to ensure full installation coverage.",
|
88
|
+
"type": "array",
|
89
|
+
"default": [
|
90
|
+
{
|
91
|
+
"name": "bundler"
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"choice": [
|
95
|
+
|
96
|
+
],
|
97
|
+
"calculated": false,
|
98
|
+
"required": "optional",
|
99
|
+
"recipes": [
|
100
|
+
|
101
|
+
]
|
102
|
+
},
|
103
|
+
"rvm/gems": {
|
104
|
+
"display_name": "Hash of ruby/gemset gem manifests",
|
105
|
+
"description": "A list of gem hashes to be installed into arbitrary RVM rubies and gemsets.",
|
106
|
+
"type": "hash",
|
107
|
+
"default": {
|
108
|
+
},
|
109
|
+
"choice": [
|
110
|
+
|
111
|
+
],
|
112
|
+
"calculated": false,
|
113
|
+
"required": "optional",
|
114
|
+
"recipes": [
|
115
|
+
|
116
|
+
]
|
117
|
+
},
|
118
|
+
"rvm/rvmrc": {
|
119
|
+
"display_name": "Hash of rvmrc options",
|
120
|
+
"description": "A hash of system-wide `rvmrc` options. The key is the RVM setting name (in String or Symbol form) and the value is the desired setting value. See RVM documentation for rvmrc options.",
|
121
|
+
"type": "hash",
|
122
|
+
"default": {
|
123
|
+
},
|
124
|
+
"choice": [
|
125
|
+
|
126
|
+
],
|
127
|
+
"calculated": false,
|
128
|
+
"required": "optional",
|
129
|
+
"recipes": [
|
130
|
+
|
131
|
+
]
|
132
|
+
},
|
133
|
+
"rvm/branch": {
|
134
|
+
"display_name": "A specific git branch to use when installing system-wide.",
|
135
|
+
"description": "A specific git branch to use when installing system-wide.",
|
136
|
+
"default": "nil",
|
137
|
+
"choice": [
|
138
|
+
|
139
|
+
],
|
140
|
+
"calculated": false,
|
141
|
+
"type": "string",
|
142
|
+
"required": "optional",
|
143
|
+
"recipes": [
|
144
|
+
|
145
|
+
]
|
146
|
+
},
|
147
|
+
"rvm/version": {
|
148
|
+
"display_name": "A specific tagged version to use when installing system-wide.",
|
149
|
+
"description": "A specific tagged version to use when installing system-wide. This value is passed directly to the `rvm-installer` script and current valid values are: `head` (the default, last git commit), `latest` (last tagged release version) and a specific tagged version of the form `1.2.3`. You may want to use a specific version of RVM to prevent differences in deployment from one day to the next (RVM head moves pretty darn quickly).",
|
150
|
+
"default": "nil",
|
151
|
+
"choice": [
|
152
|
+
|
153
|
+
],
|
154
|
+
"calculated": false,
|
155
|
+
"type": "string",
|
156
|
+
"required": "optional",
|
157
|
+
"recipes": [
|
158
|
+
|
159
|
+
]
|
160
|
+
},
|
161
|
+
"rvm/upgrade": {
|
162
|
+
"display_name": "How to handle updates to RVM framework",
|
163
|
+
"description": "Determines how to handle installing updates to the RVM framework.",
|
164
|
+
"default": "none",
|
165
|
+
"choice": [
|
166
|
+
|
167
|
+
],
|
168
|
+
"calculated": false,
|
169
|
+
"type": "string",
|
170
|
+
"required": "optional",
|
171
|
+
"recipes": [
|
172
|
+
|
173
|
+
]
|
174
|
+
},
|
175
|
+
"rvm/root_path": {
|
176
|
+
"display_name": "RVM system-wide root path",
|
177
|
+
"description": "Root path for system-wide RVM installation",
|
178
|
+
"default": "/usr/local/rvm",
|
179
|
+
"choice": [
|
180
|
+
|
181
|
+
],
|
182
|
+
"calculated": false,
|
183
|
+
"type": "string",
|
184
|
+
"required": "optional",
|
185
|
+
"recipes": [
|
186
|
+
|
187
|
+
]
|
188
|
+
},
|
189
|
+
"rvm/installer_url": {
|
190
|
+
"display_name": "The URL that provides the RVM installer.",
|
191
|
+
"description": "The URL that provides the RVM installer.",
|
192
|
+
"default": "http://rvm.beginrescueend.com/install/rvm",
|
193
|
+
"choice": [
|
194
|
+
|
195
|
+
],
|
196
|
+
"calculated": false,
|
197
|
+
"type": "string",
|
198
|
+
"required": "optional",
|
199
|
+
"recipes": [
|
200
|
+
|
201
|
+
]
|
202
|
+
},
|
203
|
+
"rvm/group_users": {
|
204
|
+
"display_name": "Additional users in rvm group",
|
205
|
+
"description": "Additional users in rvm group that can manage rvm in a system-wide installation.",
|
206
|
+
"type": "array",
|
207
|
+
"default": [
|
208
|
+
|
209
|
+
],
|
210
|
+
"choice": [
|
211
|
+
|
212
|
+
],
|
213
|
+
"calculated": false,
|
214
|
+
"required": "optional",
|
215
|
+
"recipes": [
|
216
|
+
|
217
|
+
]
|
218
|
+
},
|
219
|
+
"rvm/rvm_gem_options": {
|
220
|
+
"display_name": "These options are passed to the 'gem' command in a RVM environment.",
|
221
|
+
"description": "These options are passed to the 'gem' command in a RVM environment. In the interest of speed, rdoc and ri docs will not be generated by default.",
|
222
|
+
"default": "--no-rdoc --no-ri",
|
223
|
+
"choice": [
|
224
|
+
|
225
|
+
],
|
226
|
+
"calculated": false,
|
227
|
+
"type": "string",
|
228
|
+
"required": "optional",
|
229
|
+
"recipes": [
|
230
|
+
|
231
|
+
]
|
232
|
+
},
|
233
|
+
"rvm/vagrant/system_chef_solo": {
|
234
|
+
"display_name": "If using the `vagrant` recipe, this sets the path to the package-installed `chef-solo` binary.",
|
235
|
+
"description": "If using the `vagrant` recipe, this sets the path to the package-installed `chef-solo` binary.",
|
236
|
+
"default": "/usr/bin/chef-solo",
|
237
|
+
"choice": [
|
238
|
+
|
239
|
+
],
|
240
|
+
"calculated": false,
|
241
|
+
"type": "string",
|
242
|
+
"required": "optional",
|
243
|
+
"recipes": [
|
244
|
+
|
245
|
+
]
|
246
|
+
},
|
247
|
+
"rvm/gem_package/rvm_string": {
|
248
|
+
"display_name": "If using the `gem_package` recipe, this determines which ruby will be used by the `gem_package` resource in other cookbooks.",
|
249
|
+
"description": "If using the `gem_package` recipe, this determines which ruby will be used by the `gem_package` resource in other cookbooks.",
|
250
|
+
"default": "node[:rvm][:default_ruby]",
|
251
|
+
"choice": [
|
252
|
+
|
253
|
+
],
|
254
|
+
"calculated": false,
|
255
|
+
"type": "string",
|
256
|
+
"required": "optional",
|
257
|
+
"recipes": [
|
258
|
+
|
259
|
+
]
|
260
|
+
}
|
261
|
+
},
|
262
|
+
"groupings": {
|
263
|
+
},
|
264
|
+
"recipes": {
|
265
|
+
"rvm": "Includes all recipes",
|
266
|
+
"rvm::system": "Installs system-wide RVM",
|
267
|
+
"rvm::vagrant": "An optional recipe to help if running in a Vagrant virtual machine",
|
268
|
+
"rvm::gem_package": "An experimental recipe that patches the gem_package resource"
|
269
|
+
},
|
270
|
+
"version": "0.7.0"
|
271
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
maintainer "Fletcher Nichol"
|
2
|
+
maintainer_email "fnichol@nichol.ca"
|
3
|
+
license "Apache 2.0"
|
4
|
+
description "Installs and manages RVM. Includes several LWRPs."
|
5
|
+
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
6
|
+
version "0.7.0"
|
7
|
+
|
8
|
+
recipe "rvm", "Includes all recipes"
|
9
|
+
recipe "rvm::system", "Installs system-wide RVM"
|
10
|
+
recipe "rvm::vagrant", "An optional recipe to help if running in a Vagrant virtual machine"
|
11
|
+
recipe "rvm::gem_package", "An experimental recipe that patches the gem_package resource"
|
12
|
+
|
13
|
+
%w{ debian ubuntu suse centos redhat fedora }.each do |os|
|
14
|
+
supports os
|
15
|
+
end
|
16
|
+
|
17
|
+
attribute "rvm/default_ruby",
|
18
|
+
:display_name => "Default ruby",
|
19
|
+
:description => "The default ruby for RVM. If the RVM ruby is not installed, it will be built as a pre-requisite.",
|
20
|
+
:default => "ruby-1.9.2-p180"
|
21
|
+
|
22
|
+
attribute "rvm/rubies",
|
23
|
+
:display_name => "Installed RVM rubies",
|
24
|
+
:description => "A list of RVM rubies to be built and installed. If this list is emptied then no rubies (not even the default) will be built and installed. The default is the an array containing the value of rvm/default_ruby.",
|
25
|
+
:type => "array",
|
26
|
+
:default => [ "node[:rvm][:default_ruby]" ]
|
27
|
+
|
28
|
+
attribute "rvm/install_rubies",
|
29
|
+
:display_name => "Can enable or disable installation of a default ruby and additional rubies set attribute metadata.",
|
30
|
+
:description => "Can enable or disable installation of a default ruby and additional rubies set attribute metadata. The primary use case for this attribute is when you don't want any rubies installed (but you want RVM installed).",
|
31
|
+
:default => "true"
|
32
|
+
|
33
|
+
attribute "rvm/global_gems",
|
34
|
+
:display_name => "Global gems to be installed in all RVM rubies",
|
35
|
+
:description => "A list of gem hashes to be installed into the *global* gemset in each installed RVM ruby. The RVM global.gems files will be added to and all installed rubies will be iterated over to ensure full installation coverage.",
|
36
|
+
:type => "array",
|
37
|
+
:default => [ { :name => "bundler" } ]
|
38
|
+
|
39
|
+
attribute "rvm/gems",
|
40
|
+
:display_name => "Hash of ruby/gemset gem manifests",
|
41
|
+
:description => "A list of gem hashes to be installed into arbitrary RVM rubies and gemsets.",
|
42
|
+
:type => "hash",
|
43
|
+
:default => Hash.new
|
44
|
+
|
45
|
+
attribute "rvm/rvmrc",
|
46
|
+
:display_name => "Hash of rvmrc options",
|
47
|
+
:description => "A hash of system-wide `rvmrc` options. The key is the RVM setting name (in String or Symbol form) and the value is the desired setting value. See RVM documentation for rvmrc options.",
|
48
|
+
:type => "hash",
|
49
|
+
:default => Hash.new
|
50
|
+
|
51
|
+
attribute "rvm/branch",
|
52
|
+
:display_name => "A specific git branch to use when installing system-wide.",
|
53
|
+
:description => "A specific git branch to use when installing system-wide.",
|
54
|
+
:default => "nil"
|
55
|
+
|
56
|
+
attribute "rvm/version",
|
57
|
+
:display_name => "A specific tagged version to use when installing system-wide.",
|
58
|
+
:description => "A specific tagged version to use when installing system-wide. This value is passed directly to the `rvm-installer` script and current valid values are: `head` (the default, last git commit), `latest` (last tagged release version) and a specific tagged version of the form `1.2.3`. You may want to use a specific version of RVM to prevent differences in deployment from one day to the next (RVM head moves pretty darn quickly).",
|
59
|
+
:default => "nil"
|
60
|
+
|
61
|
+
attribute "rvm/upgrade",
|
62
|
+
:display_name => "How to handle updates to RVM framework",
|
63
|
+
:description => "Determines how to handle installing updates to the RVM framework.",
|
64
|
+
:default => "none"
|
65
|
+
|
66
|
+
attribute "rvm/root_path",
|
67
|
+
:display_name => "RVM system-wide root path",
|
68
|
+
:description => "Root path for system-wide RVM installation",
|
69
|
+
:default => "/usr/local/rvm"
|
70
|
+
|
71
|
+
attribute "rvm/installer_url",
|
72
|
+
:display_name => "The URL that provides the RVM installer.",
|
73
|
+
:description => "The URL that provides the RVM installer.",
|
74
|
+
:default => "http://rvm.beginrescueend.com/install/rvm"
|
75
|
+
|
76
|
+
attribute "rvm/group_users",
|
77
|
+
:display_name => "Additional users in rvm group",
|
78
|
+
:description => "Additional users in rvm group that can manage rvm in a system-wide installation.",
|
79
|
+
:type => "array",
|
80
|
+
:default => []
|
81
|
+
|
82
|
+
attribute "rvm/rvm_gem_options",
|
83
|
+
:display_name => "These options are passed to the 'gem' command in a RVM environment.",
|
84
|
+
:description => "These options are passed to the 'gem' command in a RVM environment. In the interest of speed, rdoc and ri docs will not be generated by default.",
|
85
|
+
:default => "--no-rdoc --no-ri"
|
86
|
+
|
87
|
+
attribute "rvm/vagrant/system_chef_solo",
|
88
|
+
:display_name => "If using the `vagrant` recipe, this sets the path to the package-installed `chef-solo` binary.",
|
89
|
+
:description => "If using the `vagrant` recipe, this sets the path to the package-installed `chef-solo` binary.",
|
90
|
+
:default => "/usr/bin/chef-solo"
|
91
|
+
|
92
|
+
attribute "rvm/gem_package/rvm_string",
|
93
|
+
:display_name => "If using the `gem_package` recipe, this determines which ruby will be used by the `gem_package` resource in other cookbooks.",
|
94
|
+
:description => "If using the `gem_package` recipe, this determines which ruby will be used by the `gem_package` resource in other cookbooks.",
|
95
|
+
:default => "node[:rvm][:default_ruby]"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: rvm
|
3
|
+
# Provider:: default_ruby
|
4
|
+
#
|
5
|
+
# Author:: Fletcher Nichol <fnichol@nichol.ca>
|
6
|
+
#
|
7
|
+
# Copyright 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
|
+
action :create do
|
23
|
+
ruby_string = new_resource.ruby_string
|
24
|
+
ruby_string = "system" if system_ruby?(ruby_string)
|
25
|
+
rubie = select_ruby(ruby_string)
|
26
|
+
gemset = select_gemset(ruby_string)
|
27
|
+
|
28
|
+
if rubie != "system" && ruby_unknown?(rubie)
|
29
|
+
Chef::Log.warn("rvm_default_ruby[#{rubie}] is either not fully " +
|
30
|
+
"qualified or not known . Use `rvm list known` to get a full list.")
|
31
|
+
elsif ruby_default?(ruby_string)
|
32
|
+
Chef::Log.debug("rvm_ruby[#{ruby_string}] is already default, so skipping")
|
33
|
+
else
|
34
|
+
# ensure ruby is installed and gemset exists (if specified)
|
35
|
+
unless env_exists?(ruby_string)
|
36
|
+
e = rvm_environment ruby_string do
|
37
|
+
action :nothing
|
38
|
+
end
|
39
|
+
e.run_action(:create)
|
40
|
+
end
|
41
|
+
|
42
|
+
Chef::Log.info("Setting default ruby to rvm_ruby[#{ruby_string}]")
|
43
|
+
env = RVM::Environment.new
|
44
|
+
env.rvm :use, ruby_string, :default => true
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: rvm
|
3
|
+
# Provider:: environment
|
4
|
+
#
|
5
|
+
# Author:: Fletcher Nichol <fnichol@nichol.ca>
|
6
|
+
#
|
7
|
+
# Copyright 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
|
+
action :create do
|
23
|
+
ruby_string = new_resource.ruby_string
|
24
|
+
rubie = select_ruby(ruby_string)
|
25
|
+
gemset = select_gemset(ruby_string)
|
26
|
+
|
27
|
+
if ruby_unknown?(rubie)
|
28
|
+
Chef::Log.warn("rvm_environment[#{rubie}] is either not fully " +
|
29
|
+
"qualified or not known . Use `rvm list known` to get a full list.")
|
30
|
+
else
|
31
|
+
if gemset
|
32
|
+
# ensure gemset is created, if specified
|
33
|
+
unless gemset_exists?(:ruby => rubie, :gemset => gemset)
|
34
|
+
g = rvm_gemset gemset do
|
35
|
+
ruby_string rubie
|
36
|
+
action :nothing
|
37
|
+
end
|
38
|
+
g.run_action(:create)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
# ensure ruby version is installed
|
42
|
+
unless ruby_installed?(rubie)
|
43
|
+
r = rvm_ruby rubie do
|
44
|
+
action :nothing
|
45
|
+
end
|
46
|
+
r.run_action(:install)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: rvm
|
3
|
+
# Provider:: gemset
|
4
|
+
#
|
5
|
+
# Author:: Fletcher Nichol <fnichol@nichol.ca>
|
6
|
+
#
|
7
|
+
# Copyright 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
|
+
action :create do
|
23
|
+
if new_resource.ruby_string
|
24
|
+
rubie = normalize_ruby_string(new_resource.ruby_string)
|
25
|
+
gemset = new_resource.gemset
|
26
|
+
else
|
27
|
+
rubie = select_ruby(normalize_ruby_string(new_resource.gemset))
|
28
|
+
gemset = select_gemset(normalize_ruby_string(new_resource.gemset))
|
29
|
+
end
|
30
|
+
full_name = "#{rubie}@#{gemset}"
|
31
|
+
|
32
|
+
unless ruby_installed?(rubie)
|
33
|
+
r = rvm_ruby rubie do
|
34
|
+
action :nothing
|
35
|
+
end
|
36
|
+
r.run_action(:install)
|
37
|
+
end
|
38
|
+
|
39
|
+
if gemset_exists?(:ruby => rubie, :gemset => gemset)
|
40
|
+
Chef::Log.debug("rvm_gemset[#{full_name}] already exists, so skipping")
|
41
|
+
else
|
42
|
+
Chef::Log.info("Creating rvm_gemset[#{full_name}]")
|
43
|
+
|
44
|
+
env = RVM::Environment.new
|
45
|
+
env.use rubie
|
46
|
+
if env.gemset_create gemset
|
47
|
+
update_installed_gemsets(rubie)
|
48
|
+
Chef::Log.debug("Creation of rvm_gemset[#{full_name}] was successful.")
|
49
|
+
else
|
50
|
+
Chef::Log.warn("Failed to create rvm_gemset[#{full_name}].")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
action :delete do
|
56
|
+
if new_resource.ruby_string
|
57
|
+
rubie = normalize_ruby_string(new_resource.ruby_string)
|
58
|
+
gemset = new_resource.gemset
|
59
|
+
else
|
60
|
+
rubie = select_ruby(normalize_ruby_string(new_resource.gemset))
|
61
|
+
gemset = select_gemset(normalize_ruby_string(new_resource.gemset))
|
62
|
+
end
|
63
|
+
full_name = "#{rubie}@#{gemset}"
|
64
|
+
|
65
|
+
if gemset_exists?(:ruby => rubie, :gemset => gemset)
|
66
|
+
Chef::Log.info("Deleting rvm_gemset[#{full_name}]")
|
67
|
+
|
68
|
+
env = RVM::Environment.new
|
69
|
+
env.use rubie
|
70
|
+
if env.gemset_delete gemset
|
71
|
+
update_installed_gemsets(rubie)
|
72
|
+
Chef::Log.debug("Deletion of rvm_gemset[#{full_name}] was successful.")
|
73
|
+
else
|
74
|
+
Chef::Log.warn("Failed to delete rvm_gemset[#{full_name}].")
|
75
|
+
end
|
76
|
+
else
|
77
|
+
Chef::Log.debug("rvm_gemset[#{full_name}] does not exist, so skipping")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
action :empty do
|
82
|
+
if new_resource.ruby_string
|
83
|
+
rubie = normalize_ruby_string(new_resource.ruby_string)
|
84
|
+
gemset = new_resource.gemset
|
85
|
+
else
|
86
|
+
rubie = select_ruby(normalize_ruby_string(new_resource.gemset))
|
87
|
+
gemset = select_gemset(normalize_ruby_string(new_resource.gemset))
|
88
|
+
end
|
89
|
+
full_name = "#{rubie}@#{gemset}"
|
90
|
+
|
91
|
+
if gemset_exists?(:ruby => rubie, :gemset => gemset)
|
92
|
+
Chef::Log.info("Emptying rvm_gemset[#{full_name}]")
|
93
|
+
|
94
|
+
env = RVM::Environment.new
|
95
|
+
env.use full_name
|
96
|
+
if env.gemset_empty
|
97
|
+
update_installed_gemsets(rubie)
|
98
|
+
Chef::Log.debug("Emptying of rvm_gemset[#{full_name}] was successful.")
|
99
|
+
else
|
100
|
+
Chef::Log.warn("Failed to empty rvm_gemset[#{full_name}].")
|
101
|
+
end
|
102
|
+
else
|
103
|
+
Chef::Log.debug("rvm_gemset[#{full_name}] does not exist, so skipping")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
action :update do
|
108
|
+
if new_resource.ruby_string
|
109
|
+
rubie = normalize_ruby_string(new_resource.ruby_string)
|
110
|
+
gemset = new_resource.gemset
|
111
|
+
else
|
112
|
+
rubie = select_ruby(normalize_ruby_string(new_resource.gemset))
|
113
|
+
gemset = select_gemset(normalize_ruby_string(new_resource.gemset))
|
114
|
+
end
|
115
|
+
full_name = "#{rubie}@#{gemset}"
|
116
|
+
|
117
|
+
Chef::Log.info("Updating rvm_gemset[#{full_name}]")
|
118
|
+
|
119
|
+
# create gemset if it doesn't exist
|
120
|
+
unless gemset_exists?(:ruby => rubie, :gemset => gemset)
|
121
|
+
c = rvm_gemset full_name do
|
122
|
+
action :nothing
|
123
|
+
end
|
124
|
+
c.run_action(:create)
|
125
|
+
end
|
126
|
+
|
127
|
+
env = RVM::Environment.new
|
128
|
+
env.use full_name
|
129
|
+
if env.gemset_update
|
130
|
+
update_installed_gemsets(rubie)
|
131
|
+
Chef::Log.debug("Updating of rvm_gemset[#{full_name}] was successful.")
|
132
|
+
else
|
133
|
+
Chef::Log.warn("Failed to update rvm_gemset[#{full_name}].")
|
134
|
+
end
|
135
|
+
end
|