mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Add the "rpm" remote dependency.
This commit is contained in:
parent
6543a8f3e6
commit
13d14e3d7d
2 changed files with 17 additions and 0 deletions
|
@ -49,6 +49,12 @@ module Capistrano
|
|||
self
|
||||
end
|
||||
|
||||
def rpm(name, version, options={})
|
||||
@message ||= "package `#{name}' #{version} could not be found"
|
||||
try("rpm -q #{name} | grep '#{version}'", options)
|
||||
self
|
||||
end
|
||||
|
||||
def match(command, expect, options={})
|
||||
expect = Regexp.new(Regexp.escape(expect.to_s)) unless expect.is_a?(Regexp)
|
||||
|
||||
|
|
|
@ -43,6 +43,12 @@ class RemoteDependencyTest < Test::Unit::TestCase
|
|||
assert_equal "package `dpkg' 1.15 could not be found (host)", @dependency.message
|
||||
end
|
||||
|
||||
def test_should_use_standard_error_message_for_rpm
|
||||
setup_for_a_configuration_rpm_run("rpm", "4.8", false)
|
||||
@dependency.rpm("rpm", "4.8")
|
||||
assert_equal "package `rpm' 4.8 could not be found (host)", @dependency.message
|
||||
end
|
||||
|
||||
def test_should_fail_if_directory_not_found
|
||||
setup_for_a_configuration_run("test -d /data", false)
|
||||
assert !@dependency.directory("/data").pass?
|
||||
|
@ -132,4 +138,9 @@ class RemoteDependencyTest < Test::Unit::TestCase
|
|||
find_deb_cmd = "dpkg -s #{name} | grep '^Version: #{version}'"
|
||||
setup_for_a_configuration_run(find_deb_cmd, passing)
|
||||
end
|
||||
|
||||
def setup_for_a_configuration_rpm_run(name, version, passing)
|
||||
find_rpm_cmd = "rpm -q #{name} | grep '#{version}'"
|
||||
setup_for_a_configuration_run(find_rpm_cmd, passing)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue