vault-tree 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/.gitignore +26 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +43 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +118 -0
  6. data/Rakefile +17 -0
  7. data/VagrantFile +30 -0
  8. data/features/core.feature +44 -0
  9. data/features/exceptions.feature +41 -0
  10. data/features/steps/core.steps.rb +168 -0
  11. data/features/steps/exceptions.steps.rb +103 -0
  12. data/features/support/env.rb +1 -0
  13. data/features/world.rb +3 -0
  14. data/lib/vault-tree.rb +7 -0
  15. data/lib/vault-tree/config/dependencies.rb +4 -0
  16. data/lib/vault-tree/config/lib.rb +2 -0
  17. data/lib/vault-tree/config/path_helpers.rb +49 -0
  18. data/lib/vault-tree/config/string.rb +25 -0
  19. data/lib/vault-tree/contract/close_validator.rb +35 -0
  20. data/lib/vault-tree/contract/contract.rb +85 -0
  21. data/lib/vault-tree/contract/contract_presenter.rb +27 -0
  22. data/lib/vault-tree/contract/doorman.rb +112 -0
  23. data/lib/vault-tree/contract/null_vault.rb +16 -0
  24. data/lib/vault-tree/contract/open_validator.rb +20 -0
  25. data/lib/vault-tree/contract/vault.rb +96 -0
  26. data/lib/vault-tree/exceptions/empty_vault.rb +8 -0
  27. data/lib/vault-tree/exceptions/fill_attempt_master_password.rb +6 -0
  28. data/lib/vault-tree/exceptions/invalid_signature.rb +0 -0
  29. data/lib/vault-tree/exceptions/malformed_json.rb +0 -0
  30. data/lib/vault-tree/exceptions/missing_external_data.rb +6 -0
  31. data/lib/vault-tree/exceptions/missing_partner_decryption_key.rb +6 -0
  32. data/lib/vault-tree/exceptions/missing_passphrase.rb +6 -0
  33. data/lib/vault-tree/exceptions/non_unique_vault_id.rb +0 -0
  34. data/lib/vault-tree/exceptions/unsupported_keyword.rb +6 -0
  35. data/lib/vault-tree/exceptions/vault_does_not_exist.rb +6 -0
  36. data/lib/vault-tree/exceptions/vault_tree_exception.rb +6 -0
  37. data/lib/vault-tree/keywords/decryption_key.rb +14 -0
  38. data/lib/vault-tree/keywords/external_data.rb +13 -0
  39. data/lib/vault-tree/keywords/keyword.rb +19 -0
  40. data/lib/vault-tree/keywords/keyword_interpreter.rb +45 -0
  41. data/lib/vault-tree/keywords/master_passphrase.rb +9 -0
  42. data/lib/vault-tree/keywords/public_encryption_key.rb +27 -0
  43. data/lib/vault-tree/keywords/random_number.rb +9 -0
  44. data/lib/vault-tree/keywords/shared_key.rb +24 -0
  45. data/lib/vault-tree/keywords/unlocked.rb +9 -0
  46. data/lib/vault-tree/keywords/vault_contents.rb +13 -0
  47. data/lib/vault-tree/lock_smith/asymmetric_cipher.rb +31 -0
  48. data/lib/vault-tree/lock_smith/crypto_hash.rb +11 -0
  49. data/lib/vault-tree/lock_smith/digital_signature.rb +32 -0
  50. data/lib/vault-tree/lock_smith/encryption_key_pair.rb +25 -0
  51. data/lib/vault-tree/lock_smith/null_vault.rb +4 -0
  52. data/lib/vault-tree/lock_smith/random_number.rb +11 -0
  53. data/lib/vault-tree/lock_smith/shared_key_pair.rb +12 -0
  54. data/lib/vault-tree/lock_smith/signing_key_pair.rb +25 -0
  55. data/lib/vault-tree/lock_smith/symmetric_cipher.rb +25 -0
  56. data/lib/vault-tree/util/json.rb +16 -0
  57. data/lib/vault-tree/version.rb +3 -0
  58. data/spec/app/locksmith/asymmetric_cipher_spec.rb +25 -0
  59. data/spec/app/locksmith/signing_key_pair_spec.rb +22 -0
  60. data/spec/spec_helper.rb +5 -0
  61. data/spec/support/fixtures/blank_simple_test_contract.json +14 -0
  62. data/spec/support/fixtures/broken_contract.json +55 -0
  63. data/spec/support/fixtures/one_two_three-0.5.0.EXP.json +105 -0
  64. data/spec/support/fixtures/reference_contract.1.0.0.json +227 -0
  65. data/spec/support/fixtures/simple_test_contract.json +14 -0
  66. data/support/cookbooks/ark/.gitignore +12 -0
  67. data/support/cookbooks/ark/.kitchen.yml +34 -0
  68. data/support/cookbooks/ark/.travis.yml +6 -0
  69. data/support/cookbooks/ark/Berksfile +9 -0
  70. data/support/cookbooks/ark/CHANGELOG.md +87 -0
  71. data/support/cookbooks/ark/CONTRIBUTING.md +257 -0
  72. data/support/cookbooks/ark/README.md +301 -0
  73. data/support/cookbooks/ark/Rakefile +36 -0
  74. data/support/cookbooks/ark/TESTING.md +25 -0
  75. data/support/cookbooks/ark/Toftfile +15 -0
  76. data/support/cookbooks/ark/attributes/default.rb +6 -0
  77. data/support/cookbooks/ark/chefignore +96 -0
  78. data/support/cookbooks/ark/files/default/foo.tar.gz +0 -0
  79. data/support/cookbooks/ark/files/default/foo.tbz +0 -0
  80. data/support/cookbooks/ark/files/default/foo.tgz +0 -0
  81. data/support/cookbooks/ark/files/default/foo.zip +0 -0
  82. data/support/cookbooks/ark/files/default/tests/minitest/default_test.rb +0 -0
  83. data/support/cookbooks/ark/files/default/tests/minitest/support/helpers.rb +0 -0
  84. data/support/cookbooks/ark/files/default/tests/minitest/test_test.rb +94 -0
  85. data/support/cookbooks/ark/libraries/default.rb +167 -0
  86. data/support/cookbooks/ark/metadata.rb +13 -0
  87. data/support/cookbooks/ark/providers/default.rb +370 -0
  88. data/support/cookbooks/ark/recipes/default.rb +31 -0
  89. data/support/cookbooks/ark/recipes/test.rb +138 -0
  90. data/support/cookbooks/ark/resources/default.rb +54 -0
  91. data/support/cookbooks/ark/templates/default/add_to_path.sh.erb +1 -0
  92. data/support/cookbooks/ark/test/support/Gemfile +4 -0
  93. data/support/cookbooks/build-essential/README.md +24 -0
  94. data/support/cookbooks/build-essential/metadata.rb +10 -0
  95. data/support/cookbooks/build-essential/recipes/default.rb +45 -0
  96. data/support/cookbooks/chruby/.gitignore +15 -0
  97. data/support/cookbooks/chruby/.kitchen.yml +26 -0
  98. data/support/cookbooks/chruby/.ruby_version +1 -0
  99. data/support/cookbooks/chruby/Berksfile +3 -0
  100. data/support/cookbooks/chruby/Gemfile +7 -0
  101. data/support/cookbooks/chruby/LICENSE +14 -0
  102. data/support/cookbooks/chruby/README.md +92 -0
  103. data/support/cookbooks/chruby/Rakefile +7 -0
  104. data/support/cookbooks/chruby/Thorfile +6 -0
  105. data/support/cookbooks/chruby/Vagrantfile +86 -0
  106. data/support/cookbooks/chruby/attributes/default.rb +10 -0
  107. data/support/cookbooks/chruby/chefignore +96 -0
  108. data/support/cookbooks/chruby/metadata.rb +11 -0
  109. data/support/cookbooks/chruby/recipes/default.rb +43 -0
  110. data/support/cookbooks/chruby/recipes/system.rb +25 -0
  111. data/support/cookbooks/chruby/templates/default/chruby.sh.erb +22 -0
  112. data/support/cookbooks/chruby/test/integration/default/bash/embedded_test.sh +1 -0
  113. data/support/cookbooks/git/.gitignore +14 -0
  114. data/support/cookbooks/git/.kitchen.yml +46 -0
  115. data/support/cookbooks/git/Berksfile +8 -0
  116. data/support/cookbooks/git/CHANGELOG.md +87 -0
  117. data/support/cookbooks/git/CONTRIBUTING +29 -0
  118. data/support/cookbooks/git/Gemfile +3 -0
  119. data/support/cookbooks/git/LICENSE +201 -0
  120. data/support/cookbooks/git/README.md +115 -0
  121. data/support/cookbooks/git/TESTING.md +25 -0
  122. data/support/cookbooks/git/attributes/default.rb +40 -0
  123. data/support/cookbooks/git/metadata.rb +35 -0
  124. data/support/cookbooks/git/recipes/default.rb +53 -0
  125. data/support/cookbooks/git/recipes/server.rb +58 -0
  126. data/support/cookbooks/git/recipes/source.rb +49 -0
  127. data/support/cookbooks/git/recipes/windows.rb +37 -0
  128. data/support/cookbooks/git/templates/default/git-xinetd.d.erb +10 -0
  129. data/support/cookbooks/git/templates/default/sv-git-daemon-log-run.erb +2 -0
  130. data/support/cookbooks/git/templates/default/sv-git-daemon-run.erb +3 -0
  131. data/support/cookbooks/install_ruby/README.md +3 -0
  132. data/support/cookbooks/install_ruby/metadata.rb +10 -0
  133. data/support/cookbooks/install_ruby/recipes/default.rb +14 -0
  134. data/support/cookbooks/ruby_build/.gitignore +6 -0
  135. data/support/cookbooks/ruby_build/.kitchen.yml +31 -0
  136. data/support/cookbooks/ruby_build/.travis.yml +4 -0
  137. data/support/cookbooks/ruby_build/Berksfile +10 -0
  138. data/support/cookbooks/ruby_build/CHANGELOG.md +72 -0
  139. data/support/cookbooks/ruby_build/Gemfile +14 -0
  140. data/support/cookbooks/ruby_build/README.md +338 -0
  141. data/support/cookbooks/ruby_build/Rakefile +21 -0
  142. data/support/cookbooks/ruby_build/attributes/default.rb +67 -0
  143. data/support/cookbooks/ruby_build/chefignore +53 -0
  144. data/support/cookbooks/ruby_build/libraries/ruby_build_recipe_helpers.rb +40 -0
  145. data/support/cookbooks/ruby_build/metadata.rb +18 -0
  146. data/support/cookbooks/ruby_build/providers/ruby.rb +88 -0
  147. data/support/cookbooks/ruby_build/recipes/default.rb +69 -0
  148. data/support/cookbooks/ruby_build/resources/ruby.rb +33 -0
  149. data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/metadata.rb +10 -0
  150. data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/recipes/default.rb +59 -0
  151. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/_verify_tests.bash +33 -0
  152. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.8.7.bats +29 -0
  153. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.2.bats +18 -0
  154. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.3.bats +18 -0
  155. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_2.0.0.bats +18 -0
  156. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_jruby.bats +20 -0
  157. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_rbx.bats +18 -0
  158. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_ree.bats +19 -0
  159. data/support/cookbooks/ruby_build/test/integration/installation/bats/installation.bats +6 -0
  160. data/support/scripts/libsodium_ubuntu.sh +80 -0
  161. data/support/tasks/.gitkeep +0 -0
  162. data/support/tasks/libsodium_install.rb +57 -0
  163. data/vault-tree.gemspec +26 -0
  164. metadata +305 -0
