This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
forked from mattheath/puppet-php
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from webflo/xhprof
Add Xhprof extension.
- Loading branch information
Showing
6 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Installs a php extension for a specific version of php. | ||
# | ||
# Usage: | ||
# | ||
# php::extension::xhprof { 'xhprof for 5.4.10': | ||
# php => '5.4.10', | ||
# version => '0.9.4' | ||
# } | ||
# | ||
define php::extension::xhprof( | ||
$php, | ||
$version = '0.9.4', | ||
$config_template = 'php/extensions/xhprof.ini.erb' | ||
) { | ||
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 = 'xhprof' | ||
$package_name = "xhprof-${version}" | ||
$url = "http://pecl.php.net/get/xhprof-${version}.tgz" | ||
|
||
# Final module install path | ||
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" | ||
|
||
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, | ||
extension_dir => 'extension' | ||
} | ||
|
||
# Add config file once extension is installed | ||
|
||
file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": | ||
content => template($config_template), | ||
require => Php_extension[$name], | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'spec_helper' | ||
|
||
describe "php::extension::xhprof" do | ||
let(:facts) { default_test_facts } | ||
let(:title) { "xhprof for 5.4.17" } | ||
let(:params) do | ||
{ | ||
:php => "5.4.17", | ||
:version => "0.9.4" | ||
} | ||
end | ||
|
||
it do | ||
should include_class("php::config") | ||
should include_class("php::5_4_17") | ||
|
||
should contain_php_extension("xhprof for 5.4.17").with({ | ||
:extension => "xhprof", | ||
:version => "0.9.4", | ||
:package_name => "xhprof-0.9.4", | ||
:package_url => "http://pecl.php.net/get/xhprof-0.9.4.tgz", | ||
:homebrew_path => "/test/boxen/homebrew", | ||
:phpenv_root => "/test/boxen/phpenv", | ||
:php_version => "5.4.17", | ||
:cache_dir => "/test/boxen/data/php/cache/extensions", | ||
}) | ||
|
||
should contain_file("/test/boxen/config/php/5.4.17/conf.d/xhprof.ini").with({ | ||
:content => File.read("spec/fixtures/xhprof.ini"), | ||
:require => "Php_extension[xhprof for 5.4.17]" | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extension=/test/boxen/phpenv/versions/5.4.17/modules/xhprof.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extension=<%= @module_path %> |