aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2013-08-12 20:55:24 -0700
committerAdam Vandenberg2013-08-13 20:41:08 -0700
commit7c1671667f23e98b301647a2ad0e2d29b7da01e9 (patch)
tree0840010ceec8ddfd848fc3ffa4eacc4dda421db0 /Library
parentb730a85e3a327040ae4a8d8f6dcee9335573c100 (diff)
downloadbrew-7c1671667f23e98b301647a2ad0e2d29b7da01e9.tar.bz2
pathname: remove unused return values
Return value was used only by one test, rewrote test to know expected value.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/pathname.rb32
-rw-r--r--Library/Homebrew/test/test_pathname.rb16
2 files changed, 12 insertions, 36 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index fedb30ef8..60e55278c 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -8,36 +8,32 @@ class Pathname
BOTTLE_EXTNAME_RX = /(\.[a-z_]+(32)?\.bottle\.(\d+\.)?tar\.gz)$/
def install *sources
- results = []
sources.each do |src|
case src
when Array
if src.empty?
opoo "tried to install empty array to #{self}"
- return []
+ return
end
- src.each {|s| results << install_p(s) }
+ src.each {|s| install_p(s) }
when Hash
if src.empty?
opoo "tried to install empty hash to #{self}"
- return []
+ return
end
- src.each {|s, new_basename| results << install_p(s, new_basename) }
+ src.each {|s, new_basename| install_p(s, new_basename) }
else
- results << install_p(src)
+ install_p(src)
end
end
- return results
end
def install_p src, new_basename = nil
if new_basename
new_basename = File.basename(new_basename) # rationale: see Pathname.+
dst = self+new_basename
- return_value = Pathname.new(dst)
else
dst = self
- return_value = self+File.basename(src)
end
src = src.to_s
@@ -59,25 +55,21 @@ class Pathname
# this function when installing from the temporary build directory
FileUtils.mv src, dst
end
-
- return return_value
end
protected :install_p
# Creates symlinks to sources in this folder.
def install_symlink *sources
- results = []
sources.each do |src|
case src
when Array
- src.each {|s| results << install_symlink_p(s) }
+ src.each {|s| install_symlink_p(s) }
when Hash
- src.each {|s, new_basename| results << install_symlink_p(s, new_basename) }
+ src.each {|s, new_basename| install_symlink_p(s, new_basename) }
else
- results << install_symlink_p(src)
+ install_symlink_p(src)
end
end
- return results
end
def install_symlink_p src, new_basename = nil
@@ -86,14 +78,8 @@ class Pathname
else
dst = self+File.basename(new_basename)
end
-
- src = src.to_s
- dst = dst.to_s
-
mkpath
- FileUtils.ln_s src, dst
-
- return dst
+ FileUtils.ln_s src.to_s, dst.to_s
end
protected :install_symlink_p
diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb
index 4a9a0b0e3..37b85a07d 100644
--- a/Library/Homebrew/test/test_pathname.rb
+++ b/Library/Homebrew/test/test_pathname.rb
@@ -95,14 +95,11 @@ class PathnameExtensionTests < Test::Unit::TestCase
end
def test_install_removes_original
- orig_file = @file
touch @file
+ @dst.install(@file)
- @file, _ = @dst.install(@file)
-
- assert_equal orig_file.basename, @file.basename
- assert @file.exist?
- assert !orig_file.exist?
+ assert (@dst/@file.basename).exist?
+ assert !@file.exist?
end
def setup_install_test
@@ -200,13 +197,6 @@ class PathnameExtensionTests < Test::Unit::TestCase
end
end
- def test_install_returns_installed_paths
- foo, bar = @src+'foo', @src+'bar'
- touch [foo, bar]
- dirs = @dst.install(foo, bar)
- assert_equal [@dst+'foo', @dst+'bar'], dirs
- end
-
def test_install_creates_intermediate_directories
touch @file
assert !@dir.directory?