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
+ Contributing
2
+ ============
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
6
+ 4. [**Add tests!**](https://github.com/agileorbit-cookbooks/java/blob/master/TESTING.md)
7
+ 5. Push to the branch (`git push origin my-new-feature`)
8
+ 6. Create new Pull Request
9
+
10
+ As this cookbook is no longer maintained by Chef, you **do not** need to sign any sort of contributor agreement. Simply make your change and open a pull request.
11
+
12
+ Contributions will only be accepted if they are fully tested as specified in [TESTING.md](https://github.com/agileorbit-cookbooks/java/blob/master/TESTING.md)
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'berkshelf', '~> 3.2.1'
5
+
6
+ group :test do
7
+ gem 'foodcritic', '~> 4.0.0'
8
+ gem 'rubocop', '~> 0.27.1'
9
+ gem 'chefspec', '~> 4.1.1'
10
+ end
11
+
12
+ group :integration do
13
+ gem 'test-kitchen', '~> 1.2.1'
14
+ gem 'kitchen-vagrant', '~> 0.15'
15
+ end
@@ -0,0 +1,43 @@
1
+ Java Cookbook Issues
2
+ =======================
3
+ This file documents the steps necessary to report and issue with the Java cookbook. Following these guidelines will help ensure your issue is resolved in a timely manner.
4
+
5
+ Reporting
6
+ ---------
7
+ When you report an issue, please include the following information:
8
+
9
+ - A high-level overview of what you are trying to accomplish
10
+ - An [SSCCE](http://sscce.org/) _Short, Self Contained, Correct (Compilable), Example_
11
+ - The command you ran
12
+ - What you expected to happen
13
+ - What actually happened
14
+ - The exception backtrace(s), if any
15
+ - What operating system and version
16
+ - Everything output by running `env`
17
+ - What version of the cookbook are you using?
18
+ - What version of Ruby you are using (run `ruby -v`)
19
+ - What version of Rubygems you are using (run `gem -v`)
20
+ - What version of Chef you are using (run `knife -v`)
21
+
22
+ Here's a snippet you can copy-paste into the issue and fill out:
23
+
24
+ ```text
25
+ (What is the issue? What are you trying to do? What happened?)
26
+
27
+ - Command: `...`
28
+ - OS:
29
+ - Cookbook Version:
30
+ - Ruby Version:
31
+ - Rubygems Version:
32
+ - Chef Version:
33
+ - env:
34
+ ```text
35
+ # Paste your env here
36
+ ```
37
+ - Backtrace:
38
+ ```text
39
+ # Paste backtrace here
40
+ ```
41
+ ```
42
+
43
+ [Create a ticket](https://github.com/agileorbit-cookbooks/java/issues/new) describing your problem and include the information above.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,402 @@
1
+ java
2
+ =====
3
+
4
+ This cookbook installs a Java JDK/JRE. It defaults to installing
5
+ OpenJDK, but it can also install Oracle and IBM JDKs.
6
+
7
+ Usage
8
+ -----
9
+
10
+ Simply include the `java` recipe wherever you would like Java installed, such as a run list (`recipe[java]`) or a cookbook (`include_recipe 'java'`). By default, OpenJDK 6 is installed. The `install_flavor` attribute is used to determine which JDK to install (OpenJDK, Oracle, IBM, or Windows), and `jdk_version` specifies which version to install (currently 6 and 7 are supported for all JDK types, 8 for Oracle only).
11
+
12
+ ### Examples
13
+
14
+ To install Oracle Java 7 (note that when installing Oracle JDK, `accept_oracle_download_terms` attribute must be set -- see below role for an example):
15
+ ```ruby
16
+ name "java"
17
+ description "Install Oracle Java"
18
+ default_attributes(
19
+ "java" => {
20
+ "install_flavor" => "oracle",
21
+ "jdk_version" => "7",
22
+ "oracle" => {
23
+ "accept_oracle_download_terms" => true
24
+ }
25
+ }
26
+ )
27
+ run_list(
28
+ "recipe[java]"
29
+ )
30
+ ```
31
+
32
+ Example role to install IBM flavored Java:
33
+ ```ruby
34
+ name "java"
35
+ description "Install IBM Java on Ubuntu"
36
+ default_attributes(
37
+ "java" => {
38
+ "install_flavor" => "ibm",
39
+ "ibm" => {
40
+ "accept_ibm_download_terms" => true,
41
+ "url" => "http://fileserver.example.com/ibm-java-x86_64-sdk-7.0-4.1.bin",
42
+ "checksum" => "The SHA256 checksum of the bin"
43
+ }
44
+ }
45
+ )
46
+ run_list(
47
+ "recipe[java]"
48
+ )
49
+ ```
50
+
51
+ Requirements
52
+ -----
53
+
54
+ Chef 0.10.10+ and Ohai 6.10+ for `platform_family` use.
55
+
56
+ ### Platform
57
+
58
+ * Debian, Ubuntu
59
+ * CentOS, Red Hat, Fedora, Scientific, Amazon, XenServer
60
+ * ArchLinux
61
+ * FreeBSD
62
+ * SmartOS
63
+ * Windows
64
+ * Mac OS X
65
+
66
+ Attributes
67
+ -----
68
+
69
+ See `attributes/default.rb` for default values.
70
+
71
+ * `node['java']['install_flavor']` - Flavor of JVM you would like
72
+ installed (`oracle`, `oracle_rpm`, `openjdk`, `ibm`, `windows`), default `openjdk`
73
+ on Linux/Unix platforms, `windows` on Windows platforms.
74
+ * `node['java']['jdk_version']` - JDK version to install, defaults to
75
+ `'6'`.
76
+ * `node['java']['java_home']` - Default location of the
77
+ "`$JAVA_HOME`".
78
+ * `node['java']['set_etc_environment']` - Optionally sets
79
+ JAVA_HOME in `/etc/environment` for Default `false`.
80
+ * `node['java']['openjdk_packages']` - Array of OpenJDK package names
81
+ to install in the `java::openjdk` recipe. This is set based on the
82
+ platform.
83
+ * `node['java']['tarball']` - Name of the tarball to retrieve from
84
+ your internal repository, default `jdk1.6.0_29_i386.tar.gz`
85
+ * `node['java']['tarball_checksum']` - Checksum for the tarball, if
86
+ you use a different tarball, you also need to create a new sha256
87
+ checksum
88
+ * `node['java']['jdk']` - Version and architecture specific attributes
89
+ for setting the URL on Oracle's site for the JDK, and the checksum of
90
+ the .tar.gz.
91
+ * `node['java']['oracle']['accept_oracle_download_terms']` - Indicates
92
+ that you accept Oracle's EULA
93
+ * `node['java']['windows']['url']` - The internal location of your
94
+ java install for windows
95
+ * `node['java']['windows']['package_name']` - The package name used by
96
+ windows_package to check in the registry to determine if the install
97
+ has already been run
98
+ * `node['java']['windows']['checksum']` - The checksum for the package to
99
+ download on Windows machines (default is nil, which does not perform
100
+ checksum validation)
101
+ * `node['java']['ibm']['url']` - The URL which to download the IBM
102
+ JDK/SDK. See the `ibm` recipe section below.
103
+ * `node['java']['ibm']['accept_ibm_download_terms']` - Indicates that
104
+ you accept IBM's EULA (for `java::ibm`)
105
+ * `node['java']['oracle_rpm']['type']` - Type of java RPM (`jre` or `jdk`), default `jdk`
106
+ * `node['java']['oracle_rpm']['package_version']` - optional, can be set
107
+ to pin a version different from the up-to-date one available in the YUM repo,
108
+ it might be needed to also override the node['java']['java_home'] attribute
109
+ to a value consistent with the defined version
110
+ * `node['java']['oracle_rpm']['package_name']` - optional, can be set
111
+ to define a package name different from the RPM published by Oracle.
112
+ * `node['java']['accept_license_agreement']` - Indicates that you accept
113
+ the EULA for openjdk package installation.
114
+ * `node['java']['set_default']` - Indicates whether or not you want the
115
+ JDK installed to be default on the system. Defaults to true.
116
+ * `node['java']['oracle']['jce']['enabled']` - Indicates if the JCE Unlimited Strength Jurisdiction Policy Files should be installed for oracle JDKs
117
+ * `node['java']['oracle']['jce']['home']` - Where the JCE policy files should be installed to
118
+ * `node['java']['oracle']['jce'][java_version]['checksum']` - Checksum of the JCE policy zip. Can be sha256 or md5
119
+ * `node['java']['oracle']['jce'][java_version]['url']` - URL which to download the JCE policy zip
120
+
121
+ Recipes
122
+ -----
123
+
124
+ ### default
125
+
126
+ Include the default recipe in a run list or recipe to get `java`. By default
127
+ the `openjdk` flavor of Java is installed, but this can be changed by
128
+ using the `install_flavor` attribute. By default on Windows platform
129
+ systems, the `install_flavor` is `windows` and on Mac OS X platform systems, the `install_flavor` is `homebrew`.
130
+
131
+ OpenJDK is the default because of licensing changes made upstream by
132
+ Oracle. See notes on the `oracle` recipe below.
133
+
134
+ NOTE: In most cases, including just the default recipe will be sufficient.
135
+ It's possible to include the install_type recipes directly, as long as
136
+ the necessary attributes (such as java_home) are set.
137
+
138
+ ### set_attributes_from_version
139
+
140
+ Sets default attributes based on the JDK version. This is included by `default.rb`. This logic must be in
141
+ a recipe instead of attributes/default.rb. See [#95](https://github.com/agileorbit-cookbooks/java/pull/95)
142
+ for details.
143
+
144
+ ### default_java_symlink
145
+
146
+ Updates /usr/lib/jvm/default-java to point to JAVA_HOME.
147
+
148
+ ### purge_packages
149
+
150
+ Purges deprecated Sun Java packages.
151
+
152
+ ### openjdk
153
+
154
+ This recipe installs the `openjdk` flavor of Java. It also uses the
155
+ `alternatives` system on RHEL/Debian families to set the default Java.
156
+
157
+ On platforms such as SmartOS that require the acceptance of a license
158
+ agreement during package installation, set
159
+ `node['java']['accept_license_agreement']` to true in order to indicate
160
+ that you accept the license.
161
+
162
+ ### oracle
163
+
164
+ This recipe installs the `oracle` flavor of Java. This recipe does not
165
+ use distribution packages as Oracle changed the licensing terms with
166
+ JDK 1.6u27 and prohibited the practice for both RHEL and Debian family
167
+ platforms.
168
+
169
+ As of 26 March 2012 you can no longer directly download the JDK from
170
+ Oracle's website without using a special cookie. This cookbook uses
171
+ that cookie to download the oracle recipe on your behalf, however the
172
+ `java::oracle` recipe forces you to set either override the
173
+ `node['java']['oracle']['accept_oracle_download_terms']` to true or
174
+ set up a private repository accessible by HTTP.
175
+
176
+ override the `accept_oracle_download_terms` in, e.g., `roles/base.rb`
177
+ ```ruby
178
+ default_attributes(
179
+ :java => {
180
+ :oracle => {
181
+ "accept_oracle_download_terms" => true
182
+ }
183
+ }
184
+ )
185
+ ```
186
+
187
+ For both RHEL and Debian families, this recipe pulls the binary
188
+ distribution from the Oracle website, and installs it in the default
189
+ `JAVA_HOME` for each distribution. For Debian, this is
190
+ `/usr/lib/jvm/default-java`. For RHEl, this is `/usr/lib/jvm/java`.
191
+
192
+ After putting the binaries in place, the `java::oracle` recipe updates
193
+ `/usr/bin/java` to point to the installed JDK using the
194
+ `update-alternatives` script. This is all handled in the `java_ark`
195
+ LWRP.
196
+
197
+ ### oracle_i386
198
+
199
+ This recipe installs the 32-bit Java virtual machine without setting
200
+ it as the default. This can be useful if you have applications on the
201
+ same machine that require different versions of the JVM.
202
+
203
+ This recipe operates in a similar manner to `java::oracle`.
204
+
205
+ ### oracle_rpm
206
+
207
+ This recipe installs the Oracle JRE or JDK provided by a custom YUM
208
+ repositories.
209
+ It also uses the `alternatives` system on RHEL families to set
210
+ the default Java.
211
+
212
+ ### windows
213
+
214
+ Because there is no easy way to pull the java msi off oracle's site,
215
+ this recipe requires you to host it internally on your own http repo.
216
+
217
+ **IMPORTANT NOTE**
218
+
219
+ If you use the `windows` recipe, you'll need to make sure you've uploaded
220
+ the `aws` and `windows` cookbooks. As of version 1.18.0, this cookbook
221
+ references them with `suggests` instead of `depends`, as they are only
222
+ used by the `windows` recipe.
223
+
224
+ ### ibm
225
+
226
+ The `java::ibm` recipe is used to install the IBM version of Java.
227
+ Note that IBM requires you to create an account *and* log in to
228
+ download the binary installer for your platform. You must accept the
229
+ license agreement with IBM to use their version of Java. In this
230
+ cookbook, you indicate this by setting
231
+ `node['java']['ibm']['accept_ibm_download_terms']` to `true`. You must
232
+ also host the binary on your own HTTP server to have an automated
233
+ installation. The `node['java']['ibm']['url']` attribute must be set
234
+ to a valid https/http URL; the URL is checked for validity in the recipe.
235
+
236
+ At this time the `java::ibm` recipe does not support multiple SDK
237
+ installations.
238
+
239
+ Resources/Providers
240
+ -----
241
+
242
+ ### java_ark
243
+
244
+ This cookbook contains the `java_ark` LWRP. Generally speaking this
245
+ LWRP is deprecated in favor of `ark` from the
246
+ [ark cookbook](https://github.com/opscode-cookbooks/ark), but it is
247
+ still used in this cookbook for handling the Oracle JDK installation.
248
+
249
+ By default, the extracted directory is extracted to
250
+ `app_root/extracted_dir_name` and symlinked to `app_root/default`
251
+
252
+ #### Actions
253
+
254
+ - `:install`: extracts the tarball and makes necessary symlinks
255
+ - `:remove`: removes the tarball and run update-alternatives for all
256
+ symlinked `bin_cmds`
257
+
258
+ #### Attribute Parameters
259
+
260
+ - `url`: path to tarball, .tar.gz, .bin (oracle-specific), and .zip
261
+ currently supported
262
+ - `checksum`: SHA256 checksum, not used for security but avoid
263
+ redownloading the archive on each chef-client run
264
+ - `app_home`: the default for installations of this type of
265
+ application, for example, `/usr/lib/tomcat/default`. If your
266
+ application is not set to the default, it will be placed at the same
267
+ level in the directory hierarchy but the directory name will be
268
+ `app_root/extracted_directory_name + "_alt"`
269
+ - `app_home_mode`: file mode for app_home, is an integer
270
+ - `bin_cmds`: array of binary commands that should be symlinked to
271
+ `/usr/bin`, examples are mvn, java, javac, etc. These cmds must be in
272
+ the `bin` subdirectory of the extracted folder. Will be ignored if this
273
+ `java_ark` is not the default
274
+ - `owner`: owner of extracted directory, set to "root" by default
275
+ - `group`: group of extracted directory, set to `:owner` by default
276
+ - `default`: whether this the default installation of this package,
277
+ boolean true or false
278
+ - `reset_alternatives`: whether alternatives is reset
279
+ boolean true or false
280
+ - `use_alt_suffix`: whether '_alt' suffix is used for not default javas
281
+ boolean true or false
282
+
283
+ #### Examples
284
+ ```ruby
285
+ # install jdk6 from Oracle
286
+ java_ark "jdk" do
287
+ url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin'
288
+ checksum 'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365'
289
+ app_home '/usr/local/java/default'
290
+ bin_cmds ["java", "javac"]
291
+ action :install
292
+ end
293
+ ```
294
+ ### java_alternatives
295
+
296
+ The `java_alternatives` LWRP uses `update-alternatives` command
297
+ to set and unset command alternatives for various Java tools
298
+ such as java, javac, etc.
299
+
300
+ #### Actions
301
+
302
+ - `:set`: set alternatives for Java tools
303
+ - `:unset`: unset alternatives for Java tools
304
+
305
+ #### Attribute Parameters
306
+
307
+ - `java_location`: Java installation location.
308
+ - `bin_cmds`: array of Java tool names to set or unset alternatives on.
309
+ - `default`: whether to set the Java tools as system default. Boolean, defaults to `true`.
310
+ - `priority`: priority of the alternatives. Integer, defaults to `1061`.
311
+
312
+ #### Examples
313
+ ```ruby
314
+ # set alternatives for java and javac commands
315
+ java_alternatives "set java alternatives" do
316
+ java_location '/usr/local/java'
317
+ bin_cmds ["java", "javac"]
318
+ action :set
319
+ end
320
+ ```
321
+
322
+ Production Deployment with Oracle Java
323
+ -----
324
+ Oracle has been known to change the behavior of its download site frequently. It is recommended you store the archives on an artifact server or s3 bucket. You can then override the attributes in a cookbook, role, or environment:
325
+
326
+ ```ruby
327
+ default['java']['jdk_version'] = '7'
328
+ default['java']['install_flavor'] = 'oracle'
329
+ default['java']['jdk']['7']['x86_64']['url'] = 'http://artifactory.example.com/artifacts/jdk-7u65-linux-x64.tar.gz'
330
+ default['java']['oracle']['accept_oracle_download_terms'] = true
331
+ ```
332
+
333
+ Recommendations for inclusion in community cookbooks
334
+ -----
335
+
336
+ This cookbook is a dependency for many other cookbooks in the Java/Chef sphere. Here are some guidelines for including it into other cookbooks:
337
+
338
+ ### Allow people to not use this cookbook
339
+ Many users manage Java on their own or have systems that already have java installed. Give these users an option to skip this cookbook, for example:
340
+ ```ruby
341
+ include_recipe 'java' if node['maven']['install_java']
342
+ ```
343
+
344
+ This would allow a users of the maven cookbook to choose if they want the maven cookbook to install java for them or leave that up to the consumer.
345
+
346
+ Another good example is from the [Jenkins Cookbook Java recipe](https://github.com/opscode-cookbooks/jenkins/commit/ca2a69d982011dc1bec6a6d0ee4da5c1a1599864).
347
+
348
+ ### Pinning to major version of cookbook and Java
349
+ This cookbook follows semver. It is recommended to pin at the major version of this cookbook when including it in other cookbooks, eg: `depends 'java', '~> 1.0'`
350
+
351
+ It is acceptable to set the `node['java']['jdk_version']` to a specific version if required for your software to run, eg software xyz requires Java 8 to run. Refrain from pinning to specific patches of the JDK to allow users to consume security updates.
352
+
353
+ Development
354
+ -----
355
+
356
+ This cookbook uses
357
+ [test-kitchen](https://github.com/opscode/test-kitchen) for
358
+ integration tests and
359
+ [ChefSpec/RSpec](https://github.com/sethvargo/chefspec) for unit tests.
360
+ See [TESTING.md](https://github.com/agileorbit-cookbooks/java/blob/master/TESTING.md) for testing instructions.
361
+
362
+ At this time due to licensing concerns, the IBM recipe is not set up
363
+ in test kitchen. If you would like to test this locally, copy
364
+ .kitchen.yml to .kitchen.local.yml and add the following suite:
365
+ ```yml
366
+ suites:
367
+ - name: ibm
368
+ run_list: ["recipe[java]"]
369
+ attributes:
370
+ java:
371
+ install_flavor: "ibm"
372
+ ibm:
373
+ accept_ibm_download_terms: true
374
+ url: "http://jenkins/ibm-java-x86_64-sdk-7.0-4.1.bin"
375
+ checksum: the-sha256-checksum
376
+ ```
377
+
378
+ Log into the IBM DeveloperWorks site to download a copy of the IBM
379
+ Java SDK you wish to use/test, host it on an internal HTTP server, and
380
+ calculate the SHA256 checksum to use in the suite.
381
+
382
+ License and Author
383
+ -----
384
+
385
+ * Author: Seth Chisamore (<schisamo@opscode.com>)
386
+ * Author: Bryan W. Berry (<bryan.berry@gmail.com>)
387
+ * Author: Joshua Timberman (<joshua@opscode.com>)
388
+ * Author: Eric Helgeson (<erichelgeson@gmail.com>)
389
+
390
+ Copyright: 2014, Agile Orbit, LLC
391
+
392
+ Licensed under the Apache License, Version 2.0 (the "License");
393
+ you may not use this file except in compliance with the License.
394
+ You may obtain a copy of the License at
395
+
396
+ http://www.apache.org/licenses/LICENSE-2.0
397
+
398
+ Unless required by applicable law or agreed to in writing, software
399
+ distributed under the License is distributed on an "AS IS" BASIS,
400
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
401
+ See the License for the specific language governing permissions and
402
+ limitations under the License.