netrc 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ 0.7.7 08/15/12
2
+ ==============
3
+
4
+ add newline between entries if one is missing
5
+
6
+ 0.7.6 08/15/12
7
+ ==============
8
+
9
+ more unified newline handling
10
+ make entries with login/password parsable
11
+
12
+
1
13
  0.7.5 06/25/12
2
14
  ==============
3
15
 
@@ -0,0 +1,4 @@
1
+ # this is my netrc
2
+ machine m
3
+ login l # this is my username
4
+ password p
@@ -1,7 +1,7 @@
1
1
  require 'rbconfig'
2
2
 
3
3
  class Netrc
4
- VERSION = "0.7.6"
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(&:join).join
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
@@ -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.6
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: &70245365255400 !ruby/object:Gem::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: *70245365255400
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