lib/autoproj/package_managers/bundler_manager.rb in autoproj-2.13.0 vs lib/autoproj/package_managers/bundler_manager.rb in autoproj-2.14.0
- old
+ new
@@ -121,16 +121,17 @@
update_env_rubylib(bundle_rubylib, system_rubylib)
end
end
def create_cache_symlink(cache_dir, bundler_cache_dir)
- valid = !File.exist?(bundler_cache_dir) ||
- File.symlink?(bundler_cache_dir)
-
- unless valid
- Autoproj.warn "cannot use #{cache_dir} as gem cache as "\
- "#{bundler_cache_dir} already exists"
- return
+ if File.exist?(bundler_cache_dir)
+ if !File.symlink?(bundler_cache_dir)
+ Autoproj.warn "cannot use #{cache_dir} as gem cache as "\
+ "#{bundler_cache_dir} already exists"
+ return
+ elsif File.readlink(bundler_cache_dir) == cache_dir
+ return
+ end
end
FileUtils.rm_f bundler_cache_dir
FileUtils.ln_s cache_dir, bundler_cache_dir
end