niftp 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -12
- data/lib/niftp/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -3,15 +3,25 @@ use. It abstracts away the FTP plumbing, such as establishing and closing
|
|
3
3
|
connections. Options include retrying your commands on flakey FTP servers, and
|
4
4
|
forced timeouts. FTP Secure (FTPS) is also supported.
|
5
5
|
|
6
|
-
##
|
7
|
-
|
8
|
-
# get a file with no username, password or other options
|
9
|
-
ftp("localhost") { |ftp| ftp.get("some_file.txt") }
|
6
|
+
## Usage
|
10
7
|
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
# Mixin the +NiFTP+ module, which provides the +ftp+ method.
|
9
|
+
class SomeObject
|
10
|
+
include NiFTP
|
11
|
+
|
12
|
+
def ftp_stuff
|
13
|
+
# put a file using no username, password or other options
|
14
|
+
ftp("localhost") { |client| client.put("some_file.txt") }
|
15
|
+
|
16
|
+
# get a file on an FTP Secure (FTPS) server
|
17
|
+
ftp("ftp.secure.com", { username: "some_user", password: "FTP_FTL",
|
18
|
+
ftps: true }) do |client|
|
19
|
+
client.resume = true
|
20
|
+
file = client.get("some_file.txt")
|
21
|
+
# ...
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
15
25
|
|
16
26
|
## Options
|
17
27
|
|
@@ -19,20 +29,20 @@ forced timeouts. FTP Secure (FTPS) is also supported.
|
|
19
29
|
* **password**: The password, if required by the host (default: "").
|
20
30
|
* **port**: The port for the host (default: 21).
|
21
31
|
* **ftps**: Set to true if connecting to a FTP Secure server (default: false).
|
22
|
-
* **retries**: The number of times to re-try the given FTP commands upon any
|
32
|
+
* **retries**: The number of times to re-try the given FTP commands upon any
|
23
33
|
exception, before raising the exception (Default: 1).
|
24
|
-
* **timeout**: The number of seconds to wait before timing out (default: 5).
|
34
|
+
* **timeout**: The number of seconds to wait before timing out (default: 5).
|
25
35
|
Use 0 to disable the timeout.
|
26
36
|
* **passive**: Set to false to prevent a connection in passive mode (default:
|
27
37
|
true).
|
28
|
-
|
38
|
+
|
29
39
|
## Caveats
|
30
40
|
|
31
41
|
Based on the way the [retryable]("https://github.com/nfedyashev/retryable")
|
32
42
|
gem works, any FTP commands will be retried at least once upon any
|
33
43
|
exception. Setting the :retries option to 0 will raise a runtime error. I'm
|
34
44
|
fine with this for now as I prefer this behavior.
|
35
|
-
|
45
|
+
|
36
46
|
## Testing
|
37
47
|
|
38
48
|
Tests are written with Shoulda and Mocha. This gem is tested in Ruby 1.8.7
|
data/lib/niftp/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: niftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Christopher R. Murphy
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-19 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|