From 56761711a92ece9414ed5a7ba67ef1ede724e4db Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 24 May 2016 10:19:29 -0400 Subject: Squashed 'puppet/modules/rubygems/' content from commit 510a369 git-subtree-dir: puppet/modules/rubygems git-subtree-split: 510a3693eab5dc78ed27d3728ee4d3b12334ea12 --- files/gemrc | 3 ++ manifests/activerecord.pp | 7 +++ manifests/activesupport.pp | 7 +++ manifests/backports.pp | 7 +++ manifests/bcrypt.pp | 14 ++++++ manifests/brokengem.pp | 14 ++++++ manifests/camping.pp | 7 +++ manifests/captcha/v_0_1_2.pp | 5 ++ manifests/chronic_duration.pp | 5 ++ manifests/devel.pp | 6 +++ manifests/fastercsv.pp | 6 +++ manifests/gd/v_0_7_4.pp | 5 ++ manifests/gem.pp | 108 ++++++++++++++++++++++++++++++++++++++++++ manifests/gem/cachedir.pp | 4 ++ manifests/gpgme.pp | 35 ++++++++++++++ manifests/hiera.pp | 7 +++ manifests/hiera_puppet.pp | 7 +++ manifests/highline.pp | 14 ++++++ manifests/init.pp | 31 ++++++++++++ manifests/ip.pp | 7 +++ manifests/json/v_1_4_6.pp | 3 ++ manifests/lockfile.pp | 7 +++ manifests/mail.pp | 19 ++++++++ manifests/maildir.pp | 15 ++++++ manifests/markaby.pp | 7 +++ manifests/moneta.pp | 7 +++ manifests/mysql.pp | 5 ++ manifests/net_ldap/v_0_0_4.pp | 3 ++ manifests/ntlm/v_0_1_1.pp | 3 ++ manifests/open4.pp | 7 +++ manifests/pbkdf2.pp | 8 ++++ manifests/postgres.pp | 11 +++++ manifests/rack.pp | 7 +++ manifests/sinatra.pp | 7 +++ manifests/sqlite.pp | 6 +++ manifests/systemu.pp | 7 +++ manifests/thin.pp | 7 +++ manifests/tlsmail.pp | 7 +++ manifests/tmail.pp | 7 +++ manifests/xmlsimple.pp | 20 ++++++++ manifests/xmpp4r.pp | 7 +++ manifests/ya2yaml.pp | 7 +++ 42 files changed, 476 insertions(+) create mode 100644 files/gemrc create mode 100644 manifests/activerecord.pp create mode 100644 manifests/activesupport.pp create mode 100644 manifests/backports.pp create mode 100644 manifests/bcrypt.pp create mode 100644 manifests/brokengem.pp create mode 100644 manifests/camping.pp create mode 100644 manifests/captcha/v_0_1_2.pp create mode 100644 manifests/chronic_duration.pp create mode 100644 manifests/devel.pp create mode 100644 manifests/fastercsv.pp create mode 100644 manifests/gd/v_0_7_4.pp create mode 100644 manifests/gem.pp create mode 100644 manifests/gem/cachedir.pp create mode 100644 manifests/gpgme.pp create mode 100644 manifests/hiera.pp create mode 100644 manifests/hiera_puppet.pp create mode 100644 manifests/highline.pp create mode 100644 manifests/init.pp create mode 100644 manifests/ip.pp create mode 100644 manifests/json/v_1_4_6.pp create mode 100644 manifests/lockfile.pp create mode 100644 manifests/mail.pp create mode 100644 manifests/maildir.pp create mode 100644 manifests/markaby.pp create mode 100644 manifests/moneta.pp create mode 100644 manifests/mysql.pp create mode 100644 manifests/net_ldap/v_0_0_4.pp create mode 100644 manifests/ntlm/v_0_1_1.pp create mode 100644 manifests/open4.pp create mode 100644 manifests/pbkdf2.pp create mode 100644 manifests/postgres.pp create mode 100644 manifests/rack.pp create mode 100644 manifests/sinatra.pp create mode 100644 manifests/sqlite.pp create mode 100644 manifests/systemu.pp create mode 100644 manifests/thin.pp create mode 100644 manifests/tlsmail.pp create mode 100644 manifests/tmail.pp create mode 100644 manifests/xmlsimple.pp create mode 100644 manifests/xmpp4r.pp create mode 100644 manifests/ya2yaml.pp diff --git a/files/gemrc b/files/gemrc new file mode 100644 index 00000000..040f20ba --- /dev/null +++ b/files/gemrc @@ -0,0 +1,3 @@ +--- +:sources: +- https://rubygems.org/ diff --git a/manifests/activerecord.pp b/manifests/activerecord.pp new file mode 100644 index 00000000..131222af --- /dev/null +++ b/manifests/activerecord.pp @@ -0,0 +1,7 @@ +class rubygems::activerecord { + require rubygems + package{'activerecord': + ensure => present, + provider => gem, + } +} diff --git a/manifests/activesupport.pp b/manifests/activesupport.pp new file mode 100644 index 00000000..ae5aee70 --- /dev/null +++ b/manifests/activesupport.pp @@ -0,0 +1,7 @@ +class rubygems::activesupport { + require rubygems + package{'activesupport': + ensure => present, + provider => gem, + } +} diff --git a/manifests/backports.pp b/manifests/backports.pp new file mode 100644 index 00000000..4290e340 --- /dev/null +++ b/manifests/backports.pp @@ -0,0 +1,7 @@ +class rubygems::backports { + require rubygems::devel + package{'backports': + ensure => present, + provider => gem, + } +} diff --git a/manifests/bcrypt.pp b/manifests/bcrypt.pp new file mode 100644 index 00000000..4c646477 --- /dev/null +++ b/manifests/bcrypt.pp @@ -0,0 +1,14 @@ +class rubygems::bcrypt { + if ($::osfamily == 'RedHat') and + versioncmp($::operatingsystemrelease,'6') > 0 { + package{'rubygem-bcrypt': + ensure => present, + } + } else { + require rubygems + package{'bcrypt-ruby': + ensure => present, + provider => gem, + } + } +} diff --git a/manifests/brokengem.pp b/manifests/brokengem.pp new file mode 100644 index 00000000..b3284d97 --- /dev/null +++ b/manifests/brokengem.pp @@ -0,0 +1,14 @@ +define rubygems::brokengem($source,$ensure) { + exec { "get-gem-$name": + command => "/usr/bin/wget --output-document=/tmp/$name.gem $source", + creates => "/tmp/$name.gem", + before => Package[$name] + } + package{$name: + ensure => $ensure, + provider => gem, + source => "/tmp/$name.gem" + } +} + +# $Id$ diff --git a/manifests/camping.pp b/manifests/camping.pp new file mode 100644 index 00000000..f79fca13 --- /dev/null +++ b/manifests/camping.pp @@ -0,0 +1,7 @@ +class rubygems::camping { + require rubygems::rack + package{'camping': + ensure => present, + provider => gem, + } +} diff --git a/manifests/captcha/v_0_1_2.pp b/manifests/captcha/v_0_1_2.pp new file mode 100644 index 00000000..2a4e7123 --- /dev/null +++ b/manifests/captcha/v_0_1_2.pp @@ -0,0 +1,5 @@ +class rubygems::captcha::v_0_1_2 { + rubygems::gem{ 'captcha-0.1.2': + requiresgcc => true, + } +} diff --git a/manifests/chronic_duration.pp b/manifests/chronic_duration.pp new file mode 100644 index 00000000..c789eb51 --- /dev/null +++ b/manifests/chronic_duration.pp @@ -0,0 +1,5 @@ +class rubygems::chronic_duration { + rubygems::gem{'chronic_duration': + ensure => present, + } +} diff --git a/manifests/devel.pp b/manifests/devel.pp new file mode 100644 index 00000000..2f69f892 --- /dev/null +++ b/manifests/devel.pp @@ -0,0 +1,6 @@ +class rubygems::devel { + include ::rubygems + include ruby::devel + include gcc +} + diff --git a/manifests/fastercsv.pp b/manifests/fastercsv.pp new file mode 100644 index 00000000..95ae0212 --- /dev/null +++ b/manifests/fastercsv.pp @@ -0,0 +1,6 @@ +class rubygems::fastercsv { + rubygems::gem{'fastercsv': + ensure => present, + source => 'http://rubyforge.org/frs/download.php/43190/fastercsv-1.4.0.gem', + } +} diff --git a/manifests/gd/v_0_7_4.pp b/manifests/gd/v_0_7_4.pp new file mode 100644 index 00000000..9027ecb5 --- /dev/null +++ b/manifests/gd/v_0_7_4.pp @@ -0,0 +1,5 @@ +class rubygems::gd::v_0_7_4 { + rubygems::gem{ 'ruby-gd-0.7.4': + buildflags => '--with-freetype', + } +} diff --git a/manifests/gem.pp b/manifests/gem.pp new file mode 100644 index 00000000..14b67850 --- /dev/null +++ b/manifests/gem.pp @@ -0,0 +1,108 @@ +# Installs gems that are slightly broken +# As a name it expects the name of the gem. +# If you want to want to install a certain version +# you have to append the version to the gem name: +# +# install a version of mime-types: +# rubygems::gem{'mime-types': } +# +# install version 0.0.4 of ruby-net-ldap: +# rubygems::gem{'ruby-net-ldap-0.0.4': } +# +# uninstall polygot gem (until no such gem is anymore installed): +# rubygems::gem{'polygot': ensure => absent } +# +# uninstall ruby-net-ldap version 0.0.3 +# rubygems::gem{'ruby-net-ldap-0.0.3': ensure => absent } +# +# You can also set your own buildlfags, which will then install +# the gem in question by the gem command. +# +# You can also enforce to use the gem command to manage the gem +# by setting provider to `exec`. +# +define rubygems::gem( + $ensure = 'present', + $source = 'absent', + $provider = 'default', + $buildflags = 'absent', + $requiresgcc = false +) { + require ::rubygems + if $requiresgcc or ($buildflags != 'absent') { + require ::gcc + } + + if $name =~ /\-(\d|\.)+$/ { + $real_name = regsubst($name,'^(.*)-(\d|\.)+$','\1') + $gem_version = regsubst($name,'^(.*)-(\d+(\d|\.)+)$','\2') + } else { + $real_name = $name + } + + if $source != 'absent' { + if $ensure != 'absent' { + require rubygems::gem::cachedir + exec{"get-gem-$name": + command => "/usr/bin/wget -O ${rubygems::gem::cachedir::dir}/$name.gem $source", + creates => "${rubygems::gem::cachedir::dir}/$name.gem", + } + } else { + file{"${rubygems::gem::cachedir::dir}/$name.gem": + ensure => 'absent'; + } + } + } + + if ($buildflags != 'absent') or ($provider == 'exec') { + if $gem_version { + $gem_version_str = "-v ${gem_version}" + $gem_version_check_str = $gem_version + } else { + $gem_version_check_str = '.*' + } + + if $ensure == 'present' { + $gem_cmd = 'install' + } else { + $gem_cmd = 'uninstall -x' + } + + if $buildflags != 'absent' { + $buildflags_str = "-- --build-flags ${buildflags}" + } else { + $buildflags_str = '' + } + + exec{"manage_gem_${name}": + command => "gem ${gem_cmd} ${real_name} ${gem_version_str} ${buildflags_str}", + } + + $gem_cmd_check_str = "gem list | egrep -q '^${real_name} \\(${gem_version_check_str}\\)\$'" + if $ensure == 'present' { + Exec["manage_gem_${name}"]{ + unless => $gem_cmd_check_str + } + } else { + Exec["manage_gem_${name}"]{ + onlyif => $gem_cmd_check_str + } + } + } else { + package{"$real_name": + ensure => $ensure ? { + 'absent' => $ensure, + default => $gem_version ? { + undef => $ensure, + default => $gem_version + } + }, + provider => gem, + } + if $source != 'absent' { + Package["$name"]{ + source => "${rubygems::gem::cachedir::dir}/$name.gem" + } + } + } +} diff --git a/manifests/gem/cachedir.pp b/manifests/gem/cachedir.pp new file mode 100644 index 00000000..3e371e42 --- /dev/null +++ b/manifests/gem/cachedir.pp @@ -0,0 +1,4 @@ +class rubygems::gem::cachedir { + $dir = '/var/lib/puppet/modules/rubygems_cache' + modules_dir{'rubygems_cache': } +} diff --git a/manifests/gpgme.pp b/manifests/gpgme.pp new file mode 100644 index 00000000..e9b04a9a --- /dev/null +++ b/manifests/gpgme.pp @@ -0,0 +1,35 @@ +class rubygems::gpgme{ + case $::operatingsystem { + debian,ubuntu: { + case $::lsbdistcodename { + 'lenny','squeeze': { + # install gpgme as gem, as the squeeze deb-package is too old + # for i.e. gpg module + $provider = 'gem' + $packagename = 'ruby-gpgme' + } + default: { + # don't need to install gpgme as gem, debian package works + # fine with the gpg module + $provider = 'apt' + $packagename = 'libgpgme-ruby' + } + } + } + default: { + $provider = 'gem' + $packagename = 'ruby-gpgme' + } + } + + if $provider == 'gem' { + require rubygems::devel + require gpg::gpgme::devel + } + + package{'ruby-gpgme': + ensure => present, + provider => $provider, + name => $packagename + } +} diff --git a/manifests/hiera.pp b/manifests/hiera.pp new file mode 100644 index 00000000..4c766a15 --- /dev/null +++ b/manifests/hiera.pp @@ -0,0 +1,7 @@ +class rubygems::hiera{ + require ::rubygems + package{'hiera': + ensure => installed, + provider => gem, + } +} diff --git a/manifests/hiera_puppet.pp b/manifests/hiera_puppet.pp new file mode 100644 index 00000000..319e7d0e --- /dev/null +++ b/manifests/hiera_puppet.pp @@ -0,0 +1,7 @@ +class rubygems::hiera_puppet { + require rubygems::hiera + package{'hiera-puppet': + ensure => installed, + provider => gem, + } +} diff --git a/manifests/highline.pp b/manifests/highline.pp new file mode 100644 index 00000000..e9da09a5 --- /dev/null +++ b/manifests/highline.pp @@ -0,0 +1,14 @@ +class rubygems::highline { + require rubygems + package{'rubygem-highline': + ensure => present, + } + + case $::operatingsystem { + debian,ubuntu: { + Package['rubygem-highline']{ + name => 'ruby-highline' + } + } + } +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 00000000..bca40b9e --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,31 @@ +# +# rubygems module +# original by luke kanies +# http://github.com/lak +# +# Copyright 2008, Puzzle ITC GmbH +# Marcel Härry haerry+puppet(at)puzzle.ch +# Simon Josi josi+puppet(at)puzzle.ch +# +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by +# the Free Software Foundation. +# + +# manage rubygems basics +class rubygems { + # from debian 8 on this is not anymore needed as it's part of the ruby pkg + if ($::operatingsystem != 'Debian') or (versioncmp($::operatingsystemrelease,'8') < 0) { + package{'rubygems': + ensure => installed, + } + } + file { '/etc/gemrc': + source => [ 'puppet:///modules/site_rubygems/gemrc', + 'puppet:///modules/rubygems/gemrc' ], + mode => '0644', + owner => 'root', + group => 'root', + } +} diff --git a/manifests/ip.pp b/manifests/ip.pp new file mode 100644 index 00000000..190d869d --- /dev/null +++ b/manifests/ip.pp @@ -0,0 +1,7 @@ +class rubygems::ip { + require rubygems + package{'ip': + ensure => present, + provider => gem, + } +} diff --git a/manifests/json/v_1_4_6.pp b/manifests/json/v_1_4_6.pp new file mode 100644 index 00000000..d0901ba3 --- /dev/null +++ b/manifests/json/v_1_4_6.pp @@ -0,0 +1,3 @@ +class rubygems::json::v_1_4_6 { + rubygems::gem{ 'json-1.4.6': } +} diff --git a/manifests/lockfile.pp b/manifests/lockfile.pp new file mode 100644 index 00000000..f4ed6b0f --- /dev/null +++ b/manifests/lockfile.pp @@ -0,0 +1,7 @@ +class rubygems::lockfile { + require rubygems + package{'lockfile': + ensure => present, + provider => gem, + } +} diff --git a/manifests/mail.pp b/manifests/mail.pp new file mode 100644 index 00000000..b8b50bbe --- /dev/null +++ b/manifests/mail.pp @@ -0,0 +1,19 @@ +# manage the mail rubygem +class rubygems::mail { + if ($::osfamily == 'RedHat') and + versioncmp($::operatingsystemrelease,'6') > 0 { + package{'rubygem-mail': + ensure => present, + } + } else { + require rubygems::devel + package{'mail': + ensure => present, + provider => gem, + } + + if $::rubyversion == '1.8.6' { + require rubygems::tlsmail + } + } +} diff --git a/manifests/maildir.pp b/manifests/maildir.pp new file mode 100644 index 00000000..8773f37a --- /dev/null +++ b/manifests/maildir.pp @@ -0,0 +1,15 @@ +# manage maildir rubygem +class rubygems::maildir { + if ($::osfamily == 'RedHat') and + versioncmp($::operatingsystemrelease,'6') > 0 { + package{'rubygem-maildir': + ensure => present, + } + } else { + require rubygems::devel + package{'maildir': + ensure => present, + provider => gem, + } + } +} diff --git a/manifests/markaby.pp b/manifests/markaby.pp new file mode 100644 index 00000000..817969e3 --- /dev/null +++ b/manifests/markaby.pp @@ -0,0 +1,7 @@ +class rubygems::markaby { + require rubygems + package{'markaby': + ensure => present, + provider => gem, + } +} diff --git a/manifests/moneta.pp b/manifests/moneta.pp new file mode 100644 index 00000000..ea9bb5a6 --- /dev/null +++ b/manifests/moneta.pp @@ -0,0 +1,7 @@ +class rubygems::moneta { + require rubygems + package{'moneta': + ensure => present, + provider => gem, + } +} diff --git a/manifests/mysql.pp b/manifests/mysql.pp new file mode 100644 index 00000000..cc0bbbf6 --- /dev/null +++ b/manifests/mysql.pp @@ -0,0 +1,5 @@ +class rubygems::mysql { + require ::mysql::devel + require gcc + rubygems::gem{'mysql':} +} diff --git a/manifests/net_ldap/v_0_0_4.pp b/manifests/net_ldap/v_0_0_4.pp new file mode 100644 index 00000000..88e1e7b4 --- /dev/null +++ b/manifests/net_ldap/v_0_0_4.pp @@ -0,0 +1,3 @@ +class rubygems::net_ldap::v_0_0_4 { + rubygems::gem{ 'ruby-net-ldap-0.0.4': } +} diff --git a/manifests/ntlm/v_0_1_1.pp b/manifests/ntlm/v_0_1_1.pp new file mode 100644 index 00000000..fd6eade3 --- /dev/null +++ b/manifests/ntlm/v_0_1_1.pp @@ -0,0 +1,3 @@ +class rubygems::ntlm::v_0_1_1 { + rubygems::gem{ 'rubyntlm-0.1.1': } +} diff --git a/manifests/open4.pp b/manifests/open4.pp new file mode 100644 index 00000000..1e3fbb78 --- /dev/null +++ b/manifests/open4.pp @@ -0,0 +1,7 @@ +class rubygems::open4 { + require rubygems + package{'open4': + ensure => present, + provider => gem, + } +} diff --git a/manifests/pbkdf2.pp b/manifests/pbkdf2.pp new file mode 100644 index 00000000..b2cf1136 --- /dev/null +++ b/manifests/pbkdf2.pp @@ -0,0 +1,8 @@ +class rubygems::pbkdf2{ + require ::rubygems + package{'pbkdf2': + ensure => installed, + provider => gem, + } +} + diff --git a/manifests/postgres.pp b/manifests/postgres.pp new file mode 100644 index 00000000..8720f4ef --- /dev/null +++ b/manifests/postgres.pp @@ -0,0 +1,11 @@ +class rubygems::postgres { + if $::osfamily == 'RedHat' and + versioncmp($::operatingsystemrelease,'5') > 0 { + package{'rubygem-pg': + ensure => installed, + } + } else { + require postgres::devel + rubygems::gem{'ruby-pg':} + } +} diff --git a/manifests/rack.pp b/manifests/rack.pp new file mode 100644 index 00000000..953ab22b --- /dev/null +++ b/manifests/rack.pp @@ -0,0 +1,7 @@ +class rubygems::rack { + require rubygems + package{'rack': + ensure => present, + provider => gem, + } +} diff --git a/manifests/sinatra.pp b/manifests/sinatra.pp new file mode 100644 index 00000000..327f829f --- /dev/null +++ b/manifests/sinatra.pp @@ -0,0 +1,7 @@ +class rubygems::sinatra { + require rubygems + package{'sinatra': + ensure => present, + provider => gem, + } +} diff --git a/manifests/sqlite.pp b/manifests/sqlite.pp new file mode 100644 index 00000000..6b670152 --- /dev/null +++ b/manifests/sqlite.pp @@ -0,0 +1,6 @@ +class rubygems::sqlite { + require rubygems::devel + package{'rubygem-sqlite3-ruby': + ensure => present, + } +} diff --git a/manifests/systemu.pp b/manifests/systemu.pp new file mode 100644 index 00000000..62a599cf --- /dev/null +++ b/manifests/systemu.pp @@ -0,0 +1,7 @@ +class rubygems::systemu { + require rubygems + package{'systemu': + ensure => present, + provider => gem, + } +} diff --git a/manifests/thin.pp b/manifests/thin.pp new file mode 100644 index 00000000..b2499d81 --- /dev/null +++ b/manifests/thin.pp @@ -0,0 +1,7 @@ +class rubygems::thin { + require rubygems + package{'thin': + ensure => present, + provider => gem, + } +} diff --git a/manifests/tlsmail.pp b/manifests/tlsmail.pp new file mode 100644 index 00000000..71aa6158 --- /dev/null +++ b/manifests/tlsmail.pp @@ -0,0 +1,7 @@ +class rubygems::tlsmail { + require rubygems::devel + package{'tlsmail': + ensure => present, + provider => gem, + } +} diff --git a/manifests/tmail.pp b/manifests/tmail.pp new file mode 100644 index 00000000..dd7117d9 --- /dev/null +++ b/manifests/tmail.pp @@ -0,0 +1,7 @@ +class rubygems::tmail { + require rubygems::devel + package{'tmail': + ensure => present, + provider => gem, + } +} diff --git a/manifests/xmlsimple.pp b/manifests/xmlsimple.pp new file mode 100644 index 00000000..914156b0 --- /dev/null +++ b/manifests/xmlsimple.pp @@ -0,0 +1,20 @@ +# xml simple lib +class rubygems::xmlsimple { + package{'rubygem-xml-simple': + ensure => present, + } + case $::operatingsystem { + debian,ubuntu: { + Package['rubygem-xml-simple']{ + name => 'libxml-simple-ruby' + } + } + } + if $::operatingsystem == 'CentOS' and versioncmp($::operatingsystemrelease, '6') > 0 { + # not yet packaged + Package['rubygem-xml-simple']{ + name => 'xml-simple', + provider => gem, + } + } +} diff --git a/manifests/xmpp4r.pp b/manifests/xmpp4r.pp new file mode 100644 index 00000000..068d5825 --- /dev/null +++ b/manifests/xmpp4r.pp @@ -0,0 +1,7 @@ +class rubygems::xmpp4r { + require ::rubygems + package{'xmpp4r': + ensure => present, + provider => gem, + } +} diff --git a/manifests/ya2yaml.pp b/manifests/ya2yaml.pp new file mode 100644 index 00000000..7df362dc --- /dev/null +++ b/manifests/ya2yaml.pp @@ -0,0 +1,7 @@ +class rubygems::ya2yaml { + require rubygems + package{'ya2yaml': + ensure => present, + provider => gem, + } +} -- cgit v1.2.3