lib/bundler.rb in bundler-1.16.3 vs lib/bundler.rb in bundler-1.16.4
- old
+ new
@@ -168,10 +168,11 @@
elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home))
"`#{home}` is not writable."
end
if warning
+ Kernel.send(:require, "etc")
user_home = tmp_home_path(Etc.getlogin, warning)
Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
user_home
else
Pathname.new(home)
@@ -407,11 +408,11 @@
end
end
def read_file(file)
SharedHelpers.filesystem_access(file, :read) do
- File.open(file, "rb", &:read)
+ File.open(file, "r:UTF-8", &:read)
end
end
def load_marshal(data)
Marshal.load(data)
@@ -428,10 +429,10 @@
@gemspec_cache[key].dup if @gemspec_cache[key]
end
def load_gemspec_uncached(file, validate = false)
path = Pathname.new(file)
- contents = File.open(file, "r:UTF-8", &:read)
+ contents = read_file(file)
spec = if contents.start_with?("---") # YAML header
eval_yaml_gemspec(path, contents)
else
# Eval the gemspec from its parent directory, because some gemspecs
# depend on "./" relative paths.