net-ftp-list 3.2.1 → 3.2.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/VERSION.yml +1 -1
- data/lib/net/ftp/list/unix.rb +4 -1
- data/net-ftp-list.gemspec +1 -1
- data/test/test_net_ftp_list_rumpus.rb +1 -1
- data/test/test_net_ftp_list_unix.rb +21 -19
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/net/ftp/list/unix.rb
CHANGED
@@ -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]}"
|
data/net-ftp-list.gemspec
CHANGED
@@ -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
|
-
|
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
|
7
|
-
@file = Net::FTP::List.parse
|
8
|
-
@other_dir = Net::FTP::List.parse
|
9
|
-
@spaces = Net::FTP::List.parse
|
10
|
-
@symlink = Net::FTP::List.parse
|
11
|
-
@older_date = Net::FTP::List.parse
|
12
|
-
@block_dev = Net::FTP::List.parse
|
13
|
-
@char_dev = Net::FTP::List.parse
|
14
|
-
@socket_dev = Net::FTP::List.parse
|
15
|
-
@pipe_dev = Net::FTP::List.parse
|
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,
|
20
|
-
assert_equal "Unix", @file.server_type,
|
21
|
-
assert_equal "Unix", @other_dir.server_type,
|
22
|
-
assert_equal "Unix", @spaces.server_type,
|
23
|
-
assert_equal "Unix", @symlink.server_type,
|
24
|
-
assert_equal "Unix", @block_dev.server_type,
|
25
|
-
assert_equal "Unix", @char_dev.server_type,
|
26
|
-
assert_equal "Unix", @socket_dev.server_type,
|
27
|
-
assert_equal "Unix", @pipe_dev.server_type,
|
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
|