diff options
| author | Jack Nagel | 2014-07-10 21:26:54 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-10 22:00:43 -0500 |
| commit | f32782a544b25ecc75c4ba616a87ae0272562404 (patch) | |
| tree | ba4cae679be3bfb93109d922b81d1c65427dfc22 | |
| parent | c050aa2674ff4eb2ff161214cf4687083ce13294 (diff) | |
| download | homebrew-f32782a544b25ecc75c4ba616a87ae0272562404.tar.bz2 | |
Raise Errno::ENOENT instead of RuntimeError from Pathname#install
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_pathname.rb | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index fdf5395c9..78c27bf3f 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -35,6 +35,8 @@ class Pathname end def install_p src, new_basename = nil + raise Errno::ENOENT, src.to_s unless File.symlink?(src) || File.exist?(src) + if new_basename new_basename = File.basename(new_basename) # rationale: see Pathname.+ dst = self+new_basename @@ -45,8 +47,6 @@ class Pathname src = src.to_s dst = dst.to_s - raise "#{src} does not exist" unless File.symlink? src or File.exist? src - dst = yield(src, dst) if block_given? mkpath diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb index adf4b2238..a20f36c75 100644 --- a/Library/Homebrew/test/test_pathname.rb +++ b/Library/Homebrew/test/test_pathname.rb @@ -83,9 +83,7 @@ class PathnameExtensionTests < Homebrew::TestCase end def test_install_missing_file - assert_raises(RuntimeError) do - @dst.install 'non_existent_file' - end + assert_raises(Errno::ENOENT) { @dst.install "non_existent_file" } end def test_install_removes_original |
