net-ftp-list 3.3.0 → 3.4.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.gitignore +2 -0
- data/Rakefile +1 -4
- data/lib/net/ftp/list/entry.rb +1 -1
- data/lib/net/ftp/list/unix.rb +1 -2
- data/net-ftp-list.gemspec +5 -2
- data/test/test_net_ftp_list_unix.rb +48 -21
- metadata +32 -10
- data/.rubocop.yml +0 -17
- data/Gemfile.lock +0 -59
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7055fe548d1984de166f451dfb2aa7240c8606a04c3f06b149a6b3892573027
|
|
4
|
+
data.tar.gz: 67ac2d02694ca97a6ab76da05b0dc75f3b06bbadd11b28c8ca82b4dd0f4053e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eda43bbfa999e5d4f1c163f842e1a87cd0fa787fd6c7b241683ad9bacf8e2d71c645a8b20ff63d96714d9edd986cd4a00da8966463646874e2aaeccc6fc2719a
|
|
7
|
+
data.tar.gz: 6f16a6ca4991c274356c6ff4899be14cea0ab7009960f8de6c99f0ea8696c79466bcad1963aa8a6c8c08dd1edc0ce5ce8a6b33edf5c5bbef26cd9d57244a6e49
|
data/.github/workflows/test.yml
CHANGED
data/.gitignore
CHANGED
data/Rakefile
CHANGED
|
@@ -2,7 +2,6 @@ require 'bundler/setup'
|
|
|
2
2
|
require 'bundler/gem_tasks'
|
|
3
3
|
require 'rake/testtask'
|
|
4
4
|
require 'rdoc/task'
|
|
5
|
-
require 'rubocop/rake_task'
|
|
6
5
|
|
|
7
6
|
Rake::TestTask.new(:test) do |test|
|
|
8
7
|
test.libs << 'lib' << 'test'
|
|
@@ -17,6 +16,4 @@ Rake::RDocTask.new do |rdoc|
|
|
|
17
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
task default: %i[rubocop test]
|
|
19
|
+
task default: %i[test]
|
data/lib/net/ftp/list/entry.rb
CHANGED
|
@@ -17,7 +17,7 @@ class Net::FTP::List::Entry
|
|
|
17
17
|
filesize: nil,
|
|
18
18
|
server_type: nil,
|
|
19
19
|
symlink_destination: nil) #:nodoc:
|
|
20
|
-
@raw = raw_ls_line.respond_to?(:force_encoding) ? raw_ls_line.force_encoding('utf-8') : raw_ls_line
|
|
20
|
+
@raw = raw_ls_line.respond_to?(:force_encoding) ? raw_ls_line.dup.force_encoding('utf-8') : raw_ls_line
|
|
21
21
|
@basename = basename || ''
|
|
22
22
|
@type = type
|
|
23
23
|
@mtime = mtime || Time.now
|
data/lib/net/ftp/list/unix.rb
CHANGED
|
@@ -14,8 +14,7 @@ class Net::FTP::List::Unix < Net::FTP::List::Parser
|
|
|
14
14
|
([pbcdlfmSs-])
|
|
15
15
|
(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\+?\s+
|
|
16
16
|
(?:(\d+)\s+)?
|
|
17
|
-
(\S+)?\s+
|
|
18
|
-
(?:(\S+(?:\s\S+)*)\s+)?
|
|
17
|
+
(\S+)?\s+(\S+)?\s+
|
|
19
18
|
(?:\d+,\s+)?
|
|
20
19
|
(\d+)\s+
|
|
21
20
|
((?:\d+[-/]\d+[-/]\d+)|(?:\S+\s+\S+))\s+
|
data/net-ftp-list.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'net-ftp-list'
|
|
3
|
-
s.version = '3.
|
|
3
|
+
s.version = '3.4.1'
|
|
4
4
|
s.authors = ['Stateless Systems']
|
|
5
5
|
s.email = 'enquiries@statelesssystems.com'
|
|
6
6
|
s.summary = 'Parse FTP LIST command output.'
|
|
@@ -12,8 +12,11 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.require_paths = ['lib']
|
|
13
13
|
s.required_ruby_version = '>= 2.5'
|
|
14
14
|
|
|
15
|
+
s.add_dependency 'net-ftp'
|
|
16
|
+
|
|
17
|
+
s.add_development_dependency 'bigdecimal'
|
|
15
18
|
s.add_development_dependency 'rake'
|
|
16
|
-
s.add_development_dependency '
|
|
19
|
+
s.add_development_dependency 'rdoc'
|
|
17
20
|
s.add_development_dependency 'test-unit'
|
|
18
21
|
s.add_development_dependency 'timecop'
|
|
19
22
|
end
|
|
@@ -3,21 +3,26 @@ require 'net/ftp/list'
|
|
|
3
3
|
require 'timecop'
|
|
4
4
|
|
|
5
5
|
class TestNetFTPListUnix < Test::Unit::TestCase
|
|
6
|
+
def parse(*args, **opts)
|
|
7
|
+
Net::FTP::List.parse(*args, **opts)
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
def setup
|
|
7
|
-
@dir =
|
|
8
|
-
@file =
|
|
9
|
-
@other_dir =
|
|
10
|
-
@spaces =
|
|
11
|
-
@symlink =
|
|
12
|
-
@empty_symlink =
|
|
13
|
-
@
|
|
14
|
-
@
|
|
15
|
-
@
|
|
16
|
-
@
|
|
17
|
-
@
|
|
18
|
-
@
|
|
19
|
-
@
|
|
20
|
-
@
|
|
11
|
+
@dir = parse('drwxr-xr-x 4 user group 4096 Jan 1 00:00 etc')
|
|
12
|
+
@file = parse('-rw-r--r-- 1 root other 531 Dec 31 23:59 README')
|
|
13
|
+
@other_dir = parse('drwxr-xr-x 8 1791 600 4096 Mar 11 07:57 forums')
|
|
14
|
+
@spaces = parse('drwxrwxr-x 2 danial danial 72 May 23 12:52 spaces suck')
|
|
15
|
+
@symlink = parse('lrwxrwxrwx 1 danial danial 4 Oct 30 15:26 bar -> /etc')
|
|
16
|
+
@empty_symlink = parse('lrwxrwxrwx 1 danial danial 4 Oct 30 15:26 foo')
|
|
17
|
+
@block_dev = parse('brw-r----- 1 root disk 1, 0 Apr 13 2006 ram0', timezone: :local)
|
|
18
|
+
@char_dev = parse('crw-rw-rw- 1 root root 1, 3 Apr 13 2006 null')
|
|
19
|
+
@socket_dev = parse('srw-rw-rw- 1 root root 0 Aug 20 14:15 log')
|
|
20
|
+
@pipe_dev = parse('prw-r----- 1 root adm 0 Nov 22 10:30 xconsole')
|
|
21
|
+
@file_no_inodes = parse('-rw-r--r-- foo@utchost foo@utchost 6034 May 14 23:13 index.html')
|
|
22
|
+
@file_today = parse('crw-rw-rw- 1 root root 1, 3 Aug 16 14:28 today.txt')
|
|
23
|
+
@no_user = parse('-rw-rw---- 2786 Jul 7 01:57 README')
|
|
24
|
+
@older_date = parse('-rwxrwxrwx 1 owner group 154112 Feb 15 2008 participando.xls')
|
|
25
|
+
@file_with_date = parse('-rw-r--r-- 1 tig tig 39757835 Jan 26 2014 PSA 23 99 May-2010.pdf')
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
def test_parse_new
|
|
@@ -32,50 +37,72 @@ class TestNetFTPListUnix < Test::Unit::TestCase
|
|
|
32
37
|
assert_equal 'Unix', @socket_dev.server_type, 'LIST unix socket device'
|
|
33
38
|
assert_equal 'Unix', @pipe_dev.server_type, 'LIST unix socket device'
|
|
34
39
|
assert_equal 'Unix', @file_no_inodes.server_type, 'LIST unixish file with no inodes'
|
|
40
|
+
assert_equal 'Unix', @file_today.server_type, 'LIST unixish file'
|
|
35
41
|
assert_equal 'Unix', @no_user.server_type, 'LIST unixish file with no user/group'
|
|
42
|
+
assert_equal 'Unix', @older_date.server_type, 'LIST unixish file with older date'
|
|
43
|
+
assert_equal 'Unix', @file_with_date.server_type, 'LIST unix with file containing a date'
|
|
36
44
|
end
|
|
37
45
|
|
|
38
46
|
# mtimes in the past, same year.
|
|
39
47
|
def test_ruby_unix_like_date_past_same_year
|
|
40
48
|
Timecop.freeze(Time.utc(2009, 1, 1)) do
|
|
41
|
-
assert_equal Time.utc(2009, 1, 1),
|
|
49
|
+
assert_equal Time.utc(2009, 1, 1), parse(@dir.raw).mtime
|
|
42
50
|
end
|
|
43
51
|
Timecop.freeze(Time.utc(2008, 4, 1)) do
|
|
44
|
-
assert_equal Time.utc(2008, 3, 11, 7, 57),
|
|
52
|
+
assert_equal Time.utc(2008, 3, 11, 7, 57), parse(@other_dir.raw).mtime
|
|
45
53
|
end
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
# mtimes in the past, previous year
|
|
49
57
|
def test_ruby_unix_like_date_past_previous_year
|
|
50
58
|
Timecop.freeze(Time.utc(2008, 2, 4)) do
|
|
51
|
-
assert_equal Time.utc(2007, 10, 30, 15, 26),
|
|
59
|
+
assert_equal Time.utc(2007, 10, 30, 15, 26), parse(@symlink.raw).mtime
|
|
52
60
|
end
|
|
53
61
|
end
|
|
54
62
|
|
|
55
63
|
# mtime in the future.
|
|
56
64
|
def test_ruby_unix_like_date_future
|
|
57
65
|
Timecop.freeze(Time.utc(2006, 3, 1)) do
|
|
58
|
-
assert_equal Time.utc(2006, 4, 13),
|
|
66
|
+
assert_equal Time.utc(2006, 4, 13), parse(@char_dev.raw).mtime
|
|
59
67
|
end
|
|
60
68
|
end
|
|
61
69
|
|
|
62
70
|
# Parsed during a leap year.
|
|
63
71
|
def test_ruby_unix_like_date_leap_year
|
|
64
72
|
Timecop.freeze(Time.utc(2012, 1, 2)) do
|
|
65
|
-
assert_equal Time.utc(2011, 10, 30, 15, 26),
|
|
73
|
+
assert_equal Time.utc(2011, 10, 30, 15, 26), parse(@symlink.raw).mtime
|
|
66
74
|
end
|
|
67
75
|
end
|
|
68
76
|
|
|
69
77
|
# mtimes today, same year.
|
|
70
78
|
def test_ruby_unix_like_date_today_same_year
|
|
71
79
|
Timecop.freeze(Time.utc(2013, 8, 16)) do
|
|
72
|
-
assert_equal Time.utc(2013, 8, 16, 14, 28),
|
|
80
|
+
assert_equal Time.utc(2013, 8, 16, 14, 28), parse(@file_today.raw).mtime
|
|
73
81
|
end
|
|
74
82
|
end
|
|
75
83
|
|
|
84
|
+
def test_basename
|
|
85
|
+
assert_equal 'etc', @dir.basename
|
|
86
|
+
assert_equal 'README', @file.basename
|
|
87
|
+
assert_equal 'forums', @other_dir.basename
|
|
88
|
+
assert_equal 'spaces suck', @spaces.basename
|
|
89
|
+
assert_equal 'bar', @symlink.basename
|
|
90
|
+
assert_equal 'foo', @empty_symlink.basename
|
|
91
|
+
assert_equal 'ram0', @block_dev.basename
|
|
92
|
+
assert_equal 'null', @char_dev.basename
|
|
93
|
+
assert_equal 'log', @socket_dev.basename
|
|
94
|
+
assert_equal 'xconsole', @pipe_dev.basename
|
|
95
|
+
assert_equal 'index.html', @file_no_inodes.basename
|
|
96
|
+
assert_equal 'today.txt', @file_today.basename
|
|
97
|
+
assert_equal 'README', @no_user.basename
|
|
98
|
+
assert_equal 'participando.xls', @older_date.basename
|
|
99
|
+
assert_equal 'PSA 23 99 May-2010.pdf', @file_with_date.basename
|
|
100
|
+
end
|
|
101
|
+
|
|
76
102
|
def test_mtime
|
|
77
103
|
assert_equal Time.utc(2008, 2, 15), @older_date.mtime
|
|
78
104
|
assert_equal Time.local(2006, 4, 13), @block_dev.mtime
|
|
105
|
+
assert_equal Time.utc(2014, 1, 26), @file_with_date.mtime
|
|
79
106
|
end
|
|
80
107
|
|
|
81
108
|
def test_ruby_unix_like_dir
|
|
@@ -141,7 +168,7 @@ class TestNetFTPListUnix < Test::Unit::TestCase
|
|
|
141
168
|
Timecop.freeze(Time.utc(2014, 8, 16)) do
|
|
142
169
|
single_digit_hour = nil
|
|
143
170
|
assert_nothing_raised do
|
|
144
|
-
single_digit_hour =
|
|
171
|
+
single_digit_hour = parse('-rw-r--r-- 1 root other 531 Dec 31 3:59 README')
|
|
145
172
|
end
|
|
146
173
|
|
|
147
174
|
assert_equal Time.utc(2013, 12, 31, 3, 59), single_digit_hour.mtime
|
metadata
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: net-ftp-list
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stateless Systems
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: net-ftp
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bigdecimal
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
13
40
|
- !ruby/object:Gem::Dependency
|
|
14
41
|
name: rake
|
|
15
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -25,7 +52,7 @@ dependencies:
|
|
|
25
52
|
- !ruby/object:Gem::Version
|
|
26
53
|
version: '0'
|
|
27
54
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
55
|
+
name: rdoc
|
|
29
56
|
requirement: !ruby/object:Gem::Requirement
|
|
30
57
|
requirements:
|
|
31
58
|
- - ">="
|
|
@@ -66,7 +93,6 @@ dependencies:
|
|
|
66
93
|
- - ">="
|
|
67
94
|
- !ruby/object:Gem::Version
|
|
68
95
|
version: '0'
|
|
69
|
-
description:
|
|
70
96
|
email: enquiries@statelesssystems.com
|
|
71
97
|
executables: []
|
|
72
98
|
extensions: []
|
|
@@ -74,9 +100,7 @@ extra_rdoc_files: []
|
|
|
74
100
|
files:
|
|
75
101
|
- ".github/workflows/test.yml"
|
|
76
102
|
- ".gitignore"
|
|
77
|
-
- ".rubocop.yml"
|
|
78
103
|
- Gemfile
|
|
79
|
-
- Gemfile.lock
|
|
80
104
|
- README.txt
|
|
81
105
|
- Rakefile
|
|
82
106
|
- lib/net/ftp/list.rb
|
|
@@ -98,7 +122,6 @@ homepage: http://github.com/stateless-systems/net-ftp-list
|
|
|
98
122
|
licenses:
|
|
99
123
|
- MIT
|
|
100
124
|
metadata: {}
|
|
101
|
-
post_install_message:
|
|
102
125
|
rdoc_options: []
|
|
103
126
|
require_paths:
|
|
104
127
|
- lib
|
|
@@ -113,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
113
136
|
- !ruby/object:Gem::Version
|
|
114
137
|
version: '0'
|
|
115
138
|
requirements: []
|
|
116
|
-
rubygems_version:
|
|
117
|
-
signing_key:
|
|
139
|
+
rubygems_version: 4.0.10
|
|
118
140
|
specification_version: 4
|
|
119
141
|
summary: Parse FTP LIST command output.
|
|
120
142
|
test_files:
|
data/.rubocop.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
inherit_gem:
|
|
2
|
-
rubocop-bsm:
|
|
3
|
-
- default.yml
|
|
4
|
-
inherit_mode:
|
|
5
|
-
merge:
|
|
6
|
-
- Exclude
|
|
7
|
-
|
|
8
|
-
AllCops:
|
|
9
|
-
TargetRubyVersion: "2.5"
|
|
10
|
-
|
|
11
|
-
Metrics/ParameterLists:
|
|
12
|
-
Exclude:
|
|
13
|
-
- lib/net/ftp/list/entry.rb
|
|
14
|
-
Metrics/MethodLength:
|
|
15
|
-
Exclude:
|
|
16
|
-
- lib/net/ftp/list/unix.rb
|
|
17
|
-
- test/**/*.rb
|
data/Gemfile.lock
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
net-ftp-list (3.3.0)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: https://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
ast (2.4.2)
|
|
10
|
-
parallel (1.20.1)
|
|
11
|
-
parser (3.0.1.1)
|
|
12
|
-
ast (~> 2.4.1)
|
|
13
|
-
power_assert (2.0.0)
|
|
14
|
-
rainbow (3.0.0)
|
|
15
|
-
rake (13.0.3)
|
|
16
|
-
regexp_parser (2.1.1)
|
|
17
|
-
rexml (3.2.5)
|
|
18
|
-
rubocop (1.15.0)
|
|
19
|
-
parallel (~> 1.10)
|
|
20
|
-
parser (>= 3.0.0.0)
|
|
21
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
22
|
-
regexp_parser (>= 1.8, < 3.0)
|
|
23
|
-
rexml
|
|
24
|
-
rubocop-ast (>= 1.5.0, < 2.0)
|
|
25
|
-
ruby-progressbar (~> 1.7)
|
|
26
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
|
27
|
-
rubocop-ast (1.6.0)
|
|
28
|
-
parser (>= 3.0.1.1)
|
|
29
|
-
rubocop-bsm (0.6.0)
|
|
30
|
-
rubocop (~> 1.0)
|
|
31
|
-
rubocop-performance
|
|
32
|
-
rubocop-rake
|
|
33
|
-
rubocop-rspec
|
|
34
|
-
rubocop-performance (1.11.3)
|
|
35
|
-
rubocop (>= 1.7.0, < 2.0)
|
|
36
|
-
rubocop-ast (>= 0.4.0)
|
|
37
|
-
rubocop-rake (0.5.1)
|
|
38
|
-
rubocop
|
|
39
|
-
rubocop-rspec (2.3.0)
|
|
40
|
-
rubocop (~> 1.0)
|
|
41
|
-
rubocop-ast (>= 1.1.0)
|
|
42
|
-
ruby-progressbar (1.11.0)
|
|
43
|
-
test-unit (3.4.1)
|
|
44
|
-
power_assert
|
|
45
|
-
timecop (0.9.4)
|
|
46
|
-
unicode-display_width (2.0.0)
|
|
47
|
-
|
|
48
|
-
PLATFORMS
|
|
49
|
-
ruby
|
|
50
|
-
|
|
51
|
-
DEPENDENCIES
|
|
52
|
-
net-ftp-list!
|
|
53
|
-
rake
|
|
54
|
-
rubocop-bsm
|
|
55
|
-
test-unit
|
|
56
|
-
timecop
|
|
57
|
-
|
|
58
|
-
BUNDLED WITH
|
|
59
|
-
2.2.14
|