Method: VMC::Cli::FileHelper#check_unreachable_links

Defined in:
lib/cli/file_helper.rb


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/cli/file_helper.rb', line 91

def check_unreachable_links(path,files)
  pwd = Pathname.new(path)
  abspath = pwd.realpath.to_s
  unreachable = []
  files.each do |f|
    file = Pathname.new(f)
    if file.symlink? && !file.realpath.to_s.start_with?(abspath)
      unreachable << file.relative_path_from(pwd).to_s
    end
  end

  unless unreachable.empty?
    root = pwd.relative_path_from(pwd).to_s
    err "Can't deploy application containing links '#{unreachable.join(",")}' that reach outside its root '#{root}'"
  end
end