netrc 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/changelog.txt +5 -0
- data/lib/netrc.rb +12 -4
- data/test/test_netrc.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abc7dade0f83a2542764f27110f02c194a8f21eb
|
4
|
+
data.tar.gz: a0a9842ed83ed5aa376e633853444da708877972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ec0bc4855e159e33090e53bc212cfa164b58a88d34a967b247b347c5f0b9a3d7d21ddf97883f6d71fd63d08cc5e5587800557a0567ffdb353a048c1f5bc02bf
|
7
|
+
data.tar.gz: f1d5642f7afa850e782b0b822a5e25d1828abc901b108a5a74bd884642cdee68c068676e59c40064ea465c6504a30c48078991a53ec8c012528415aa7a56659e
|
data/changelog.txt
CHANGED
data/lib/netrc.rb
CHANGED
@@ -1,26 +1,34 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
|
3
3
|
class Netrc
|
4
|
-
VERSION = "0.
|
4
|
+
VERSION = "0.10.0"
|
5
5
|
|
6
6
|
# see http://stackoverflow.com/questions/4871309/what-is-the-correct-way-to-detect-if-ruby-is-running-on-windows
|
7
7
|
WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/
|
8
8
|
CYGWIN = RbConfig::CONFIG["host_os"] =~ /cygwin/
|
9
9
|
|
10
10
|
def self.default_path
|
11
|
+
File.join(home_path, netrc_filename)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.home_path
|
15
|
+
return Dir.home if defined? Dir.home # Ruby 1.9+
|
11
16
|
if WINDOWS && !CYGWIN
|
12
17
|
home = ENV['HOME']
|
13
18
|
home ||= ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
|
14
19
|
home ||= ENV['USERPROFILE']
|
15
|
-
|
20
|
+
home.gsub("\\","/")
|
16
21
|
else
|
17
22
|
# In some cases, people run master process as "root" user, and run worker processes as "www" user.
|
18
23
|
# Fix "Permission denied" error in worker processes when $HOME is "/root".
|
19
|
-
|
20
|
-
File.join(default_dir, ".netrc")
|
24
|
+
(ENV['HOME'] && File.exist?(ENV['HOME']) && File.stat(ENV['HOME']).readable?) ? ENV['HOME'] : './'
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
28
|
+
def self.netrc_filename
|
29
|
+
WINDOWS && !CYGWIN ? "_netrc" : ".netrc"
|
30
|
+
end
|
31
|
+
|
24
32
|
def self.config
|
25
33
|
@config ||= {}
|
26
34
|
end
|
data/test/test_netrc.rb
CHANGED
@@ -187,15 +187,18 @@ class TestNetrc < Test::Unit::TestCase
|
|
187
187
|
n["m"] = "a", "b"
|
188
188
|
n.save
|
189
189
|
assert_equal(0600, File.stat("/tmp/test.netrc.gpg").mode & 0777)
|
190
|
-
|
190
|
+
netrc = Netrc.read("/tmp/test.netrc.gpg")["m"]
|
191
|
+
assert_equal("a", netrc.login)
|
192
|
+
assert_equal("b", netrc.password)
|
191
193
|
end
|
192
194
|
end
|
193
195
|
|
194
196
|
def test_missing_environment
|
195
197
|
nil_home = nil
|
196
198
|
ENV["HOME"], nil_home = nil_home, ENV["HOME"]
|
197
|
-
|
198
|
-
|
199
|
+
assert_raise_with_message ArgumentError, "couldn't find HOME environment -- expanding `~'" do
|
200
|
+
Netrc.read
|
201
|
+
end
|
199
202
|
ensure
|
200
203
|
ENV["HOME"], nil_home = nil_home, ENV["HOME"]
|
201
204
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netrc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Rarick
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: turn
|