net-ftp-list 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 3
3
3
  :minor: 2
4
- :patch: 1
4
+ :patch: 2
5
5
  :build:
@@ -14,7 +14,7 @@ class Net::FTP::List::Unix < Net::FTP::List::Parser
14
14
  REGEXP = %r{
15
15
  ([pbcdlfmpSs-])
16
16
  (((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\+?\s+
17
- (\d+)\s+
17
+ (?:(\d+)\s+)?
18
18
  (\S+)\s+
19
19
  (?:(\S+(?:\s\S+)*)\s+)?
20
20
  (?:\d+,\s+)?
@@ -39,6 +39,9 @@ class Net::FTP::List::Unix < Net::FTP::List::Parser
39
39
  end
40
40
  return false unless dir or symlink or file or device
41
41
 
42
+ # Don't match on rumpus (which looks very similar to unix)
43
+ return false if match[17].nil? and ((match[15].nil? and match[16].to_s == 'folder') or match[15].to_s == '0')
44
+
42
45
  # TODO: Permissions, users, groups, date/time.
43
46
  filesize = match[18].to_i
44
47
  mtime_string = "#{match[19]} #{match[20]}"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{net-ftp-list}
8
- s.version = "3.2.1"
8
+ s.version = "3.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Stateless Systems"]
@@ -13,7 +13,7 @@ class TestNetFTPListRumpus < Test::Unit::TestCase
13
13
 
14
14
  ## TODO: this rumpus file is getting picked up as unix, which if you check
15
15
  ## how it looks above, it looks like unix to me, i dunno how to fix it.
16
- #assert_equal "Rumpus", @file.server_type, 'LIST Rumpus file with spaces'
16
+ assert_equal "Rumpus", @file.server_type, 'LIST Rumpus file with spaces'
17
17
  end
18
18
 
19
19
  def test_ruby_unix_like_date
@@ -3,28 +3,30 @@ require 'net/ftp/list'
3
3
 
4
4
  class TestNetFTPListUnix < Test::Unit::TestCase
5
5
  def setup
6
- @dir = Net::FTP::List.parse "drwxr-xr-x 4 user group 4096 Jan 1 00:00 etc" rescue nil
7
- @file = Net::FTP::List.parse "-rw-r--r-- 1 root other 531 Dec 31 23:59 README" rescue nil
8
- @other_dir = Net::FTP::List.parse "drwxr-xr-x 8 1791 600 4096 Mar 11 07:57 forums" rescue nil
9
- @spaces = Net::FTP::List.parse 'drwxrwxr-x 2 danial danial 72 May 23 12:52 spaces suck' rescue nil
10
- @symlink = Net::FTP::List.parse "lrwxrwxrwx 1 danial danial 4 Oct 30 15:26 bar -> /etc" rescue nil
11
- @older_date = Net::FTP::List.parse "-rwxrwxrwx 1 owner group 154112 Feb 15 2008 participando.xls" rescue nil
12
- @block_dev = Net::FTP::List.parse 'brw-r----- 1 root disk 1, 0 Apr 13 2006 ram0' rescue nil
13
- @char_dev = Net::FTP::List.parse 'crw-rw-rw- 1 root root 1, 3 Apr 13 2006 null' rescue nil
14
- @socket_dev = Net::FTP::List.parse 'srw-rw-rw- 1 root root 0 Aug 20 14:15 log' rescue nil
15
- @pipe_dev = Net::FTP::List.parse 'prw-r----- 1 root adm 0 Nov 22 10:30 xconsole' rescue nil
6
+ @dir = Net::FTP::List.parse "drwxr-xr-x 4 user group 4096 Jan 1 00:00 etc" rescue nil
7
+ @file = Net::FTP::List.parse "-rw-r--r-- 1 root other 531 Dec 31 23:59 README" rescue nil
8
+ @other_dir = Net::FTP::List.parse "drwxr-xr-x 8 1791 600 4096 Mar 11 07:57 forums" rescue nil
9
+ @spaces = Net::FTP::List.parse 'drwxrwxr-x 2 danial danial 72 May 23 12:52 spaces suck' rescue nil
10
+ @symlink = Net::FTP::List.parse "lrwxrwxrwx 1 danial danial 4 Oct 30 15:26 bar -> /etc" rescue nil
11
+ @older_date = Net::FTP::List.parse "-rwxrwxrwx 1 owner group 154112 Feb 15 2008 participando.xls" rescue nil
12
+ @block_dev = Net::FTP::List.parse 'brw-r----- 1 root disk 1, 0 Apr 13 2006 ram0' rescue nil
13
+ @char_dev = Net::FTP::List.parse 'crw-rw-rw- 1 root root 1, 3 Apr 13 2006 null' rescue nil
14
+ @socket_dev = Net::FTP::List.parse 'srw-rw-rw- 1 root root 0 Aug 20 14:15 log' rescue nil
15
+ @pipe_dev = Net::FTP::List.parse 'prw-r----- 1 root adm 0 Nov 22 10:30 xconsole' rescue nil
16
+ @file_no_inodes = Net::FTP::List.parse '-rw-r--r-- foo@localhost foo@localhost 6034 May 14 23:13 index.html' rescue nil
16
17
  end
17
18
 
18
19
  def test_parse_new
19
- assert_equal "Unix", @dir.server_type, 'LIST unixish directory'
20
- assert_equal "Unix", @file.server_type, 'LIST unixish file'
21
- assert_equal "Unix", @other_dir.server_type, 'LIST unixish directory'
22
- assert_equal "Unix", @spaces.server_type, 'LIST unixish directory with spaces'
23
- assert_equal "Unix", @symlink.server_type, 'LIST unixish symlink'
24
- assert_equal "Unix", @block_dev.server_type, 'LIST unix block device'
25
- assert_equal "Unix", @char_dev.server_type, 'LIST unix char device'
26
- assert_equal "Unix", @socket_dev.server_type, 'LIST unix socket device'
27
- assert_equal "Unix", @pipe_dev.server_type, 'LIST unix socket device'
20
+ assert_equal "Unix", @dir.server_type, 'LIST unixish directory'
21
+ assert_equal "Unix", @file.server_type, 'LIST unixish file'
22
+ assert_equal "Unix", @other_dir.server_type, 'LIST unixish directory'
23
+ assert_equal "Unix", @spaces.server_type, 'LIST unixish directory with spaces'
24
+ assert_equal "Unix", @symlink.server_type, 'LIST unixish symlink'
25
+ assert_equal "Unix", @block_dev.server_type, 'LIST unix block device'
26
+ assert_equal "Unix", @char_dev.server_type, 'LIST unix char device'
27
+ assert_equal "Unix", @socket_dev.server_type, 'LIST unix socket device'
28
+ assert_equal "Unix", @pipe_dev.server_type, 'LIST unix socket device'
29
+ assert_equal "Unix", @file_no_inodes.server_type, 'LIST unixish file with no inodes'
28
30
  end
29
31
 
30
32
  class ::Time
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 2
8
- - 1
9
- version: 3.2.1
8
+ - 2
9
+ version: 3.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stateless Systems