merge brokengem and package define to one together
authorMarcel Haerry <haerry@puzzle.ch>
Tue, 28 Sep 2010 16:24:01 +0000 (18:24 +0200)
committerMarcel Haerry <haerry@puzzle.ch>
Tue, 28 Sep 2010 16:24:01 +0000 (18:24 +0200)
manifests/fastercsv.pp
manifests/gem.pp [moved from manifests/brokengem.pp with 85% similarity]
manifests/gem/cachedir.pp [moved from manifests/brokengem/cachedir.pp with 69% similarity]
manifests/package.pp [deleted file]

index 1e6c364..95ae021 100644 (file)
@@ -1,6 +1,6 @@
 class rubygems::fastercsv {
-    rubygems::brokengem{'fastercsv':
-        ensure => present,
-        source => 'http://rubyforge.org/frs/download.php/43190/fastercsv-1.4.0.gem',
-    }
+  rubygems::gem{'fastercsv':
+    ensure => present,
+    source => 'http://rubyforge.org/frs/download.php/43190/fastercsv-1.4.0.gem',
+  }
 }
similarity index 85%
rename from manifests/brokengem.pp
rename to manifests/gem.pp
index a585ff9..90b3af8 100644 (file)
 # You can also enforce to use the gem command to manage the gem
 # by setting provider to `exec`.
 #
-define rubygems::brokengem(
+define rubygems::gem(
+  $ensure = 'present',
   $source = 'absent',
   $provider = 'default',
   $buildflags = 'absent',
-  $ensure = 'present'
-){
+  $requiresgcc = false
+) {
   require ::rubygems
+  if $requiresgcc {
+    require ::gcc
+  }
 
   if $name =~ /\-(\d|\.)+$/ {
     $real_name = regsubst($name,'^(.*)-(\d|\.)+$','\1')
@@ -38,13 +42,13 @@ define rubygems::brokengem(
 
   if $source != 'absent' {
     if $ensure != 'absent' {
-      require rubygems::brokengem::cachedir
+      require rubygems::gem::cachedir
       exec{"get-gem-$name":
-        command => "/usr/bin/wget -O ${rubygems::brokengem::cachedir::dir}/$name.gem $source",
-        creates => "${rubygems::brokengem::cachedir::dir}/$name.gem",
+        command => "/usr/bin/wget -O ${rubygems::gem::cachedir::dir}/$name.gem $source",
+        creates => "${rubygems::gem::cachedir::dir}/$name.gem",
       }
     } else {
-      file{"${rubygems::brokengem::cachedir::dir}/$name.gem":
+      file{"${rubygems::gem::cachedir::dir}/$name.gem":
         ensure => 'absent';
       }
     }
@@ -97,7 +101,7 @@ define rubygems::brokengem(
     }
     if $source != 'absent' {
       Package["$name"]{
-        source => "${rubygems::brokengem::cachedir::dir}/$name.gem"
+        source => "${rubygems::gem::cachedir::dir}/$name.gem"
       }
     }
   }
similarity index 69%
rename from manifests/brokengem/cachedir.pp
rename to manifests/gem/cachedir.pp
index 08f65f3..3e371e4 100644 (file)
@@ -1,4 +1,4 @@
-class rubygems::brokengem::cachedir {
+class rubygems::gem::cachedir {
   $dir = '/var/lib/puppet/modules/rubygems_cache'
   modules_dir{'rubygems_cache': }
 }
diff --git a/manifests/package.pp b/manifests/package.pp
deleted file mode 100644 (file)
index a0b604c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-define rubygems::package(
-    $ensure = 'present', 
-    $requiresgcc = false
-) {
-    if $requiresgcc {
-        require gcc
-    }
-
-    package{$name:
-        provider => gem,
-        ensure => $ensure,
-        require => Package['rubygems'],
-    }
-}