From bc6e4a189491f0e3f911b879efec3e570029dd8e Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 13 Mar 2014 19:51:23 -0500 Subject: New patch implementation and DSL This commit introduces a new patch implementation that supports checksums and caching. Patches are declared in blocks: patch do url ... sha1 ... end A strip level of -p1 is assumed. It can be overridden using a symbol argument: patch :p0 do url ... sha1 ... end Patches can be declared in stable, devel, and head blocks. This form is preferred over using conditionals. stable do # ... patch do url ... sha1 ... end end Embedded (__END__) patches are declared like so: patch :DATA patch :p0, :DATA Patches can also be embedded by passing a string. This makes it possible to provide multiple embedded patches while making only some of them conditional. patch :p0, "..." --- Library/Homebrew/test/test_software_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Library/Homebrew/test/test_software_spec.rb') diff --git a/Library/Homebrew/test/test_software_spec.rb b/Library/Homebrew/test/test_software_spec.rb index c35294320..7c9fb8720 100644 --- a/Library/Homebrew/test/test_software_spec.rb +++ b/Library/Homebrew/test/test_software_spec.rb @@ -80,6 +80,12 @@ class SoftwareSpecTests < Test::Unit::TestCase @spec.depends_on('foo' => :optional) assert_equal 'blah', @spec.build.first.description end + + def test_patch + @spec.patch :p1, :DATA + assert_equal 1, @spec.patches.length + assert_equal :p1, @spec.patches.first.strip + end end class HeadSoftwareSpecTests < Test::Unit::TestCase -- cgit v1.2.3