From 891a05858776bce2968d6cbfc20ae3871f0dd9df Mon Sep 17 00:00:00 2001
From: Alex Mace
Date: Thu, 7 May 2015 21:03:08 +0100
Subject: [PATCH 1/6] Addition of the imap extension along with a spec file
---
manifests/extension/imap.pp | 46 +++++++++++++++++++
.../extensions/php_extension_imap_spec.rb | 30 ++++++++++++
spec/fixtures/imap.ini | 1 +
3 files changed, 77 insertions(+)
create mode 100644 manifests/extension/imap.pp
create mode 100644 spec/defines/extensions/php_extension_imap_spec.rb
create mode 100644 spec/fixtures/imap.ini
diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp
new file mode 100644
index 0000000..d22c825
--- /dev/null
+++ b/manifests/extension/imap.pp
@@ -0,0 +1,46 @@
+# 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 php version eg. php::5_4_10
+ # This will compile, install and set up config dirs if not present
+ 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/mcrypt"
+
+ 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..bf0e1f3
--- /dev/null
+++ b/spec/defines/extensions/php_extension_imap_spec.rb
@@ -0,0 +1,30 @@
+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_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",
+ })
+
+ 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/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
From e363a476a2850a92483a9afc4f795c5c40c2c3d4 Mon Sep 17 00:00:00 2001
From: Alex Mace
Date: Thu, 7 May 2015 21:29:01 +0100
Subject: [PATCH 2/6] Updated to require the imap module for the imap extension
---
manifests/extension/imap.pp | 1 +
spec/defines/extensions/php_extension_imap_spec.rb | 1 +
spec/fixtures/Puppetfile | 1 +
spec/fixtures/Puppetfile.lock | 6 ++++++
4 files changed, 9 insertions(+)
diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp
index d22c825..f4c4265 100644
--- a/manifests/extension/imap.pp
+++ b/manifests/extension/imap.pp
@@ -10,6 +10,7 @@
$php,
) {
require php::config
+ require imap
# Require php version eg. php::5_4_10
# This will compile, install and set up config dirs if not present
diff --git a/spec/defines/extensions/php_extension_imap_spec.rb b/spec/defines/extensions/php_extension_imap_spec.rb
index bf0e1f3..87cee8b 100644
--- a/spec/defines/extensions/php_extension_imap_spec.rb
+++ b/spec/defines/extensions/php_extension_imap_spec.rb
@@ -11,6 +11,7 @@
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({
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)
From 7f933d543bb5cfd3155692e5ffbffdba52dbb63e Mon Sep 17 00:00:00 2001
From: Alex Mace
Date: Thu, 7 May 2015 21:40:59 +0100
Subject: [PATCH 3/6] Updated to pass in the path to the imap c-client headers
---
manifests/extension/imap.pp | 3 +--
spec/defines/extensions/php_extension_imap_spec.rb | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp
index f4c4265..9e3371b 100644
--- a/manifests/extension/imap.pp
+++ b/manifests/extension/imap.pp
@@ -22,8 +22,7 @@
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so"
# Additional options
- $configure_params = '--with-imap'
- #=${boxen::config::homebrewdir}/opt/mcrypt"
+ $configure_params = "--with-imap=${boxen::config::homebrewdir}/include/imap"
php_extension { $name:
provider => php_source,
diff --git a/spec/defines/extensions/php_extension_imap_spec.rb b/spec/defines/extensions/php_extension_imap_spec.rb
index 87cee8b..1270fff 100644
--- a/spec/defines/extensions/php_extension_imap_spec.rb
+++ b/spec/defines/extensions/php_extension_imap_spec.rb
@@ -20,7 +20,7 @@
:homebrew_path => "/test/boxen/homebrew",
:phpenv_root => "/test/boxen/phpenv",
:php_version => "5.4.17",
- :configure_params => "--with-imap",
+ :configure_params => "--with-imap=/test/boxen/homebrew/include/imap",
})
should contain_file("/test/boxen/config/php/5.4.17/conf.d/imap.ini").with({
From 5a637092a7538c40ed3675e7486147e64016267e Mon Sep 17 00:00:00 2001
From: Alex Mace
Date: Thu, 7 May 2015 21:48:16 +0100
Subject: [PATCH 4/6] Switched to use the opt dir based on the homebrew php
formula
---
manifests/extension/imap.pp | 2 +-
spec/defines/extensions/php_extension_imap_spec.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp
index 9e3371b..d918c7e 100644
--- a/manifests/extension/imap.pp
+++ b/manifests/extension/imap.pp
@@ -22,7 +22,7 @@
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so"
# Additional options
- $configure_params = "--with-imap=${boxen::config::homebrewdir}/include/imap"
+ $configure_params = "--with-imap=${boxen::config::homebrewdir}/opt/imap"
php_extension { $name:
provider => php_source,
diff --git a/spec/defines/extensions/php_extension_imap_spec.rb b/spec/defines/extensions/php_extension_imap_spec.rb
index 1270fff..0222142 100644
--- a/spec/defines/extensions/php_extension_imap_spec.rb
+++ b/spec/defines/extensions/php_extension_imap_spec.rb
@@ -20,7 +20,7 @@
:homebrew_path => "/test/boxen/homebrew",
:phpenv_root => "/test/boxen/phpenv",
:php_version => "5.4.17",
- :configure_params => "--with-imap=/test/boxen/homebrew/include/imap",
+ :configure_params => "--with-imap=/test/boxen/homebrew/opt/imap",
})
should contain_file("/test/boxen/config/php/5.4.17/conf.d/imap.ini").with({
From a40193715eef97119d37f5c0fe371e1cfd911202 Mon Sep 17 00:00:00 2001
From: Alex Mace
Date: Thu, 7 May 2015 21:55:53 +0100
Subject: [PATCH 5/6] More config options since the c-client was built with
kerberos support
---
manifests/extension/imap.pp | 2 +-
spec/defines/extensions/php_extension_imap_spec.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp
index d918c7e..6373b56 100644
--- a/manifests/extension/imap.pp
+++ b/manifests/extension/imap.pp
@@ -22,7 +22,7 @@
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so"
# Additional options
- $configure_params = "--with-imap=${boxen::config::homebrewdir}/opt/imap"
+ $configure_params = "--with-imap=${boxen::config::homebrewdir}/opt/imap --with-imap-ssl --with-kerberos"
php_extension { $name:
provider => php_source,
diff --git a/spec/defines/extensions/php_extension_imap_spec.rb b/spec/defines/extensions/php_extension_imap_spec.rb
index 0222142..5e826fd 100644
--- a/spec/defines/extensions/php_extension_imap_spec.rb
+++ b/spec/defines/extensions/php_extension_imap_spec.rb
@@ -20,7 +20,7 @@
:homebrew_path => "/test/boxen/homebrew",
:phpenv_root => "/test/boxen/phpenv",
:php_version => "5.4.17",
- :configure_params => "--with-imap=/test/boxen/homebrew/opt/imap",
+ :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({
From 7503d76e2c125a0c6fc17002e819d553bb9b3d02 Mon Sep 17 00:00:00 2001
From: Alex Mace
Date: Wed, 13 May 2015 21:26:35 +0100
Subject: [PATCH 6/6] Updated the comment to remove the reference to v1 syntax
---
manifests/extension/imap.pp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/manifests/extension/imap.pp b/manifests/extension/imap.pp
index 6373b56..2e35aed 100644
--- a/manifests/extension/imap.pp
+++ b/manifests/extension/imap.pp
@@ -12,8 +12,7 @@
require php::config
require imap
- # Require php version eg. php::5_4_10
- # This will compile, install and set up config dirs if not present
+ # Ensure that the specified version of PHP is installed.
php_require($php)
$extension = 'imap'