125 Commits

Author SHA1 Message Date
Jack Nagel
28fa5b0261 Remove some evals from formula DSL
The default arguments were removed from these methods long ago, so
nothing is standing in the way of using define_method here.
2014-05-27 21:03:47 -05:00
Jack Nagel
7af46a5ed0 Always use CurlDownloadStrategy for legacy patches
Fixes Homebrew/homebrew#27671.
2014-03-18 14:24:32 -05:00
Jack Nagel
bc6e4a1894 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, "..."
2014-03-13 21:35:41 -05:00
Jack Nagel
9b8cff1484 Tweak DownloadError message to include wrapped exception 2014-02-18 15:08:03 -05:00
Jack Nagel
c9784c1857 Collapse begin..end into def..end and use else clause 2014-02-18 15:08:03 -05:00
Drew Rodman
d63ef14794 Add DownloadError to catch a broader range of resource download errors.
Adding a broader exception class allows for errors raised in Resource.fetch
to be caught in upgrade and prevent the process from being killed when
a download fails. This should resolve issue 18364.

Fixes Homebrew/homebrew#18364.
Closes Homebrew/homebrew#26618.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-02-18 15:08:03 -05:00
Jack Nagel
ca0eff67fa Inline static exception text to remove a rescue 2014-02-18 13:27:35 -05:00
Mike McQuaid
a762f21e33 formula, resource: output when verifying checksum.
References Homebrew/homebrew#24566.
2013-12-08 21:37:40 +00:00
Mike McQuaid
8ba503ebb6 resource: convert unpack target to Pathname. 2013-11-27 13:29:24 +00:00
Mike McQuaid
1d0515c1d3 resource: only unpack to target if it exists. 2013-11-06 18:34:08 +00:00
Jack Nagel
d35e465671 fetch: clear partial downloads when --force is given
Fixes Homebrew/homebrew#23764.
2013-10-31 14:29:38 -05:00
Jack Nagel
9966943a34 Resource: extract unpacking from #stage
Closes Homebrew/homebrew#23768.
2013-10-30 10:43:57 -05:00
Jack Nagel
2dd44f7791 Resource: push conditional down into #verify_download_integrity 2013-10-30 10:16:20 -05:00
Jack Nagel
167017f89a Resource: do not mutate passed-in specs hash 2013-10-11 20:21:41 -05:00
Jack Nagel
b35d9906e5 Pass the mktemp prefix as an argument 2013-10-02 22:01:31 -05:00
Jack Nagel
c464c7549f Clean up SoftwareSpec and Resource initializers 2013-09-23 21:39:33 -05:00
Jack Nagel
50d2f632d9 Allow partial installation of resources 2013-09-17 21:29:54 -05:00
Jack Nagel
d46f500556 More useful error message for missing checksums 2013-09-17 21:29:54 -05:00
Jack Nagel
e3a3a0c320 Reorganize resource download methods 2013-09-17 21:29:53 -05:00
Jack Nagel
6116450328 Move formula resources to SoftwareSpec 2013-09-17 21:29:52 -05:00
Jack Nagel
df537528c7 Reimplement SoftwareSpec on top of Resource 2013-09-17 21:29:52 -05:00
Jack Nagel
eb3071332c Decouple Resource from SoftwareSpec 2013-09-17 21:29:50 -05:00
Samuel Cochran
23c869afee Cater to download strategies not yielding a file
Closes Homebrew/homebrew#22580.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-09-16 14:32:40 -05:00
Jack Nagel
7804d2d5f3 Remove unused attr 2013-09-13 22:43:07 -05:00
Adam Vandenberg
d4cf3ef212 Implement Resources
Closes Homebrew/homebrew#20212.
2013-09-11 22:05:26 -07:00