diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp new file mode 100644 index 0000000..2e35aed --- /dev/null +++ b/manifests/extension/imap.pp @@ -0,0 +1,45 @@ +# Installs the imap extension for a specific version of php. +# +# Usage: +# +# php::extension::imap { 'imap for 5.4.10': +# php => '5.4.10' +# } +# +define php::extension::imap( + $php, +) { + require php::config + require imap + + # Ensure that the specified version of PHP is installed. + php_require($php) + + $extension = 'imap' + + # Final module install path + $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + + # Additional options + $configure_params = "--with-imap=${boxen::config::homebrewdir}/opt/imap --with-imap-ssl --with-kerberos" + + php_extension { $name: + provider => php_source, + + extension => $extension, + + homebrew_path => $boxen::config::homebrewdir, + phpenv_root => $php::config::root, + php_version => $php, + + configure_params => $configure_params, + } + + # Add config file once extension is installed + + file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + content => template('php/extensions/generic.ini.erb'), + require => Php_extension[$name], + } + +} diff --git a/spec/defines/extensions/php_extension_imap_spec.rb b/spec/defines/extensions/php_extension_imap_spec.rb new file mode 100644 index 0000000..5e826fd --- /dev/null +++ b/spec/defines/extensions/php_extension_imap_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe "php::extension::imap" do + let(:facts) { default_test_facts } + let(:title) { "imap for 5.4.17" } + let(:params) do + { + :php => "5.4.17", + } + end + + it do + should contain_class("php::config") + should contain_class("imap") + should contain_php__version("5.4.17") + + should contain_php_extension("imap for 5.4.17").with({ + :provider => "php_source", + :extension => "imap", + :homebrew_path => "/test/boxen/homebrew", + :phpenv_root => "/test/boxen/phpenv", + :php_version => "5.4.17", + :configure_params => "--with-imap=/test/boxen/homebrew/opt/imap --with-imap-ssl --with-kerberos", + }) + + should contain_file("/test/boxen/config/php/5.4.17/conf.d/imap.ini").with({ + :content => File.read("spec/fixtures/imap.ini"), + :require => "Php_extension[imap for 5.4.17]" + }) + end +end diff --git a/spec/fixtures/Puppetfile b/spec/fixtures/Puppetfile index ede7f1a..0491320 100644 --- a/spec/fixtures/Puppetfile +++ b/spec/fixtures/Puppetfile @@ -12,3 +12,4 @@ mod "mysql", "1.1.3", :github_tarball => "boxen/puppet-mysql" mod "postgresql", "2.0.1", :github_tarball => "boxen/puppet-postgresql" mod "nginx", "1.4.2", :github_tarball => "boxen/puppet-nginx" mod "module_data", "0.0.3", :github_tarball => "ripienaar/puppet-module-data" +mod "imap", "1.0.1", :github_tarball => "namesco/puppet-imap" diff --git a/spec/fixtures/Puppetfile.lock b/spec/fixtures/Puppetfile.lock index 7225d84..6314a74 100644 --- a/spec/fixtures/Puppetfile.lock +++ b/spec/fixtures/Puppetfile.lock @@ -58,6 +58,11 @@ GITHUBTARBALL specs: wget (1.0.0) +GITHUBTARBALL + remote: namesco/puppet-imap + specs: + imap (1.0.1) + GITHUBTARBALL remote: puppetlabs/puppetlabs-stdlib specs: @@ -72,6 +77,7 @@ DEPENDENCIES autoconf (= 1.0.0) boxen (= 3.0.2) homebrew (= 1.4.1) + imap (= 1.0.1) libpng (= 1.0.0) libtool (= 1.0.0) module_data (= 0.0.3) diff --git a/spec/fixtures/imap.ini b/spec/fixtures/imap.ini new file mode 100644 index 0000000..3a18d6d --- /dev/null +++ b/spec/fixtures/imap.ini @@ -0,0 +1 @@ +extension=/test/boxen/phpenv/versions/5.4.17/modules/imap.so