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
|
# perhaps confusingly, this Pathname object becomes the symlink pointing to
|
||||||
# the src paramter.
|
# the src paramter.
|
||||||
def make_relative_symlink src
|
def make_relative_symlink src
|
||||||
self.dirname.mkpath
|
dirname.mkpath
|
||||||
Dir.chdir self.dirname do
|
|
||||||
|
dirname.cd do
|
||||||
# NOTE only system ln -s will create RELATIVE symlinks
|
# NOTE only system ln -s will create RELATIVE symlinks
|
||||||
quiet_system 'ln', '-s', src.relative_path_from(self.dirname), self.basename
|
return if quiet_system("ln", "-s", src.relative_path_from(dirname), basename)
|
||||||
if not $?.success?
|
end
|
||||||
|
|
||||||
if symlink? && exist?
|
if symlink? && exist?
|
||||||
raise <<-EOS.undent
|
raise <<-EOS.undent
|
||||||
Could not symlink file: #{src}
|
Could not symlink file: #{src}
|
||||||
@ -334,8 +336,6 @@ class Pathname
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def / that
|
def / that
|
||||||
join that.to_s
|
join that.to_s
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user