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

Add runkit #64

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
58 changes: 58 additions & 0 deletions manifests/extension/runkit.pp
Original file line number Diff line number Diff line change
@@ -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
# Require php version eg. php::5_4_10

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New syntax here please.

# This will compile, install and set up config dirs if not present
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'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of using non-canonical source. Can you get the upstream tagged by the original author?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "canonical" source for runkit is... complicated.

The PECL extension hasn't had a release for 8 years: https://pecl.php.net/package/runkit
Even compiling from source for PECL isn't compatible with PHP 5.3+: http://git.php.net/?p=pecl/php/runkit.git;a=summary
There is a fork on GitHub which works up to PHP 5.5: https://github.com/zenovich/runkit
There is then another fork of that works on PHP 5.6: https://github.com/padraic/runkit

Basically it's a mess, I can request any of these upstreams to create a tag, but none are the canonical source.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think even getting those to make a tag would be better than forking and tagging your own. I don't know. It makes me wonder if this is really appropriate for inclusion in the first place if it is that poorly supported.

}


# 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],
}

}
37 changes: 37 additions & 0 deletions spec/defines/extensions/php_extension_runkit_spec.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions spec/fixtures/runkit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extension=/test/boxen/phpenv/versions/5.4.17/modules/runkit.so

runkit.internal_override=1
3 changes: 3 additions & 0 deletions templates/extensions/runkit.ini.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extension=<%= @module_path %>

runkit.internal_override=1
1 change: 1 addition & 0 deletions templates/extensions/zend_generic.ini.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zend_extension=<%= @module_path %>