niftp 1.0.1 → 1.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.
Files changed (3) hide show
  1. data/README.md +22 -12
  2. data/lib/niftp/version.rb +1 -1
  3. 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
- ## Examples
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
- # put a file to an FTP Secure (FTPS) server
12
- ftp("localhost", { username: "anonymous", password: "FTP_FTL", ftps: true }) do |ftp|
13
- ftp.put("some_file.txt")
14
- end
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
@@ -1,3 +1,3 @@
1
1
  module NiFTP
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: niftp
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
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-18 00:00:00 -04:00
13
+ date: 2011-05-19 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency