diff --git a/manifests/extension/runkit.pp b/manifests/extension/runkit.pp new file mode 100644 index 0000000..36e9ba4 --- /dev/null +++ b/manifests/extension/runkit.pp @@ -0,0 +1,58 @@ +# Installs a php extension for a specific version of php. +# +# Usage: +# +# php::extension::runkit { 'runkit for 5.4.10': +# php => '5.4.10', +# version => '1.0.3' +# } +# +define php::extension::runkit( + $php, + $version = '1.0.3' +) { + include boxen::config + + require php::config + + # Ensure that the specified version of PHP is installed. + php_require($php) + + $extension = 'runkit' + + # Final module install path + $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + + # Clone the source respository + repository { "${php::config::extensioncachedir}/runkit": + source => 'namesco/runkit' + } + + + # Additional options + $configure_params = '' + + php_extension { $name: + provider => 'git', + + extension => $extension, + version => $version, + + 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/runkit.ini.erb'), + require => Php_extension[$name], + } + +} 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 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 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 %>