cookbook 'jenv', '~> 0.4.0'
jenv (4) Versions 0.4.0 Follow2
Installs/Configures jenv
cookbook 'jenv', '~> 0.4.0', :supermarket
knife supermarket install jenv
knife supermarket download jenv
jenv Cookbook |
Manage installation for multiple Java versions via jenv. Also provides a set of lightweight resources and providers.
If you've used rbenv or pyenv, this is a port of that concept for Java.
Requirements
apt
git
Attributes
jenv::default
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['jenv']['user']</tt></td>
<td>String</td>
<td>Default user</td>
<td><tt>jenv</tt></td>
</tr>
<tr>
<td><tt>['jenv']['user_home']</tt></td>
<td>String</td>
<td>User home</td>
<td><tt>/home/jenv</tt></td>
</tr>
<tr>
<td><tt>['jenv']['manage_home']</tt></td>
<td>Boolean</td>
<td>Manage home</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['jenv']['group']</tt></td>
<td>String</td>
<td>Group to used</td>
<td><tt>jenv</tt></td>
</tr>
<tr>
<td><tt>['jenv']['group_users']</tt></td>
<td>Array</td>
<td>User in the group</td>
<td><tt>[]</tt></td>
</tr>
<tr>
<td><tt>['jenv']['root_path']</tt></td>
<td>String</td>
<td>Path to install jenv</td>
<td><tt>/opt/jenv</tt></td>
</tr>
<tr>
<td><tt>['jenv']['create_profiled']</tt></td>
<td>Boolean</td>
<td>Create file in profile.d</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['jenv']['git_force_update']</tt></td>
<td>Boolean</td>
<td>Force update jenv git repository</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['jenv']['git_repository']</tt></td>
<td>String</td>
<td>Git repository for jenv</td>
<td><tt>https://github.com/CHH/jenv.git</tt></td>
</tr>
<tr>
<td><tt>['jenv']['git_reference']</tt></td>
<td>String</td>
<td>Git reference for the git repository</td>
<td><tt>master</tt></td>
</tr>
</table>
Resources and providers
jenv_install
This resource installs a specified version of Java.
Actions
<table>
<thead>
<tr>
<th>Action</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>:install</td>
<td>
Build and install a Java version.
</td>
<td>Yes</td>
</tr>
</tbody>
</table>
Attributes
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>version</td>
<td>
<b>Name attribute:</b> the name of a Java version (e.g. 6
)
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>user</td>
<td>
A users's isolated jenv installation on which to apply an action. The default value of <code>nil</code> denotes a system-wide jenv installation is being targeted. <b>Note:</b> if specified, the user must already exist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
<td>
The path prefix to jenv installation, for example:
<code>/opt/jenv</code>.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>environment</td>
<td>
A hash of environment variables to set before running this command.
</td>
<td><code>nil</code></td>
</tr>
</tbody>
</table>
Examples
Install Java 6
jenv_install '6' do action :install end
jenv_install '6'
Note: the install action is default, so the second example is a more common usage.
jenv_script
This resource is a wrapper for the script
resource which wraps the code block in an jenv
-aware environment.
See the Opscode script resource documentation for more details.
Actions
<table>
<thead>
<tr>
<th>Action</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>run</td>
<td>Run the script</td>
<td>Yes</td>
</tr>
</tbody>
</table>
Attributes
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>
<b>Name attribute:</b> Name of the command to execute.
</td>
<td>name</td>
</tr>
<tr>
<td>jenv_version</td>
<td>
A version of Java being managed by jenv.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
<td>
The path prefix to jenv installation, for example:
<code>/opt/jenv</code>.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>code</td>
<td>
Quoted script of code to execute or simply a path to a file to execute in jenv context.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>creates</td>
<td>
A file this command creates - if the file exists, the command will not be run.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>cwd</td>
<td>
Current working directory to run the command from.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>environment</td>
<td>
A hash of environment variables to set before running this command.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>group</td>
<td>
A group or group ID that we should change to before running this command.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>path</td>
<td>
An array of paths to use when searching for the command.
</td>
<td><code>nil</code>, uses system path</td>
</tr>
<tr>
<td>returns</td>
<td>
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.
</td>
<td><code>0</code></td>
</tr>
<tr>
<td>timeout</td>
<td>
How many seconds to let the command run before timing out.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>user</td>
<td>
A users's isolated jenv installation on which to apply an action. The default value of <code>nil</code> denotes a system-wide jenv installation is being targeted. <b>Note:</b> if specified, the user must already exist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>umask</td>
<td>
Umask for files created by the command.
</td>
<td><code>nil</code></td>
</tr>
</tbody>
</table>
Examples
Reload cache by running command
jenv_script 'HelloWorld' do jenv_version '6' user 'deploy' group 'deploy' cwd '/opt/shared' code 'HelloWorld' end
jenv_global
This resource sets the global version of Java to be used in all shells.
Actions
<table>
<thead>
<tr>
<th>Action</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>create</td>
<td>
Sets the global version of Java to be used in all shells.
</td>
<td>Yes</td>
</tr>
</tbody>
</table>
Attributes
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>jenv_version</td>
<td>
<b>Name attribute:</b> a version of Java being managed by jenv.
<b>Note:</b> the version of Java must already be installed but not installed it automatically.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>user</td>
<td>
A users's isolated jenv installation on which to apply an action. The default value of <code>nil</code> denotes a system-wide jenv installation is being targeted.
<b>Note:</b> if specified, the user must already exist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
<td>
The path prefix to jenv installation, for example:
<code>/opt/jenv</code>.
</td>
<td><code>nil</code></td>
</tr>
</tbody>
</table>
Examples
Set Java 6 as global
jenv_global "6"
Set system java version as global
jenv_global 'system'
Set Java 7 as global for a user
jenv_global '7' do user 'bamboo' end
Contributing
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License and Authors
Authors:
- Pierre Rambaud (pierre.rambaud@numergy.com)
Dependent cookbooks
apt >= 0.0.0 |
git >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
jenv-cookbook CHANGELOG
This file is used to list changes made in each version of the jenv-cookbook cookbook.
0.4.0
- [Pierre Rambaud] - Bug with jenv_global matcher
0.3.0
- [Pierre Rambaud] - Missing ChefSpec matchers
0.2.0
- [Pierre Rambaud] - Resource to manage jenv plugins
0.1.0
- [Pierre Rambaud] - Initial release of jenv-cookbook
Collaborator Number Metric
0.4.0 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.4.0 failed this metric
FC009: Resource attribute not recognised: jenv/providers/script.rb:27
FC009: Resource attribute not recognised: jenv/recipes/default.rb:28
FC064: Ensure issues_url is set in metadata: jenv/metadata.rb:1
FC065: Ensure source_url is set in metadata: jenv/metadata.rb:1
FC066: Ensure chef_version is set in metadata: jenv/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: jenv/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/global.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/install.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/plugin.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/script.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/global.rb:34
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/install.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/plugin.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/plugin.rb:30
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/script.rb:41
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.4.0 passed this metric
Testing File Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.4.0 failed this metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.4.0 failed this metric
FC009: Resource attribute not recognised: jenv/providers/script.rb:27
FC009: Resource attribute not recognised: jenv/recipes/default.rb:28
FC064: Ensure issues_url is set in metadata: jenv/metadata.rb:1
FC065: Ensure source_url is set in metadata: jenv/metadata.rb:1
FC066: Ensure chef_version is set in metadata: jenv/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: jenv/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/global.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/install.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/plugin.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/script.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/global.rb:34
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/install.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/plugin.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/plugin.rb:30
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/script.rb:41
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.4.0 passed this metric
Testing File Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.4.0 failed this metric
FC009: Resource attribute not recognised: jenv/recipes/default.rb:28
FC064: Ensure issues_url is set in metadata: jenv/metadata.rb:1
FC065: Ensure source_url is set in metadata: jenv/metadata.rb:1
FC066: Ensure chef_version is set in metadata: jenv/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: jenv/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/global.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/install.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/plugin.rb:1
FC074: LWRP should use DSL to define resource's default action: jenv/resources/script.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/global.rb:34
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/install.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/plugin.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/plugin.rb:30
FC085: Resource using new_resource.updated_by_last_action to converge resource: jenv/providers/script.rb:41
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.4.0 passed this metric
Testing File Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.4.0 failed this metric
0.4.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number