Return early so we can reduce nesting of conditionals
This commit is contained in:
parent
ed0be26c77
commit
4e918666d7
@ -291,11 +291,13 @@ class Pathname
|
||||
# perhaps confusingly, this Pathname object becomes the symlink pointing to
|
||||
# the src paramter.
|
||||
def make_relative_symlink src
|
||||
self.dirname.mkpath
|
||||
Dir.chdir self.dirname do
|
||||
dirname.mkpath
|
||||
|
||||
dirname.cd do
|
||||
# NOTE only system ln -s will create RELATIVE symlinks
|
||||
quiet_system 'ln', '-s', src.relative_path_from(self.dirname), self.basename
|
||||
if not $?.success?
|
||||
return if quiet_system("ln", "-s", src.relative_path_from(dirname), basename)
|
||||
end
|
||||
|
||||
if symlink? && exist?
|
||||
raise <<-EOS.undent
|
||||
Could not symlink file: #{src}
|
||||
@ -334,8 +336,6 @@ class Pathname
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def / that
|
||||
join that.to_s
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user