Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add the "rpm" remote dependency #172

Merged
merged 1 commit into from

2 participants

Nick Hoffman Lee Hambley
Nick Hoffman

Hi guys. Here's a patch that provides remote dependencies on RPM-based systems.

Lee Hambley
Owner

Thanks for bringing this back Nick! WIll try to make time for it in the coming days.

Nick Hoffman

You're welcome, Lee. It was dead simple to implement, and I finally got around to needing it.

Nick Hoffman

Any idea when this might be merged in?

Lee Hambley leehambley merged commit ec6c3d3 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 29, 2012
  1. Nick Hoffman
This page is out of date. Refresh to see the latest.
6 lib/capistrano/recipes/deploy/remote_dependency.rb
View
@@ -49,6 +49,12 @@ def deb(name, version, options={})
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)
11 test/deploy/remote_dependency_test.rb
View
@@ -43,6 +43,12 @@ def test_should_use_standard_error_message_for_deb
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 @@ def setup_for_a_configuration_deb_run(name, version, passing)
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
Something went wrong with that request. Please try again.