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

Commit 43cbfb4

Browse files
committed
Merge pull request #51 from typhonius/master
Added ssh2 extension
2 parents e627227 + 720498e commit 43cbfb4

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

manifests/extension/ssh2.pp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Installs a php extension for a specific version of php.
2+
#
3+
# Usage:
4+
#
5+
# php::extension::ssh2 { 'ssh2 for 5.4.10':
6+
# version => '0.12'
7+
# php => '5.4.10',
8+
# }
9+
#
10+
define php::extension::ssh2(
11+
$php,
12+
$version = '0.12'
13+
) {
14+
include boxen::config
15+
require ssh2::lib
16+
17+
require php::config
18+
# Require php version eg. php::5_4_10
19+
# This will compile, install and set up config dirs if not present
20+
require join(['php', join(split($php, '[.]'), '_')], '::')
21+
22+
$extension = 'ssh2'
23+
$package_name = "ssh2-${version}"
24+
$url = "http://pecl.php.net/get/ssh2-${version}.tgz"
25+
26+
# Final module install path
27+
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so"
28+
29+
# Additional options
30+
$configure_params = "--with-libssh2=${boxen::config::homebrewdir}/opt/libssh2"
31+
32+
php_extension { $name:
33+
extension => $extension,
34+
version => $version,
35+
package_name => $package_name,
36+
package_url => $url,
37+
homebrew_path => $boxen::config::homebrewdir,
38+
phpenv_root => $php::config::root,
39+
php_version => $php,
40+
cache_dir => $php::config::extensioncachedir,
41+
provider => pecl,
42+
configure_params => $configure_params,
43+
}
44+
45+
# Add config file once extension is installed
46+
47+
file { "${php::config::configdir}/${php}/conf.d/${extension}.ini":
48+
content => template('php/extensions/generic.ini.erb'),
49+
require => Php_extension[$name],
50+
}
51+
52+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require 'spec_helper'
2+
3+
describe "php::extension::ssh2" do
4+
let(:pre_condition) { "class ssh2::lib {}" }
5+
let(:facts) { default_test_facts }
6+
let(:title) { "ssh2 for 5.4.17" }
7+
let(:params) do
8+
{
9+
:php => "5.4.17",
10+
:version => "0.12"
11+
}
12+
end
13+
14+
it do
15+
should include_class("boxen::config")
16+
should include_class("ssh2::lib")
17+
should include_class("php::config")
18+
should include_class("php::5_4_17")
19+
20+
should contain_php_extension("ssh2 for 5.4.17").with({
21+
:extension => "ssh2",
22+
:version => "0.12",
23+
:package_name => "ssh2-0.12",
24+
:package_url => "http://pecl.php.net/get/ssh2-0.12.tgz",
25+
:homebrew_path => "/test/boxen/homebrew",
26+
:phpenv_root => "/test/boxen/phpenv",
27+
:php_version => "5.4.17",
28+
:cache_dir => "/test/boxen/data/php/cache/extensions",
29+
:provider => "pecl",
30+
})
31+
32+
should contain_file("/test/boxen/config/php/5.4.17/conf.d/ssh2.ini").with({
33+
:content => File.read("spec/fixtures/ssh2.ini"),
34+
:require => "Php_extension[ssh2 for 5.4.17]"
35+
})
36+
end
37+
end

spec/fixtures/ssh2.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=/test/boxen/phpenv/versions/5.4.17/modules/ssh2.so

0 commit comments

Comments
 (0)