niftp 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.gitignore +2 -1
- data/.travis.yml +1 -1
- data/README.md +18 -5
- data/lib/niftp.rb +15 -3
- data/lib/niftp/version.rb +1 -1
- data/niftp.gemspec +1 -3
- data/test/niftp_test.rb +3 -3
- metadata +23 -52
- data/Guardfile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDE1MTZiZWMyOGJlZGFmNjhiOTA5YzQwOThiZTQxYzNlMmY5YTE5Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTcxYzEyNjZhMjJkYjVjMDkxMDQyYmUzNGI5YWE1ZTAxNTVmOGI2Zg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2NhNDdiZDBjMGUxZTE5MWJhOTJlZmI1NzczOWIwMmNjZTkzNjlhMDEyM2Yz
|
10
|
+
MTY5ZjlhYzFjNjZkZDhlYWJkNjMzOWIxN2E5ODI0Zjg1MWUwNTMxZGJlNzM5
|
11
|
+
YWYzYTM3NzY2OWE4MGU4NTAxM2E5ODUzMjQ0ZWRjZjdhMGQ5NjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGFiMTM4ZmMxYjgyMmVjNzc0YmJhMTk2Zjc1Y2ViYTExMmU5ZDljOTA4YWM5
|
14
|
+
MzFlMWU2ZGJlMzVkMGJkZWM4NTUwYmI1NTU0NjgyZTIwN2VmYmY2NDJhZjNk
|
15
|
+
OTAxZTRiZjQ4ZmE4MjgxY2I5ZWQxMjQyNTY4OWQ5MjRlZDk3NDA=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
NiFTP
|
1
|
+
## NiFTP
|
2
|
+
Only supports Ruby 2.0.0+
|
3
|
+
A Ruby gem, makes Ruby's decidedly un-nifty Net::FTP library easier to
|
2
4
|
use. It abstracts away the FTP plumbing, such as establishing and closing
|
3
5
|
connections. Options include retrying your commands on flakey FTP servers, and
|
4
6
|
forced timeouts. FTP Secure (FTPS) is also supported.
|
@@ -25,10 +27,19 @@ forced timeouts. FTP Secure (FTPS) is also supported.
|
|
25
27
|
class SomeObject
|
26
28
|
include NiFTP
|
27
29
|
|
30
|
+
def ftps_options
|
31
|
+
{
|
32
|
+
username: "",
|
33
|
+
password: "",
|
34
|
+
ftps: true,
|
35
|
+
ssl_context_params: {
|
36
|
+
verify_mode: OpenSSL::SSL::VERIFY_NONE
|
37
|
+
}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
28
41
|
def ftp_stuff
|
29
|
-
|
30
|
-
ftp("ftp.secure.com", { username: "some_user", password: "FTP_FTL",
|
31
|
-
ftps: true }) do |client|
|
42
|
+
ftp("ftp.appareldownload.com", ftps_options) do |client|
|
32
43
|
files = client.list('n*')
|
33
44
|
# ...
|
34
45
|
file = client.getbinaryfile('nif.rb-0.91.gz', 'nif.gz', 1024)
|
@@ -42,7 +53,6 @@ forced timeouts. FTP Secure (FTPS) is also supported.
|
|
42
53
|
* **username**: The user name, if required by the host (default: "").
|
43
54
|
* **password**: The password, if required by the host (default: "").
|
44
55
|
* **port**: The port for the host (default: 21).
|
45
|
-
* **ftps**: Set to true if connecting to a FTP Secure server (default: false).
|
46
56
|
* **tries**: The number of times to try the given FTP commands upon any
|
47
57
|
exception, before raising the exception (Default: 2, meaning it will *retry
|
48
58
|
once* upon any exception).
|
@@ -57,6 +67,9 @@ forced timeouts. FTP Secure (FTPS) is also supported.
|
|
57
67
|
(default: 30). Use 0 to disable the authentication timeout.
|
58
68
|
* **passive**: Set to false to prevent a connection in passive mode (default:
|
59
69
|
true).
|
70
|
+
* **ftps**: Set to true if connecting to a FTP Secure server (default: false).
|
71
|
+
* **ftps_mode**: Set to one of the following: `DoubleBagFTPS::EXPLICIT` or `DoubleBagFTPS::IMPLICIT` (default: `DoubleBagFTPS::IMPLICIT`).
|
72
|
+
* **ssl_context_params**: See the [DoubleBagFTPS](https://github.com/bnix/double-bag-ftps) for options. (default: { }).
|
60
73
|
|
61
74
|
## Caveats
|
62
75
|
|
data/lib/niftp.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "net/ftp"
|
2
|
-
require "
|
2
|
+
require "double_bag_ftps"
|
3
3
|
require "retryable"
|
4
4
|
require "timeout"
|
5
5
|
|
@@ -35,8 +35,20 @@ module NiFTP
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def instantiate_ftp_per_options(options)
|
38
|
-
(options[:ftps] ?
|
39
|
-
|
38
|
+
(options[:ftps] ? DoubleBagFTPS.new : Net::FTP.new).tap do |obj|
|
39
|
+
if options[:ftps]
|
40
|
+
if options[:ftps_mode]
|
41
|
+
obj.ftps_mode = options[:ftps_mode]
|
42
|
+
end
|
43
|
+
|
44
|
+
if options[:ssl_context_params]
|
45
|
+
obj.ssl_context = DoubleBagFTPS.create_ssl_context(
|
46
|
+
options[:ssl_context_params]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
obj.passive = options[:passive]
|
40
52
|
end
|
41
53
|
end
|
42
54
|
|
data/lib/niftp/version.rb
CHANGED
data/niftp.gemspec
CHANGED
@@ -28,12 +28,10 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.extra_rdoc_files = ["README.md"] + Dir.glob("doc/*")
|
29
29
|
|
30
30
|
# Dependencies
|
31
|
-
s.add_dependency "
|
31
|
+
s.add_dependency "double-bag-ftps", ">= 0.1.3"
|
32
32
|
s.add_dependency "retryable", ">= 2.0"
|
33
33
|
s.add_dependency "i18n", ">= 0.5"
|
34
34
|
s.add_development_dependency "minitest", "~> 4.7"
|
35
|
-
s.add_development_dependency "guard", "~> 1.8.3"
|
36
|
-
s.add_development_dependency "guard-minitest", "~> 1.0.1"
|
37
35
|
s.add_development_dependency "mocha", "~> 0.14"
|
38
36
|
s.add_development_dependency "rake"
|
39
37
|
end
|
data/test/niftp_test.rb
CHANGED
@@ -98,8 +98,8 @@ module NiFTP
|
|
98
98
|
object.ftp(host, { :timeout => 1 })
|
99
99
|
end
|
100
100
|
|
101
|
-
it "must use the
|
102
|
-
|
101
|
+
it "must use the DoubleBagFTPS library when instructed" do
|
102
|
+
DoubleBagFTPS.expects(:new).once.returns(ftp)
|
103
103
|
object.ftp(host, { :ftps => true })
|
104
104
|
end
|
105
105
|
end
|
@@ -110,4 +110,4 @@ module NiFTP
|
|
110
110
|
Net::FTP.stubs(:new => ftp)
|
111
111
|
end
|
112
112
|
end
|
113
|
-
end
|
113
|
+
end
|
metadata
CHANGED
@@ -1,125 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: niftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher R. Murphy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: double-bag-ftps
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.1.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.1.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: retryable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: i18n
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.5'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '4.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.7'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: guard
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.8.3
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.8.3
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: guard-minitest
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.0.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0.1
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: mocha
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
|
-
- -
|
73
|
+
- - ~>
|
102
74
|
- !ruby/object:Gem::Version
|
103
75
|
version: '0.14'
|
104
76
|
type: :development
|
105
77
|
prerelease: false
|
106
78
|
version_requirements: !ruby/object:Gem::Requirement
|
107
79
|
requirements:
|
108
|
-
- -
|
80
|
+
- - ~>
|
109
81
|
- !ruby/object:Gem::Version
|
110
82
|
version: '0.14'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: rake
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
|
-
- -
|
87
|
+
- - ! '>='
|
116
88
|
- !ruby/object:Gem::Version
|
117
89
|
version: '0'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
|
-
- -
|
94
|
+
- - ! '>='
|
123
95
|
- !ruby/object:Gem::Version
|
124
96
|
version: '0'
|
125
97
|
description: NiFTP makes Ruby's decidedly un-nifty Net::FTP library easier to use.
|
@@ -130,11 +102,10 @@ extensions: []
|
|
130
102
|
extra_rdoc_files:
|
131
103
|
- README.md
|
132
104
|
files:
|
133
|
-
-
|
134
|
-
-
|
105
|
+
- .gitignore
|
106
|
+
- .travis.yml
|
135
107
|
- CONTRIBUTING.md
|
136
108
|
- Gemfile
|
137
|
-
- Guardfile
|
138
109
|
- MIT-LICENSE
|
139
110
|
- README.md
|
140
111
|
- Rakefile
|
@@ -149,22 +120,22 @@ licenses:
|
|
149
120
|
metadata: {}
|
150
121
|
post_install_message:
|
151
122
|
rdoc_options:
|
152
|
-
-
|
123
|
+
- --include=examples --main README.md
|
153
124
|
require_paths:
|
154
125
|
- lib
|
155
126
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
127
|
requirements:
|
157
|
-
- -
|
128
|
+
- - ! '>='
|
158
129
|
- !ruby/object:Gem::Version
|
159
130
|
version: '0'
|
160
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
132
|
requirements:
|
162
|
-
- -
|
133
|
+
- - ! '>='
|
163
134
|
- !ruby/object:Gem::Version
|
164
135
|
version: '0'
|
165
136
|
requirements: []
|
166
137
|
rubyforge_project: niftp
|
167
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.6.8
|
168
139
|
signing_key:
|
169
140
|
specification_version: 4
|
170
141
|
summary: NiFTP makes Ruby's decidedly un-nifty Net::FTP library easier to use.
|