net-netrc 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/net/ftp-netrc.rb CHANGED
@@ -17,7 +17,7 @@
17
17
  # ftp.last_response
18
18
  # => 230 User myuser logged in.
19
19
  #
20
- # $Id: ftp-netrc.rb,v 1.1 2005/12/19 16:25:52 bshow Exp $
20
+ # $Id: ftp-netrc.rb 40 2005-12-19 16:53:01Z bshow $
21
21
 
22
22
  require 'net/ftp'
23
23
  require 'net/netrc'
@@ -40,7 +40,7 @@ module Net
40
40
  # connected.
41
41
  #
42
42
  # If +user+ is nil, Net::Netrc#locate is used to lookup login information
43
- # based on the host name supplied to Net::Netrc#connect.
43
+ # based on the host name supplied when the connection was established.
44
44
  #
45
45
  # If +user+ is the string "anonymous" and the +password+ is nil, a password
46
46
  # of user@host is synthesized. If the +acct+ parameter is not nil, an FTP
data/lib/net/netrc.rb CHANGED
@@ -1,13 +1,11 @@
1
1
  # = net/netrc.rb - ftp(1) .netrc parsing
2
2
  #
3
- # Copyright (c) 2005 Robert J. Showalter
3
+ # Copyright (c) 2005, 2008 Robert J. Showalter
4
4
  #
5
5
  # This library is distributed under the terms of the Ruby license.
6
6
  # You may freely distribute or modify this library.
7
7
  #
8
8
  # See Net::Netrc for usage.
9
- #
10
- # $Id: netrc.rb,v 1.3 2005/12/19 16:42:01 bshow Exp $
11
9
 
12
10
  require 'etc'
13
11
 
@@ -80,7 +78,7 @@ module Net
80
78
 
81
79
  VERSION_MAJOR = 0
82
80
  VERSION_MINOR = 2
83
- VERSION_PATCH = 0
81
+ VERSION_PATCH = 1
84
82
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}"
85
83
 
86
84
  # detect whether running on MS Windows platform
@@ -141,7 +139,7 @@ module Net
141
139
  end
142
140
 
143
141
  # return first found file
144
- dirs.flatten.each do |dir|
142
+ dirs.compact.each do |dir|
145
143
  files.each do |file|
146
144
  name = File.join(dir, file)
147
145
  return name if File.exist?(name)
data/test/test_netrc.rb CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: test_netrc.rb,v 1.1 2005/12/15 15:09:01 bshow Exp $
1
+ # $Id: test_netrc.rb 42 2008-03-03 13:59:16Z bshow $
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), "../lib")
4
4
 
@@ -7,10 +7,14 @@ require 'test/unit'
7
7
 
8
8
  class TestNetrc < Test::Unit::TestCase
9
9
 
10
- SAMPLE_NETRC = 'dot.netrc.test'
10
+ if Net::Netrc::IS_WIN32
11
+ SAMPLE_NETRC = File.join(File.dirname(__FILE__), '_netrc')
12
+ else
13
+ SAMPLE_NETRC = File.join(File.dirname(__FILE__), '.netrc')
14
+ end
11
15
 
12
16
  def setup
13
- @path = File.join(File.dirname(__FILE__), SAMPLE_NETRC)
17
+ @path = SAMPLE_NETRC
14
18
  File.open(@path, 'w') do |f|
15
19
  f << <<EOT
16
20
  machine example.com
@@ -93,4 +97,21 @@ EOT
93
97
 
94
98
  end
95
99
 
100
+ def test_rcname
101
+ assert_equal SAMPLE_NETRC, Net::Netrc.rcname
102
+ ENV.delete('NETRC')
103
+ home = Etc.getpwuid.dir rescue nil
104
+ if home && File.exists?(File.join(home, '.netrc'))
105
+ assert_equal File.join(home, '.netrc'), Net::Netrc.rcname
106
+ else
107
+ ENV['HOME'] = File.dirname(__FILE__)
108
+ assert_equal SAMPLE_NETRC, Net::Netrc.rcname
109
+ if Net::Netrc::IS_WIN32
110
+ ENV.delete('HOME')
111
+ ENV['USERPROFILE'] = File.dirname(__FILE__)
112
+ assert_equal SAMPLE_NETRC, Net::Netrc.rcname
113
+ end
114
+ end
115
+ end
116
+
96
117
  end
metadata CHANGED
@@ -1,53 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
3
- specification_version: 1
4
2
  name: net-netrc
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2005-12-19 00:00:00 -05:00
8
- summary: Net::Netrc provides ftp(1)-style .netrc parsing
9
- require_paths:
10
- - lib
11
- email: bshow@rubyforge.org
12
- homepage: http://net-netrc.rubyforge.org
13
- rubyforge_project:
14
- description:
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Bob Showalter
15
8
  autorequire: net/netrc
16
- default_executable:
17
9
  bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-03 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: Platform
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.3.0
23
+ version:
24
+ description:
25
+ email: bshow@rubyforge.org
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - lib/net
34
+ - lib/net/ftp-netrc.rb
35
+ - lib/net/netrc.rb
36
+ - test/test_netrc.rb
18
37
  has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
38
+ homepage: http://net-netrc.rubyforge.org
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
20
45
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
25
49
  version:
26
- platform: ruby
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.0.1
27
60
  signing_key:
28
- cert_chain:
29
- authors:
30
- - Bob Showalter
31
- files:
32
- - lib/net
33
- - lib/net/netrc.rb
34
- - lib/net/ftp-netrc.rb
35
- - test/test_netrc.rb
61
+ specification_version: 2
62
+ summary: Net::Netrc provides ftp(1)-style .netrc parsing
36
63
  test_files:
37
- - test/test_netrc.rb
38
- rdoc_options: []
39
- extra_rdoc_files: []
40
- executables: []
41
- extensions: []
42
- requirements: []
43
- dependencies:
44
- - !ruby/object:Gem::Dependency
45
- name: Platform
46
- version_requirement:
47
- version_requirements: !ruby/object:Gem::Version::Requirement
48
- requirements:
49
- -
50
- - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.3.0
53
- version:
64
+ - test/test_netrc.rb