forked from sherzberg/puppet-groovy
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parameters to control management of target directory and unzip pa…
…ckage Add groovy.csh file for environment defaults
- Loading branch information
Showing
3 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,12 @@ | |
# Spencer Herzberg <[email protected]> | ||
# | ||
class groovy ( | ||
$version = $groovy::params::version, | ||
$base_url = $groovy::params::base_url, | ||
$target = $groovy::params::target, | ||
$timeout = $groovy::params::timeout, | ||
$version = $groovy::params::version, | ||
$base_url = $groovy::params::base_url, | ||
$target = $groovy::params::target, | ||
$manage_target = $groovy::params::manage_target, | ||
$manage_unzip = $groovy::params::manage_unzip, | ||
$timeout = $groovy::params::timeout, | ||
) inherits groovy::params { | ||
|
||
include stdlib | ||
|
@@ -23,34 +25,58 @@ | |
validate_string($base_url) | ||
|
||
$groovy_filename = "groovy-binary-${version}.zip" | ||
$groovy_dir = "${target}/groovy-${version}" | ||
$groovy_dir = "${target}/groovy-${version}" | ||
|
||
if $manage_target and $manage_unzip { | ||
$staging_require = [ | ||
Staging::File[$groovy_filename], | ||
File[$target], | ||
Package['unzip'], | ||
] | ||
} elsif $manage_target { | ||
$staging_require = [ | ||
Staging::File[$groovy_filename], | ||
File[$target], | ||
] | ||
} elsif $manage_unzip { | ||
$staging_require = [ | ||
Staging::File[$groovy_filename], | ||
Package['unzip'], | ||
] | ||
} else { | ||
$staging_require = Staging::File[$groovy_filename] | ||
} | ||
|
||
file { '/etc/profile.d/groovy.sh': | ||
ensure => file, | ||
mode => '0644', | ||
content => template("${module_name}/groovy.sh.erb"), | ||
} | ||
|
||
file { '/etc/profile.d/groovy.csh': | ||
ensure => file, | ||
mode => '0644', | ||
content => template("${module_name}/groovy.csh.erb"), | ||
} | ||
|
||
staging::file { $groovy_filename: | ||
source => "${base_url}/${groovy_filename}", | ||
timeout => $timeout, | ||
} | ||
|
||
package { 'unzip': | ||
ensure => present, | ||
if $manage_unzip { | ||
ensure_resource('package','unzip', {'ensure' => 'present' }) | ||
} | ||
|
||
file { $target: | ||
ensure => directory, | ||
if $manage_target { | ||
file { $target: | ||
ensure => directory, | ||
} | ||
} | ||
|
||
staging::extract { $groovy_filename: | ||
target => $target, | ||
creates => $groovy_dir, | ||
require => [ | ||
Staging::File[$groovy_filename], | ||
File[$target], | ||
Package['unzip'], | ||
], | ||
require => $staging_require, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# | ||
# default parameters for the groovy class | ||
class groovy::params { | ||
$version = '2.3.1' | ||
$base_url = 'http://dl.bintray.com/groovy/maven/' | ||
$target = '/opt' | ||
$timeout = 360 | ||
$version = '2.3.1' | ||
$base_url = 'http://dl.bintray.com/groovy/maven/' | ||
$target = '/opt' | ||
$manage_target = true | ||
$manage_unzip = true | ||
$timeout = 360 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
setenv GROOVY_HOME <%= @groovy_dir %> | ||
set path=( $path "<%= @groovy_dir %>/bin" ) |