Skip to content

Commit

Permalink
fix style using puppet-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jfroche committed Feb 6, 2012
1 parent bb0cbb1 commit 8492942
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 55 deletions.
27 changes: 10 additions & 17 deletions manifests/buildr.pp
Expand Up @@ -13,36 +13,29 @@
# limitations under the License.

# Class: buildr
#
#
# A puppet recipe to install Apache Buildr
#


class maven::buildr( $java_home ) {

# Can't use this as gem install buildr requires JAVA_HOME environment variable
# package { "buildr":
# ensure => "1.4.6",
# ensure => "1.4.6",
# provider => gem
# }

# a workaround using exec
define install-gem ($version = '') {
exec { "gem $name $version":
path => "/usr/bin:/opt/ruby/bin",
environment => "JAVA_HOME=$maven::java_home",
command => "gem install $name --version $version --no-rdoc --no-ri",
unless => "gem query -i --name-matches $name --version $version",
logoutput => true,
}
}

notice("Installing buildr")
notice('Installing buildr')

package { "rake":
ensure => "0.8.7",
package { 'rake':
ensure => '0.8.7',
provider => gem,
}
install-gem { "buildr" :
version => "1.4.5",
require => Package["rake"],
maven::install-gem { 'buildr' :
version => '1.4.5',
require => Package['rake'],
}
}
11 changes: 6 additions & 5 deletions manifests/init.pp
Expand Up @@ -14,7 +14,8 @@

# Class: maven
#
# A puppet recipe for Apache Maven, to download artifacts from a Maven repository
# A puppet recipe for Apache Maven, to download artifacts
# from a Maven repository
#
# It uses Apache Maven command line to download the artifacts.
#
Expand All @@ -30,12 +31,12 @@
# version => "2.2.1",
# }

class maven() {
class maven {

notice("Installing Maven module pre-requisites")
notice('Installing Maven module pre-requisites')

class { "maven::maven" :
version => "2.2.1",
class { 'maven::maven' :
version => '2.2.1',
}

}
56 changes: 28 additions & 28 deletions manifests/maven.pp
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Class: maven::maven
#
#
# A puppet recipe to install Apache Maven
#
# Parameters:
Expand All @@ -27,14 +27,14 @@
# class {'maven::maven':
# version => "2.2.1",
# }
class maven::maven( $version = "2.2.1",
class maven::maven( $version = '2.2.1',
$repo = {
#url => "http://repo1.maven.org/maven2",
#username => "",
#password => "",
}, $user = "root", $home = "/root", $user_system = true,
$maven_opts = "",
$maven_path_aditions = "" ) {
#url => 'http://repo1.maven.org/maven2',
#username => '',
#password => '',
}, $user = 'root', $home = '/root', $user_system = true,
$maven_opts = '',
$maven_path_aditions = '' ) {

$archive = "/tmp/apache-maven-${version}-bin.tar.gz"

Expand All @@ -43,45 +43,45 @@
ensure => present,
home => $home,
managehome => true,
shell => "/bin/bash",
shell => '/bin/bash',
system => $user_system,
}
}

# we could use puppet-stdlib function !empty(repo) but avoiding adding a new dependency for now
if "x${repo['url']}x" != "xx" {
wget::authfetch { "fetch-maven":
source => "${repo['url']}/org/apache/maven/apache-maven/$version/apache-maven-${version}-bin.tar.gz",
if "x${repo['url']}x" != 'xx' {
wget::authfetch { 'fetch-maven':
source => "${repo['url']}/org/apache/maven/apache-maven/$version/apache-maven-${version}-bin.tar.gz",
destination => $archive,
user => $repo['username'],
password => $repo['password'],
before => Exec["maven-untar"],
user => $repo['username'],
password => $repo['password'],
before => Exec['maven-untar'],
}
} else {
wget::fetch { "fetch-maven":
source => "http://archive.apache.org/dist/maven/binaries/apache-maven-${version}-bin.tar.gz",
wget::fetch { 'fetch-maven':
source => "http://archive.apache.org/dist/maven/binaries/apache-maven-${version}-bin.tar.gz",
destination => $archive,
before => Exec["maven-untar"],
before => Exec['maven-untar'],
}
}
exec { "maven-untar":
exec { 'maven-untar':
command => "tar xf /tmp/apache-maven-${version}-bin.tar.gz",
cwd => "/opt",
cwd => '/opt',
creates => "/opt/apache-maven-${version}",
path => ["/bin"],
path => ['/bin'],
} ->
file { "/usr/bin/mvn":
file { '/usr/bin/mvn':
ensure => link,
target => "/opt/apache-maven-${version}/bin/mvn",
}
file { "/usr/local/bin/mvn":
ensure => absent,
require => Exec["maven-untar"],
file { '/usr/local/bin/mvn':
ensure => absent,
require => Exec['maven-untar'],
}
file { "$home/.mavenrc":
mode => "0600",
owner => $user,
content => template("maven/mavenrc.erb"),
mode => '0600',
owner => $user,
content => template('maven/mavenrc.erb'),
require => User[$user],
}
}
11 changes: 6 additions & 5 deletions manifests/settings.pp
Expand Up @@ -13,18 +13,19 @@
# limitations under the License.

# Class: maven::settings
#
#
# A puppet recipe to set the contents of the settings.xml file
#
class maven::settings( $home = "/root", $user = "root", $servers = [], $mirrors = [] ) {
class maven::settings( $home = '/root', $user = 'root',
$servers = [], $mirrors = [] ) {

file { "${home}/.m2":
ensure => directory,
} ->
file { "${home}/.m2/settings.xml":
owner => $user,
mode => "0600",
content => template("maven/settings.xml.erb"),
owner => $user,
mode => '0600',
content => template('maven/settings.xml.erb'),
}

}

0 comments on commit 8492942

Please sign in to comment.