Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Adds support for the imap extension #66

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions manifests/extension/imap.pp
Original file line number Diff line number Diff line change
@@ -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],
}

}
31 changes: 31 additions & 0 deletions spec/defines/extensions/php_extension_imap_spec.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions spec/fixtures/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 6 additions & 0 deletions spec/fixtures/Puppetfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/imap.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension=/test/boxen/phpenv/versions/5.4.17/modules/imap.so