@@ -0,0 +1,10 @@
1
+ maintainer ""
2
+ maintainer_email ""
3
+ license "MIT"
4
+ description "Installs Ruby"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6
+ version "0.0.1"
7
+
8
+ %w{ ubuntu debian }.each do |os|
9
+ supports os
10
+ end
@@ -0,0 +1,14 @@
1
+ require_recipe 'git'
2
+ version = '0.3'
3
+
4
+ execute "build ruby 1.9.3" do
5
+ command "ruby-build 1.9.3-p448 '/home/vagrant/.rubies/1.9.3-p448'"
6
+ user "root"
7
+ cwd "/home/vagrant"
8
+ end
9
+
10
+ execute "add chruby to bashrc" do
11
+ command "echo 'chruby 1.9.3-p448' >> /home/vagrant/.bashrc"
12
+ user "vagrant"
13
+ cwd "/home/vagrant"
14
+ end
@@ -0,0 +1,6 @@
1
+ Gemfile.lock
2
+ Berksfile.lock
3
+ .kitchen/
4
+ .kitchen.local.yml
5
+ .bundle/
6
+ tmp/
@@ -0,0 +1,31 @@
1
+ ---
2
+ driver_plugin: vagrant
3
+ driver_config:
4
+ require_chef_omnibus: true
5
+
6
+ platforms:
7
+ - name: ubuntu-12.04
8
+ driver_config:
9
+ box: opscode-ubuntu-12.04
10
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
11
+ run_list:
12
+ - recipe[apt]
13
+ - name: ubuntu-10.04
14
+ driver_config:
15
+ box: opscode-ubuntu-10.04
16
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
17
+ run_list:
18
+ - recipe[apt]
19
+ - name: centos-6.4
20
+ driver_config:
21
+ box: opscode-centos-6.4
22
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
23
+
24
+ suites:
25
+ - name: alltherubies
26
+ run_list:
27
+ - recipe[ruby_build]
28
+ - recipe[alltherubies]
29
+ - name: installation
30
+ run_list:
31
+ - recipe[ruby_build]
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ bundler_args: --without integration development
@@ -0,0 +1,10 @@
1
+ site :opscode
2
+
3
+ metadata
4
+
5
+ group :integration do
6
+ cookbook 'alltherubies', :path => './test/cookbooks/alltherubies'
7
+ cookbook 'apt'
8
+ cookbook 'user'
9
+ cookbook 'java'
10
+ end
@@ -0,0 +1,72 @@
1
+ ## 0.8.0 / 2013-05-22
2
+
3
+ ### Bug fixes
4
+
5
+ * Pull request [#8][]: Remove libyaml-devel pkg dependency for Red Hat family
6
+ platforms. ([@fnichol][])
7
+
8
+ ### Improvements
9
+
10
+ * Pull request [#9][]: Use the HTTPS clone URL. ([@adammck][])
11
+ * Pull request [#10][]: Use old-form notifies to support AWS OpsWorks.
12
+ ([@tsabat][])
13
+ * Issue [#7][]: Install Git package(s) only if Git is not previously installed.
14
+ ([@fnichol][], [@ChrisLundquist][])
15
+ * Convert project from Jamie to Test Kitchen. ([@fnichol][])
16
+
17
+
18
+ ## 0.7.2 / 2012-12-31
19
+
20
+ ### Bug fixes
21
+
22
+ * Add missing package dependencies for C Ruby versions on RHEL family.
23
+ ([@fnichol][])
24
+
25
+ ### Improvements
26
+
27
+ * Print Ruby build time to :info logger (formerly :debug). ([@fnichol][])
28
+ * Add integration tests for commonly installed Ruby versions. ([@fnichol][])
29
+
30
+
31
+ ## 0.7.0 / 2012-11-21
32
+
33
+ ### New features
34
+
35
+ * Add environment attr to ruby_build_ruby. This allows for adding custom
36
+ compilation flags, as well as newer ruby-build environment variables, such
37
+ as RUBY_BUILD_MIRROR_URL. ([@fnichol][])
38
+
39
+ ### Improvements
40
+
41
+ * Update foodcritic configuration and update .travis.yml. ([@fnichol][])
42
+ * Update Installation section of README (welcome Berkshelf). ([@fnichol][])
43
+
44
+
45
+ ## 0.6.2 / 2012-05-03
46
+
47
+ ### Bug fixes
48
+
49
+ * ruby_build_ruby LWRP now notifies when updated (FC017). ([@fnichol][])
50
+ * Add plaform equivalents in default attrs (FC024). ([@fnichol][])
51
+ * JRuby requires make package on Ubuntu/Debian. ([@fnichol][])
52
+ * Ensure `Chef::Config[:file_cache_path]` exists in solo mode. ([@fnichol][])
53
+
54
+ ### Improvements
55
+
56
+ * Add TravisCI to run Foodcritic linter. ([@fnichol][])
57
+ * Reorganize README with section links. ([@fnichol][])
58
+
59
+
60
+ ## 0.6.0 / 2011-12-10
61
+
62
+ The initial release.
63
+
64
+ <!--- The following link definition list is generated by PimpMyChangelog --->
65
+ [#7]: https://github.com/fnichol/chef-ruby_build/issues/7
66
+ [#8]: https://github.com/fnichol/chef-ruby_build/issues/8
67
+ [#9]: https://github.com/fnichol/chef-ruby_build/issues/9
68
+ [#10]: https://github.com/fnichol/chef-ruby_build/issues/10
69
+ [@ChrisLundquist]: https://github.com/ChrisLundquist
70
+ [@adammck]: https://github.com/adammck
71
+ [@fnichol]: https://github.com/fnichol
72
+ [@tsabat]: https://github.com/tsabat
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gem 'foodcritic'
5
+
6
+ group :development do
7
+ gem 'emeril'
8
+ end
9
+
10
+ group :integration do
11
+ gem 'berkshelf'
12
+ gem 'test-kitchen', '~> 1.0.0.alpha.6'
13
+ gem 'kitchen-vagrant'
14
+ end
@@ -0,0 +1,338 @@
1
+ # <a name="title"></a> ruby-build Chef Cookbook
2
+
3
+ [![Build Status](https://secure.travis-ci.org/fnichol/chef-ruby_build.png?branch=master)](http://travis-ci.org/fnichol/chef-ruby_build)
4
+
5
+ ## <a name="description"></a> Description
6
+
7
+ Manages the [ruby-build][rb_site] framework and its installed Rubies.
8
+ A lightweight resources and providers ([LWRP][lwrp]) is also defined.
9
+
10
+ ## <a name="usage"></a> Usage
11
+
12
+ Simply include `recipe[ruby_build]` in your run\_list to have ruby-build
13
+ installed. You will also have access to the `ruby_build_ruby` resource. See
14
+ the [Resources and Providers](#lwrps) section for more details.
15
+
16
+ ## <a name="requirements"></a> Requirements
17
+
18
+ ### <a name="requirements-chef"></a> Chef
19
+
20
+ Tested on 0.10.8 but newer and older version should work just
21
+ fine. File an [issue][issues] if this isn't the case.
22
+
23
+ ### <a name="requirements-platform"></a> Platform
24
+
25
+ The following platforms have been tested with this cookbook, meaning that
26
+ the recipes and LWRPs run on these platforms without error:
27
+
28
+ * ubuntu (10.04/10.10/11.04/11.10/12.04)
29
+ * mac\_os\_x (10.7/10.8)
30
+ * debian
31
+ * freebsd
32
+ * redhat
33
+ * centos
34
+ * fedora
35
+ * amazon
36
+ * scientific
37
+ * suse
38
+
39
+ Please [report][issues] any additional platforms so they can be added.
40
+
41
+ ### <a name="requirements-cookbooks"></a> Cookbooks
42
+
43
+ There are **no** external cookbook dependencies. However, if you are
44
+ installing [JRuby][jruby] then a Java runtime will need to be installed.
45
+ The Opscode [java cookbook][java_cb] can be used on supported platforms.
46
+
47
+ ## <a name="installation"></a> Installation
48
+
49
+ Depending on the situation and use case there are several ways to install
50
+ this cookbook. All the methods listed below assume a tagged version release
51
+ is the target, but omit the tags to get the head of development. A valid
52
+ Chef repository structure like the [Opscode repo][chef_repo] is also assumed.
53
+
54
+ ### <a name="installation-platform"></a> From the Opscode Community Platform
55
+
56
+ To install this cookbook from the Opscode platform, use the *knife* command:
57
+
58
+ knife cookbook site install ruby_build
59
+
60
+ ### <a name="installation-berkshelf"></a> Using Berkshelf
61
+
62
+ [Berkshelf][berkshelf] is a cookbook dependency manager and development
63
+ workflow assistant. To install Berkshelf:
64
+
65
+ cd chef-repo
66
+ gem install berkshelf
67
+ berks init
68
+
69
+ To use the Community Site version:
70
+
71
+ echo "cookbook 'ruby_build'" >> Berksfile
72
+ berks install
73
+
74
+ Or to reference the Git version:
75
+
76
+ repo="fnichol/chef-ruby_build"
77
+ latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \
78
+ | ruby -rjson -e '
79
+ j = JSON.parse(STDIN.read);
80
+ puts j.map { |t| t["ref"].split("/").last }.sort.last
81
+ ')
82
+ cat >> Berksfile <<END_OF_BERKSFILE
83
+ cookbook 'ruby_build',
84
+ :git => 'git://github.com/$repo.git', :branch => '$latest_release'
85
+ END_OF_BERKSFILE
86
+
87
+ ### <a name="installation-librarian"></a> Using Librarian-Chef
88
+
89
+ [Librarian-Chef][librarian] is a bundler for your Chef cookbooks.
90
+ To install Librarian-Chef:
91
+
92
+ cd chef-repo
93
+ gem install librarian
94
+ librarian-chef init
95
+
96
+ To use the Opscode platform version:
97
+
98
+ echo "cookbook 'ruby_build'" >> Cheffile
99
+ librarian-chef install
100
+
101
+ Or to reference the Git version:
102
+
103
+ repo="fnichol/chef-ruby_build"
104
+ latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \
105
+ | ruby -rjson -e '
106
+ j = JSON.parse(STDIN.read);
107
+ puts j.map { |t| t["ref"].split("/").last }.sort.last
108
+ ')
109
+ cat >> Cheffile <<END_OF_CHEFFILE
110
+ cookbook 'ruby_build',
111
+ :git => 'git://github.com/$repo.git', :ref => '$latest_release'
112
+ END_OF_CHEFFILE
113
+ librarian-chef install
114
+
115
+ ## <a name="recipes"></a> Recipes
116
+
117
+ ### <a name="recipes-default"></a> default
118
+
119
+ Installs the ruby-build codebase and initializes Chef to use the Lightweight
120
+ Resources and Providers ([LWRPs][lwrp]).
121
+
122
+ ## <a name="attributes"></a> Attributes
123
+
124
+ ### <a name="attributes-git-url"></a> git_url
125
+
126
+ The Git URL which is used to install ruby-build.
127
+
128
+ The default is `"git://github.com/sstephenson/ruby-build.git"`.
129
+
130
+ ### <a name="attributes-git-ref"></a> git_ref
131
+
132
+ A specific Git branch/tag/reference to use when installing ruby-build. For
133
+ example, to pin ruby-build to a specific release:
134
+
135
+ node['ruby_build']['git_ref'] = "v20111030"
136
+
137
+ The default is `"master"`.
138
+
139
+ ### <a name="attributes-default-ruby-base-path"></a> default_ruby_base_path
140
+
141
+ The default base path for a system-wide installed Ruby. For example, the
142
+ following resource:
143
+
144
+ ruby_build_ruby "1.9.3-p0"
145
+
146
+ will be installed into
147
+ `"#{node['ruby_build']['default_ruby_base_path']}/1.9.3-p0"` unless a
148
+ `prefix_path` attribute is explicitly set.
149
+
150
+ The default is `"/usr/local/ruby"`.
151
+
152
+ ### <a name="attributes-upgrade"></a> upgrade
153
+
154
+ Determines how to handle installing updates to the ruby-build framework.
155
+ There are currently 2 valid values:
156
+
157
+ * `"none"`, `false`, or `nil`: will not update ruby-build and leave it in its
158
+ current state.
159
+ * `"sync"` or `true`: updates ruby-build to the version specified by the
160
+ `git_ref` attribute or the head of the master branch by default.
161
+
162
+ The default is `"none"`.
163
+
164
+ ## <a name="lwrps"></a> Resources and Providers
165
+
166
+ ### <a name="lwrps-rbr"></a> ruby_build_ruby
167
+
168
+ #### <a name="lwrps-rbr-actions"></a> Actions
169
+
170
+ <table>
171
+ <thead>
172
+ <tr>
173
+ <th>Action</th>
174
+ <th>Description</th>
175
+ <th>Default</th>
176
+ </tr>
177
+ </thead>
178
+ <tbody>
179
+ <tr>
180
+ <td>install</td>
181
+ <td>
182
+ Build and install a Ruby from a definition file. See the ruby-build
183
+ readme<sup>(1)</sup> for more details.
184
+ </td>
185
+ <td>Yes</td>
186
+ </tr>
187
+ <tr>
188
+ <td>reinstall</td>
189
+ <td>
190
+ Force a recompiliation of the Ruby from source. The :install action
191
+ will skip a build if the target install directory already exists.
192
+ </td>
193
+ <td>&nbsp;</td>
194
+ </tr>
195
+ </tbody>
196
+ </table>
197
+
198
+ 1. [ruby-build readme][rb_readme]
199
+
200
+ #### <a name="lwrps-rbr-attributes"></a> Attributes
201
+
202
+ <table>
203
+ <thead>
204
+ <tr>
205
+ <th>Attribute</th>
206
+ <th>Description</th>
207
+ <th>Default Value</th>
208
+ </tr>
209
+ </thead>
210
+ <tbody>
211
+ <tr>
212
+ <td>definition</td>
213
+ <td>
214
+ <b>Name attribute:</b> the name of a built-in definition<sup>(1)</sup>
215
+ or the path to a ruby-build definition file.
216
+ </td>
217
+ <td><code>nil</code></td>
218
+ </tr>
219
+ <tr>
220
+ <td>prefix_path</td>
221
+ <td>The path to which the Ruby will be installed.</td>
222
+ <td><code>nil</code></td>
223
+ </tr>
224
+ <tr>
225
+ <td>user</td>
226
+ <td>
227
+ A user which will own the installed Ruby. The default value of
228
+ <code>nil</code> denotes a system-wide Ruby (root-owned) is being
229
+ targeted. <b>Note:</b> if specified, the user must already exist.
230
+ </td>
231
+ <td><code>nil</code></td>
232
+ </tr>
233
+ <tr>
234
+ <td>group</td>
235
+ <td>
236
+ A group which will own the installed Ruby. The default value of
237
+ <code>nil</code> denotes a system-wide Ruby (root-owned) is being
238
+ targeted. <b>Note:</b> if specified, the group must already exist.
239
+ </td>
240
+ <td><code>nil</code></td>
241
+ </tr>
242
+ <tr>
243
+ <td>environment</td>
244
+ <td>
245
+ A Hash of additional environment variables<sup>(2)</sup>, such as
246
+ <code>CONFIGURE_OPTS</code> or <code>RUBY_BUILD_MIRROR_URL</code>.
247
+ </td>
248
+ <td><code>nil</code></td>
249
+ </tr>
250
+ </tbody>
251
+ </table>
252
+
253
+ 1. [built-in definition][rb_definitions]
254
+ 2. [special environment variables][rb_environment]
255
+
256
+ #### <a name="lwrps-rbr-examples"></a> Examples
257
+
258
+ ##### Install Ruby
259
+
260
+ # See: https://github.com/sstephenson/ruby-build/issues/186
261
+ ruby_build_ruby "ree-1.8.7-2012.02" do
262
+ environment({ 'CONFIGURE_OPTS' => '--no-tcmalloc' })
263
+ end
264
+
265
+ ruby_build_ruby "1.9.3-p0" do
266
+ prefix_path "/usr/local/ruby/ruby-1.9.3-p0"
267
+ environment({
268
+ 'RUBY_BUILD_MIRROR_URL' => 'http://local.example.com'
269
+ })
270
+
271
+ action :install
272
+ end
273
+
274
+ ruby_build_ruby "jruby-1.6.5"
275
+
276
+ **Note:** the install action is default, so the second example is more common.
277
+
278
+ ##### Install A Ruby For A User
279
+
280
+ ruby_build_ruby "maglev-1.0.0" do
281
+ prefix_path "/home/deploy/.rubies/maglev-1.0.0"
282
+ user "deploy"
283
+ group "deploy"
284
+ end
285
+
286
+ ##### Reinstall Ruby
287
+
288
+ ruby_build_ruby "rbx-1.2.4" do
289
+ prefix_path "/opt/rbx-1.2.4"
290
+
291
+ action :reinstall
292
+ end
293
+
294
+ **Note:** the Ruby will be built whether or not the Ruby exists in the
295
+ `prefix_path` directory.
296
+
297
+ ## <a name="development"></a> Development
298
+
299
+ * Source hosted at [GitHub][repo]
300
+ * Report issues/Questions/Feature requests on [GitHub Issues][issues]
301
+
302
+ Pull requests are very welcome! Make sure your patches are well tested.
303
+ Ideally create a topic branch for every separate change you make.
304
+
305
+ ## <a name="license"></a> License and Author
306
+
307
+ Author:: [Fletcher Nichol][fnichol] (<fnichol@nichol.ca>) [![endorse](http://api.coderwall.com/fnichol/endorsecount.png)](http://coderwall.com/fnichol)
308
+
309
+ Copyright 2011, Fletcher Nichol
310
+
311
+ Licensed under the Apache License, Version 2.0 (the "License");
312
+ you may not use this file except in compliance with the License.
313
+ You may obtain a copy of the License at
314
+
315
+ http://www.apache.org/licenses/LICENSE-2.0
316
+
317
+ Unless required by applicable law or agreed to in writing, software
318
+ distributed under the License is distributed on an "AS IS" BASIS,
319
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
320
+ See the License for the specific language governing permissions and
321
+ limitations under the License.
322
+
323
+ [berkshelf]: http://berkshelf.com/
324
+ [chef_repo]: https://github.com/opscode/chef-repo
325
+ [cheffile]: https://github.com/applicationsonline/librarian/blob/master/lib/librarian/chef/templates/Cheffile
326
+ [java_cb]: http://community.opscode.com/cookbooks/java
327
+ [jruby]: http://jruby.org/
328
+ [kgc]: https://github.com/websterclay/knife-github-cookbooks#readme
329
+ [librarian]: https://github.com/applicationsonline/librarian#readme
330
+ [lwrp]: http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+%28LWRP%29
331
+ [rb_readme]: https://github.com/sstephenson/ruby-build#readme
332
+ [rb_site]: https://github.com/sstephenson/ruby-build
333
+ [rb_environment]: https://github.com/sstephenson/ruby-build#special-environment-variables
334
+ [rb_definitions]: https://github.com/sstephenson/ruby-build/tree/master/share/ruby-build
335
+
336
+ [fnichol]: https://github.com/fnichol
337
+ [repo]: https://github.com/fnichol/chef-ruby_build
338
+ [issues]: https://github.com/fnichol/chef-ruby_build/issues