netrc 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.txt +12 -0
- data/data/newlineless.netrc +4 -0
- data/lib/netrc.rb +9 -2
- data/test/test_netrc.rb +15 -0
- metadata +4 -3
data/changelog.txt
CHANGED
data/lib/netrc.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
|
3
3
|
class Netrc
|
4
|
-
VERSION = "0.7.
|
4
|
+
VERSION = "0.7.7"
|
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/
|
@@ -181,7 +181,14 @@ class Netrc
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def unparse
|
184
|
-
@pre + @data.map
|
184
|
+
@pre + @data.map do |datum|
|
185
|
+
datum = datum.join
|
186
|
+
unless datum[-1..-1] == "\n"
|
187
|
+
datum << "\n"
|
188
|
+
else
|
189
|
+
datum
|
190
|
+
end
|
191
|
+
end.join
|
185
192
|
end
|
186
193
|
|
187
194
|
end
|
data/test/test_netrc.rb
CHANGED
@@ -114,6 +114,21 @@ class TestNetrc < Test::Unit::TestCase
|
|
114
114
|
assert_equal(exp, n.unparse)
|
115
115
|
end
|
116
116
|
|
117
|
+
def test_add_newlineless
|
118
|
+
n = Netrc.read("data/newlineless.netrc")
|
119
|
+
n.new_item_prefix = "# added\n"
|
120
|
+
n["x"] = "a", "b"
|
121
|
+
exp = "# this is my netrc\n"+
|
122
|
+
"machine m\n"+
|
123
|
+
" login l # this is my username\n"+
|
124
|
+
" password p\n"+
|
125
|
+
"# added\n"+
|
126
|
+
"machine x\n"+
|
127
|
+
" login a\n"+
|
128
|
+
" password b\n"
|
129
|
+
assert_equal(exp, n.unparse)
|
130
|
+
end
|
131
|
+
|
117
132
|
def test_add_get
|
118
133
|
n = Netrc.read("data/sample.netrc")
|
119
134
|
n.new_item_prefix = "# added\n"
|
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.7.
|
4
|
+
version: 0.7.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-08-15 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: turn
|
17
|
-
requirement: &
|
17
|
+
requirement: &70180390635460 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70180390635460
|
26
26
|
description: This library can read and update netrc files, preserving formatting including
|
27
27
|
comments and whitespace.
|
28
28
|
email: geemus@gmail.com
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- Readme.md
|
35
35
|
- changelog.txt
|
36
36
|
- data/login.netrc
|
37
|
+
- data/newlineless.netrc
|
37
38
|
- data/password.netrc
|
38
39
|
- data/permissive.netrc
|
39
40
|
- data/sample.netrc
|