ftpro 0.0.1 → 0.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.
- checksums.yaml +4 -4
- data/README.md +0 -4
- data/ftpro.gemspec +3 -3
- data/lib/ftpro.rb +10 -4
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 200829bd1279a029c8d7b83f4bf95a90030d2705
|
|
4
|
+
data.tar.gz: 4e0f310bfaed38f4c3d02181f1a8324599b29252
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4083090043db008756ad912025c8fc30765808bdcd70e19463d293c6dfbace8578061b5ab53e23061e0790486e0a26da17088b713cc8d08f360ca7b0462db268
|
|
7
|
+
data.tar.gz: bd67d60935b2b7e0439786736942313bee3975b54ece52c409f160b7d473376559216e385de00bb47b101b8baf7715974c22159bfc75dd0128c5114324823c9e
|
data/README.md
CHANGED
data/ftpro.gemspec
CHANGED
|
@@ -4,11 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "ftpro"
|
|
7
|
-
spec.version = '0.0.
|
|
7
|
+
spec.version = '0.0.2'
|
|
8
8
|
spec.authors = ["dddd1919"]
|
|
9
9
|
spec.email = ["dingrank@gmail.com"]
|
|
10
|
-
spec.summary = %q{
|
|
11
|
-
spec.description = %q{
|
|
10
|
+
spec.summary = %q{The enhanced version of net/ftp}
|
|
11
|
+
spec.description = %q{Provide all net/ftp method and some additional functionality}
|
|
12
12
|
spec.homepage = "https://github.com/dddd1919/ftpro"
|
|
13
13
|
spec.license = "MIT"
|
|
14
14
|
|
data/lib/ftpro.rb
CHANGED
|
@@ -4,20 +4,24 @@ class Ftpro < Net::FTP
|
|
|
4
4
|
|
|
5
5
|
## Net::FTP extension
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
## Function like nlst and also show hide files
|
|
8
|
+
def nlst_a(dir = nil)
|
|
9
9
|
cmd = "NLST -a"
|
|
10
|
+
rule_out1, rule_out2 =
|
|
11
|
+
dir.nil? ? [".", ".."] : ["/.", "/.."]
|
|
10
12
|
if dir
|
|
11
13
|
cmd = cmd + " " + dir
|
|
12
14
|
end
|
|
13
15
|
files = []
|
|
14
16
|
retrlines(cmd) do |line|
|
|
15
|
-
files.push(line) if !line.end_with?(
|
|
17
|
+
files.push(line) if !line.end_with?(rule_out1, rule_out2)
|
|
16
18
|
end
|
|
17
19
|
return files
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
## File function mirror
|
|
23
|
+
|
|
24
|
+
## Check if dir is a directory type
|
|
21
25
|
def directory?(dir)
|
|
22
26
|
current_dir = pwd
|
|
23
27
|
begin
|
|
@@ -30,10 +34,12 @@ class Ftpro < Net::FTP
|
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
|
|
37
|
+
## Check if file_path is a file type
|
|
33
38
|
def file?(file_path)
|
|
34
39
|
nlst(file_path)[0] == file_path
|
|
35
40
|
end
|
|
36
41
|
|
|
42
|
+
## Check if dir exist
|
|
37
43
|
def exist?(dir)
|
|
38
44
|
return true if !nlst(dir).empty? ## File or not empty directory
|
|
39
45
|
## Check if a empty directory
|
|
@@ -50,8 +56,8 @@ class Ftpro < Net::FTP
|
|
|
50
56
|
return new_dir if exist?(new_dir)
|
|
51
57
|
end
|
|
52
58
|
|
|
59
|
+
## Upload local directory to ftp server with local directory name
|
|
53
60
|
def put_r(local_dir, remote_dir)
|
|
54
|
-
## Upload local directory to ftp server with local directory name
|
|
55
61
|
return false if !File.directory?(local_dir)
|
|
56
62
|
upload_dir(local_dir, remote_dir)
|
|
57
63
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ftpro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dddd1919
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-12-
|
|
11
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
-
description:
|
|
55
|
+
description: Provide all net/ftp method and some additional functionality
|
|
56
56
|
email:
|
|
57
57
|
- dingrank@gmail.com
|
|
58
58
|
executables: []
|
|
@@ -91,7 +91,7 @@ rubyforge_project:
|
|
|
91
91
|
rubygems_version: 2.2.2
|
|
92
92
|
signing_key:
|
|
93
93
|
specification_version: 4
|
|
94
|
-
summary:
|
|
94
|
+
summary: The enhanced version of net/ftp
|
|
95
95
|
test_files:
|
|
96
96
|
- spec/ftpro_spec.rb
|
|
97
97
|
- spec/spec_helper.rb
|