…t jruby permgen leak #37
When ``Dir.home`` is not readable ``Netrc.read`` throws an exception [at least on linux]. There was an failed attempt to fix this issue in the past [``File.stat.readable?`` could also throw] but at some point an early return has been added that returned the content of ``Dir.home`` when that was defined, completely skipping the path validation. The new code always checks that the path is readable [according to ``File.readable?``] before returning it [linux only]. Lastly, ``"./"`` has been replaced by ``Dir.pwd``, which should produce the same result.
This reverts commit 9dde3cc.
This reverts commit e6939fd. Conflicts: lib/netrc.rb
This makes it possible to read login and password like this: ```ruby netrc = Netrc.read entry = netrc['machine'] login = entry.login pass = entry.password ``` Through the use of a lightly-tweaked Struct, the Entry object behaves almost identically to the old arrays, including including implicit splatting when it is on the right side of an assignment: ```ruby netrc = Netrc.read entry = netrc['machine'] login, pass = entry ```
This reverts commit 9838ecf.
We have to use String#split rather than File.readlines in the decryption path, so we should use it in the encrypted path too. File.readlines keeps the \n chars in the strings, so we have to explicitly break up the tokens list after line if we use split.