Skip to content

Commit

Permalink
Merge pull request #261 from catatsuy/feature/pear-support
Browse files Browse the repository at this point in the history
suport pear in check_installed
  • Loading branch information
mizzy committed Oct 3, 2013
2 parents 2820b9b + d1e2cda commit edb21e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/serverspec/commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ def check_installed_by_pecl(name, version=nil)
cmd
end

def check_installed_by_pear(name, version=nil)
regexp = "^#{name}"
cmd = "pear list | grep -w -- #{escape(regexp)}"
cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
cmd
end

def check_installed_by_pip(name, version=nil)
regexp = "^#{name}"
cmd = "pip list | grep -w -- #{escape(regexp)}"
Expand Down
5 changes: 5 additions & 0 deletions spec/debian/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
it { should_not be_installed.by('pecl').with_version('invalid-version') }
end

describe package('XML_Util') do
it { should be_installed.by('pear').with_version('1.2.1') }
its(:command) { should eq "pear list | grep -w -- \\^XML_Util | grep -w -- 1.2.1" }
end

describe package('supervisor') do
it { should be_installed.by('pip').with_version('3.0') }
its(:command) { should eq "pip list | grep -w -- \\^supervisor | grep -w -- 3.0" }
Expand Down

0 comments on commit edb21e6

Please sign in to comment.