Permalink
Browse files

Merge pull request #73 from Punchkick-Interactive/master

Added support for the "pear" installer so that Sprinkle could more effectively be used for LAMP servers.
  • Loading branch information...
2 parents 37df051 + d4ede88 commit 8e8a13b0d179a41c537d20a962be6be318cc67c7 @crafterm committed Nov 17, 2012
@@ -0,0 +1,19 @@
+module Sprinkle
+ module Installers
+
+ class Pear < Installer
+ attr_accessor :package_name
+
+ def initialize(parent, package_name, &block)
+ super parent, &block
+ @package_name = package_name
+ end
+
+ protected
+ def install_commands #override
+ "pear install --alldeps #{@package_name}"
+ end
+
+ end #of class
+ end #module
+end #module
View
@@ -226,6 +226,12 @@ def verify(description = '', &block)
def pacman(*names, &block)
@installers << Sprinkle::Installers::Pacman.new(self, *names, &block)
end
+
+ def pear(thePackage, &block)
+ installer = Sprinkle::Installers::Pear.new(self, thePackage, &block)
+ logger.debug("the pear installer is " + installer.to_s)
+ @installers << installer;
+ end
def process(deployment, roles)
return if meta_package?
@@ -0,0 +1,21 @@
+module Sprinkle
+ module Verifiers
+ # = Pear package Verifier
+ #
+ # Contains a verifier to check the existence of a Pear package.
+ #
+ # == Example Usage
+ #
+ # verify { has_pear 'PHP_Compat' }
+ #
+ module Pear
+ Sprinkle::Verify.register(Sprinkle::Verifiers::Pear)
+
+ # Checks to make sure the pear <tt>package</tt> exists on the remote server.
+ def has_pear(package)
+ @commands << "pear list | grep \"#{package}\" | grep \"stable\""
+ end
+
+ end
+ end
+end
@@ -0,0 +1,21 @@
+require File.expand_path("../../spec_helper", File.dirname(__FILE__))
+
+describe Sprinkle::Installers::Pear do
+
+ before do
+ @package = mock(Sprinkle::Package, :name => 'spec')
+ end
+
+ def create_rake(names, options = {}, &block)
+ Sprinkle::Installers::Pear.new(@package, names, options, &block)
+ end
+
+ describe 'during installation' do
+
+ it 'should invoke the pear executer for all specified tasks' do
+ @installer = create_pear 'spec'
+ @install_commands = @installer.send :install_commands
+ @install_commands.should == "pear install --alldeps spec"
+ end
+ end
+end
View
@@ -74,6 +74,7 @@ Gem::Specification.new do |s|
"lib/sprinkle/installers/openbsd_pkg.rb",
"lib/sprinkle/installers/opensolaris_pkg.rb",
"lib/sprinkle/installers/pacman.rb",
+ "lib/sprinkle/installers/pear.rb",
"lib/sprinkle/installers/push_text.rb",
"lib/sprinkle/installers/rake.rb",
"lib/sprinkle/installers/replace_text.rb",
@@ -95,6 +96,7 @@ Gem::Specification.new do |s|
"lib/sprinkle/verifiers/executable.rb",
"lib/sprinkle/verifiers/file.rb",
"lib/sprinkle/verifiers/package.rb",
+ "lib/sprinkle/verifiers/pear.rb",
"lib/sprinkle/verifiers/process.rb",
"lib/sprinkle/verifiers/rpm.rb",
"lib/sprinkle/verifiers/ruby.rb",
@@ -123,6 +125,7 @@ Gem::Specification.new do |s|
"spec/sprinkle/installers/mac_port_spec.rb",
"spec/sprinkle/installers/openbsd_pkg_spec.rb",
"spec/sprinkle/installers/opensolaris_pkg_spec.rb",
+ "spec/sprinkle/installers/pear_spec.rb",
"spec/sprinkle/installers/push_text_spec.rb",
"spec/sprinkle/installers/rake_spec.rb",
"spec/sprinkle/installers/replace_text_spec.rb",

0 comments on commit 8e8a13b

Please sign in to comment.