netrc 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/netrc.rb +4 -3
- data/test/test_lex.rb +1 -1
- data/test/test_netrc.rb +7 -1
- data/test/test_parse.rb +1 -1
- metadata +2 -2
data/lib/netrc.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Netrc
|
2
|
-
VERSION = "0.
|
2
|
+
VERSION = "0.2"
|
3
|
+
Windows = (RUBY_PLATFORM =~ /win32|mingw32/i)
|
3
4
|
|
4
|
-
Windows = false
|
5
5
|
def self.default_path
|
6
6
|
File.join(ENV["HOME"], default_name)
|
7
7
|
end
|
@@ -87,6 +87,7 @@ class Netrc
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def initialize(path, data)
|
90
|
+
@new_item_prefix = ''
|
90
91
|
@path = path
|
91
92
|
@pre, @data = data
|
92
93
|
end
|
@@ -121,7 +122,7 @@ class Netrc
|
|
121
122
|
end
|
122
123
|
|
123
124
|
def save
|
124
|
-
File.
|
125
|
+
File.open(@path, 'w') {|file| file.print(unparse)}
|
125
126
|
end
|
126
127
|
|
127
128
|
def unparse
|
data/test/test_lex.rb
CHANGED
data/test/test_netrc.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
$VERBOSE = true
|
2
2
|
require 'minitest/autorun'
|
3
3
|
|
4
|
-
require 'netrc'
|
4
|
+
require '../netrc/lib/netrc'
|
5
5
|
|
6
6
|
class TestNetrc < MiniTest::Unit::TestCase
|
7
7
|
def setup
|
@@ -87,4 +87,10 @@ class TestNetrc < MiniTest::Unit::TestCase
|
|
87
87
|
n = Netrc.read("data/sample.netrc")
|
88
88
|
assert_equal(nil, n["x"])
|
89
89
|
end
|
90
|
+
|
91
|
+
def test_save
|
92
|
+
n = Netrc.read("data/sample.netrc")
|
93
|
+
n.save
|
94
|
+
assert_equal(File.read("data/sample.netrc"), n.unparse)
|
95
|
+
end
|
90
96
|
end
|
data/test/test_parse.rb
CHANGED
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.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-16 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: This library can read and update netrc files, preserving formatting including
|
15
15
|
comments and whitespace.
|