netrc 0.1 → 0.2

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.
data/lib/netrc.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Netrc
2
- VERSION = "0.1"
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.write(path, unparse)
125
+ File.open(@path, 'w') {|file| file.print(unparse)}
125
126
  end
126
127
 
127
128
  def unparse
data/test/test_lex.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 TestLex < MiniTest::Unit::TestCase
7
7
  def test_lex_empty
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
@@ -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 TestParse < MiniTest::Unit::TestCase
7
7
  def test_parse_empty
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.1'
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-15 00:00:00.000000000Z
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.