From e16b4088ff0530381637d930542ed371a2bd00f0 Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 22 Jan 2015 12:00:52 +0000 Subject: [PATCH 01/10] Added the runkit extension --- manifests/extension/runkit.pp | 51 +++++++++++++++++++++++ templates/extensions/zend_generic.ini.erb | 1 + 2 files changed, 52 insertions(+) create mode 100644 manifests/extension/runkit.pp create mode 100644 templates/extensions/zend_generic.ini.erb diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp new file mode 100644 index 0000000..94b6ef2 --- /dev/null +++ b/manifests/extension/runkit.pp @@ -0,0 +1,51 @@ +# Installs a php extension for a specific version of php. +# +# Usage: +# +# php::extension::mailparse { 'mailparse for 5.4.10': +# php => '5.4.10', +# version => '1.0.6' +# } +# +define php::extension::mailparse( + $php, + $version = '2.1.6' +) { + include boxen::config + + require php::config + # Require php version eg. php::5_4_10 + # This will compile, install and set up config dirs if not present + require join(['php', join(split($php, '[.]'), '_')], '::') + + + $extension = 'mailparse' + $package_name = "mailparse-${version}" + $url = "http://pecl.php.net/get/mailparse-${version}.tgz" + + # Final module install path + $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + + # Additional options + $configure_params = "" + + php_extension { $name: + extension => $extension, + version => $version, + package_name => $package_name, + package_url => $url, + homebrew_path => $boxen::config::homebrewdir, + phpenv_root => $php::config::root, + php_version => $php, + cache_dir => $php::config::extensioncachedir, + 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/templates/extensions/zend_generic.ini.erb b/templates/extensions/zend_generic.ini.erb new file mode 100644 index 0000000..8affacc --- /dev/null +++ b/templates/extensions/zend_generic.ini.erb @@ -0,0 +1 @@ +zend_extension=<%= @module_path %> From a9bc444f2b27489a0964bccce7242231db4e71d9 Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 22 Jan 2015 15:14:04 +0000 Subject: [PATCH 02/10] Updated to turn in from mailparse to runkit --- manifests/extension/runkit.pp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index 94b6ef2..d3a8928 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -2,14 +2,14 @@ # # Usage: # -# php::extension::mailparse { 'mailparse for 5.4.10': +# php::extension::runkit { 'runkit for 5.4.10': # php => '5.4.10', -# version => '1.0.6' +# version => '1.0.3' # } # -define php::extension::mailparse( +define php::extension::runkit( $php, - $version = '2.1.6' + $version = '1.0.3' ) { include boxen::config @@ -19,9 +19,9 @@ require join(['php', join(split($php, '[.]'), '_')], '::') - $extension = 'mailparse' - $package_name = "mailparse-${version}" - $url = "http://pecl.php.net/get/mailparse-${version}.tgz" + $extension = 'runkit' + $package_name = "runkit-${version}" + $url = "https://github.com/zenovich/runkit/tarball/${version}" # Final module install path $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" @@ -44,7 +44,7 @@ # Add config file once extension is installed file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": - content => template('php/extensions/generic.ini.erb'), + content => template('php/extensions/zend_generic.ini.erb'), require => Php_extension[$name], } From a903ff9111c379f8b473c7602ebbbe27cf27273f Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 22 Jan 2015 15:22:43 +0000 Subject: [PATCH 03/10] Updated based on the couchbase extension, which comes from github too --- manifests/extension/runkit.pp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index d3a8928..74b0183 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -18,18 +18,22 @@ # This will compile, install and set up config dirs if not present require join(['php', join(split($php, '[.]'), '_')], '::') - $extension = 'runkit' - $package_name = "runkit-${version}" - $url = "https://github.com/zenovich/runkit/tarball/${version}" # Final module install path $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + # Clone the source respository + repository { "${php::config::extensioncachedir}/runkit": + source => 'zenovich/runkit" + } + + # Additional options $configure_params = "" php_extension { $name: + provider => 'git', extension => $extension, version => $version, package_name => $package_name, @@ -38,6 +42,7 @@ phpenv_root => $php::config::root, php_version => $php, cache_dir => $php::config::extensioncachedir, + require => Repository["${php::config::extensioncachedir}/runkit"], configure_params => $configure_params, } From ff38eafa2667bb78aab96cd58612216f74873ca2 Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 22 Jan 2015 15:27:47 +0000 Subject: [PATCH 04/10] Fixed a typo --- manifests/extension/runkit.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index 74b0183..a81c572 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -25,7 +25,7 @@ # Clone the source respository repository { "${php::config::extensioncachedir}/runkit": - source => 'zenovich/runkit" + source => 'zenovich/runkit' } From d10aaa1fd6ebea1b258a16ef1eefe227c13b7a80 Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 22 Jan 2015 15:34:21 +0000 Subject: [PATCH 05/10] Switched to a Namesco fork, so I could apply a recent tag --- manifests/extension/runkit.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index a81c572..2f05b8a 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -25,7 +25,7 @@ # Clone the source respository repository { "${php::config::extensioncachedir}/runkit": - source => 'zenovich/runkit' + source => 'namesco/runkit' } From 65be64258010c7c047c603bd86d0bb8eb92e1fc3 Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 22 Jan 2015 16:01:43 +0000 Subject: [PATCH 06/10] It seems that runkit should not be installed as a zend extension --- manifests/extension/runkit.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index 2f05b8a..d04f286 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -34,22 +34,24 @@ php_extension { $name: provider => 'git', + extension => $extension, version => $version, - package_name => $package_name, - package_url => $url, + homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, php_version => $php, + cache_dir => $php::config::extensioncachedir, require => Repository["${php::config::extensioncachedir}/runkit"], + configure_params => $configure_params, } # Add config file once extension is installed file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": - content => template('php/extensions/zend_generic.ini.erb'), + content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } From 30a8d80ca43c02c84a79a3e888a4b429cad09bca Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Thu, 29 Jan 2015 12:23:45 +0000 Subject: [PATCH 07/10] Runkit specific ini file so that internal_override can be enabled --- manifests/extension/runkit.pp | 2 +- templates/extensions/runkit.ini.erb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 templates/extensions/runkit.ini.erb diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index d04f286..9966600 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -51,7 +51,7 @@ # Add config file once extension is installed file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": - content => template('php/extensions/generic.ini.erb'), + content => template('php/extensions/runkit.ini.erb'), require => Php_extension[$name], } diff --git a/templates/extensions/runkit.ini.erb b/templates/extensions/runkit.ini.erb new file mode 100644 index 0000000..cd20708 --- /dev/null +++ b/templates/extensions/runkit.ini.erb @@ -0,0 +1,3 @@ +extension=<%= @module_path %> + +runkit.internal_override=1 \ No newline at end of file From 5b02ed109865f1e4d227f7c2e9d555beb84604dc Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Mon, 27 Apr 2015 23:34:59 +0100 Subject: [PATCH 08/10] Updates based on what other extensions are doing, and fixing a lart error --- manifests/extension/runkit.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index 9966600..04cd7df 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -16,7 +16,7 @@ require php::config # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - require join(['php', join(split($php, '[.]'), '_')], '::') + php_require($php) $extension = 'runkit' @@ -30,7 +30,7 @@ # Additional options - $configure_params = "" + $configure_params = '' php_extension { $name: provider => 'git', From 0876dc40d9cf8b8f5e4a79847fce1432f632c0dd Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Mon, 27 Apr 2015 23:35:31 +0100 Subject: [PATCH 09/10] A spec file added for the runkit extension --- .../extensions/php_extension_runkit_spec.rb | 37 +++++++++++++++++++ spec/fixtures/runkit.ini | 3 ++ 2 files changed, 40 insertions(+) create mode 100644 spec/defines/extensions/php_extension_runkit_spec.rb create mode 100644 spec/fixtures/runkit.ini diff --git a/spec/defines/extensions/php_extension_runkit_spec.rb b/spec/defines/extensions/php_extension_runkit_spec.rb new file mode 100644 index 0000000..34a77d2 --- /dev/null +++ b/spec/defines/extensions/php_extension_runkit_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe "php::extension::runkit" do + let(:facts) { default_test_facts } + let(:title) { "runkit for 5.4.17" } + let(:params) do + { + :php => "5.4.17", + :version => "1.0.3" + } + end + + it do + should contain_class("php::config") + should contain_php__version("5.4.17") + + should contain_repository("/test/boxen/data/php/cache/extensions/runkit").with({ + :source => "namesco/runkit" + }) + + should contain_php_extension("runkit for 5.4.17").with({ + :provider => "git", + :extension => "runkit", + :version => "1.0.3", + :homebrew_path => "/test/boxen/homebrew", + :phpenv_root => "/test/boxen/phpenv", + :php_version => "5.4.17", + :cache_dir => "/test/boxen/data/php/cache/extensions", + :require => "Repository[/test/boxen/data/php/cache/extensions/runkit]", + }) + + should contain_file("/test/boxen/config/php/5.4.17/conf.d/runkit.ini").with({ + :content => File.read("spec/fixtures/runkit.ini"), + :require => "Php_extension[runkit for 5.4.17]" + }) + end +end diff --git a/spec/fixtures/runkit.ini b/spec/fixtures/runkit.ini new file mode 100644 index 0000000..d365c43 --- /dev/null +++ b/spec/fixtures/runkit.ini @@ -0,0 +1,3 @@ +extension=/test/boxen/phpenv/versions/5.4.17/modules/runkit.so + +runkit.internal_override=1 \ No newline at end of file From eeb73b0a47c6fa78577441a0f7081357895e7bb9 Mon Sep 17 00:00:00 2001 From: Alex Mace Date: Wed, 13 May 2015 21:24:12 +0100 Subject: [PATCH 10/10] Updated the comment to remove the reference to v1 syntax --- manifests/extension/runkit.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp index 04cd7df..36e9ba4 100644 --- a/manifests/extension/runkit.pp +++ b/manifests/extension/runkit.pp @@ -14,8 +14,8 @@ include boxen::config require php::config - # 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 = 'runkit'