Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove implicit switch to encrypted file.

Too much magic can be annoying.
  • Loading branch information...
commit c25a2c0a712eb7282941a4f7756a02651e2bc37f 1 parent 637f302
@technomancy technomancy authored
Showing with 4 additions and 9 deletions.
  1. +3 −5 Readme.md
  2. +1 −4 lib/netrc.rb
View
8 Readme.md
@@ -9,11 +9,9 @@ Read a netrc file:
n = Netrc.read("sample.netrc")
-If the file doesn't exist, Netrc.read will return an empty object.
-
-If the filename ends in ".gpg", it will be decrypted using
-[GPG](http://www.gnupg.org/). If an encrypted version of the given
-netrc file is found and GPG is installed, it will be used instead.
+If the file doesn't exist, Netrc.read will return an empty object. If
+the filename ends in ".gpg", it will be decrypted using
+[GPG](http://www.gnupg.org/).
Read the user's default netrc file (`$HOME/.netrc` on Unix;
`%HOME%\_netrc` on Windows):
View
5 lib/netrc.rb
@@ -18,16 +18,13 @@ def self.check_permissions(path)
end
# Reads path and parses it as a .netrc file. If path doesn't
- # exist, returns an empty object. If a .gpg file exists for path,
- # decrypt that using gpg instead.
+ # exist, returns an empty object. Decrypt paths ending in .gpg.
def self.read(path=default_path)
check_permissions(path)
if path =~ /\.gpg$/
decrypted = `gpg --batch --quiet --decrypt #{path}`
raise Error.new("Decrypting #{path} failed.") unless $?.success?
new(path, parse(lex(decrypted.split("\n"))))
- elsif File.exists?(path + ".gpg") && system("which gpg > /dev/null")
- read(path + ".gpg")
else
new(path, parse(lex(File.readlines(path))))
end
Please sign in to comment.
Something went wrong with that request. Please try again.