Skip to content

Commit

Permalink
Abstract zmq source cache into a separate class, #10
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheath committed Mar 15, 2013
1 parent 0c11312 commit 2fe06ac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
18 changes: 18 additions & 0 deletions manifests/extension/cache/zmq.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Provides a cached copy of the zmq extension source code
#
# This has been refactored into a separate class so that it can be
# instantiated multiple times - for example if multiple versions of
# php are installed with the zmq extension

class php::extension::cache::zmq {

require php::config
require php

# Clone the source repository
repository { "${php::config::extensioncachedir}/zmq":
source => 'mkoppanen/php-zmq',
require => File["${php::config::extensioncachedir}"],
}

}
15 changes: 5 additions & 10 deletions manifests/extension/zmq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@
$php
) {
require zeromq

require php::config
require php::extension::cache::zmq

# 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 = 'zmq'

# Final module install path
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so"

# Clone the source repository
repository { "${php::config::extensioncachedir}/zmq":
source => 'mkoppanen/php-zmq'
}

# Build & install the extension
php_extension { $name:
provider => 'git',
Expand All @@ -42,8 +35,10 @@
require => Repository["${php::config::extensioncachedir}/zmq"],
}

# Add config file once extension is installed
# Final module install path - used for ini file
$module_path = "${php::config::root}/versions/${php}/modules/${extension}.so"

# Add config file once extension is installed
file { "${php::config::configdir}/${php}/conf.d/${extension}.ini":
content => template("php/extensions/${extension}.ini.erb"),
require => Php_extension[$name],
Expand Down

0 comments on commit 2fe06ac

Please sign in to comment.