ztk 1.4.15 → 1.4.16
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.
- data/README.md +8 -0
- data/lib/ztk/ssh/download.rb +8 -2
- data/lib/ztk/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -8,6 +8,14 @@
|
|
8
8
|
|
9
9
|
Zachary's (DevOp) Tool Kit is a general purpose utility gem, featuring a collection of classes meant to simplify development of complex systems in Ruby.
|
10
10
|
|
11
|
+
# RUBIES TESTED AGAINST
|
12
|
+
|
13
|
+
* Ruby 1.8.7 (REE)
|
14
|
+
* Ruby 1.8.7 (MBARI)
|
15
|
+
* Ruby 1.9.2
|
16
|
+
* Ruby 1.9.3
|
17
|
+
* Ruby 2.0.0
|
18
|
+
|
11
19
|
# RESOURCES
|
12
20
|
|
13
21
|
IRC:
|
data/lib/ztk/ssh/download.rb
CHANGED
@@ -8,6 +8,11 @@ module ZTK
|
|
8
8
|
#
|
9
9
|
# @param [String] remote The remote file/path you with to download from.
|
10
10
|
# @param [String] local The local file/path you wish to download to.
|
11
|
+
# @param [Hash] options An optional hash of options.
|
12
|
+
# @option options [Boolean] :recursive Whether or not to recursively
|
13
|
+
# download files and directories. By default this looks at the local
|
14
|
+
# target and if it is a directory this is set to *true* otherwise it
|
15
|
+
# will default to *false*.
|
11
16
|
#
|
12
17
|
# @example Download a file:
|
13
18
|
# $logger = ZTK::Logger.new(STDOUT)
|
@@ -19,12 +24,13 @@ module ZTK
|
|
19
24
|
# local = File.expand_path(File.join("/tmp", "id_rsa.pub"))
|
20
25
|
# remote = File.expand_path(File.join(ENV["HOME"], ".ssh", "id_rsa.pub"))
|
21
26
|
# ssh.download(remote, local)
|
22
|
-
def download(remote, local)
|
27
|
+
def download(remote, local, options={})
|
23
28
|
config.ui.logger.debug { "config=#{config.send(:table).inspect}" }
|
24
29
|
config.ui.logger.info { "download(#{remote.inspect}, #{local.inspect})" }
|
30
|
+
options = {:recursive => ::File.directory?(local) }.merge(options)
|
25
31
|
|
26
32
|
ZTK::RescueRetry.try(:tries => 3, :on => EOFError, :on_retry => method(:on_retry)) do
|
27
|
-
sftp.download!(remote.to_s, local.to_s) do |event, downloader, *args|
|
33
|
+
sftp.download!(remote.to_s, local.to_s, options) do |event, downloader, *args|
|
28
34
|
case event
|
29
35
|
when :open
|
30
36
|
config.ui.logger.debug { "download(#{args[0].remote} -> #{args[0].local})" }
|
data/lib/ztk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ztk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubis
|
@@ -265,7 +265,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
265
|
version: '0'
|
266
266
|
segments:
|
267
267
|
- 0
|
268
|
-
hash:
|
268
|
+
hash: -188109218987877794
|
269
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
270
|
none: false
|
271
271
|
requirements:
|
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
version: '0'
|
275
275
|
segments:
|
276
276
|
- 0
|
277
|
-
hash:
|
277
|
+
hash: -188109218987877794
|
278
278
|
requirements: []
|
279
279
|
rubyforge_project:
|
280
280
|
rubygems_version: 1.8.25
|