ztk 1.4.14 → 1.4.15
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/lib/ztk/ssh/bootstrap.rb +6 -3
- data/lib/ztk/ssh/file.rb +7 -3
- data/lib/ztk/version.rb +1 -1
- metadata +3 -3
data/lib/ztk/ssh/bootstrap.rb
CHANGED
@@ -24,17 +24,20 @@ module ZTK
|
|
24
24
|
def bootstrap(content, use_sudo=true)
|
25
25
|
tempfile = Tempfile.new("bootstrap")
|
26
26
|
|
27
|
-
|
27
|
+
local_tempfile = tempfile.path
|
28
|
+
remote_tempfile = ::File.join("/tmp", ::File.basename(local_tempfile))
|
29
|
+
|
30
|
+
::File.open(local_tempfile, 'w') do |file|
|
28
31
|
file.puts(content)
|
29
32
|
file.respond_to?(:flush) and file.flush
|
30
33
|
end
|
31
34
|
|
32
|
-
self.upload(
|
35
|
+
self.upload(local_tempfile, remote_tempfile)
|
33
36
|
|
34
37
|
command = Array.new
|
35
38
|
command << %(sudo) if (use_sudo == true)
|
36
39
|
command << %(/bin/bash)
|
37
|
-
command <<
|
40
|
+
command << remote_tempfile
|
38
41
|
command = command.join(' ')
|
39
42
|
|
40
43
|
self.exec(command, :silence => true)
|
data/lib/ztk/ssh/file.rb
CHANGED
@@ -28,14 +28,18 @@ module ZTK
|
|
28
28
|
!block_given? and raise SSHError, "You must supply a block!"
|
29
29
|
|
30
30
|
tempfile = Tempfile.new("tempfile")
|
31
|
-
|
31
|
+
|
32
|
+
local_tempfile = tempfile.path
|
33
|
+
remote_tempfile = ::File.join("/tmp", ::File.basename(local_tempfile))
|
34
|
+
|
35
|
+
::File.open(local_tempfile, 'w') do |file|
|
32
36
|
yield(file)
|
33
37
|
end
|
34
38
|
|
35
39
|
ZTK::RescueRetry.try(:tries => 2, :on_retry => method(:on_retry)) do
|
36
|
-
upload(
|
40
|
+
upload(local_tempfile, remote_tempfile)
|
37
41
|
|
38
|
-
exec(%(sudo mv -v #{
|
42
|
+
exec(%(sudo mv -v #{remote_tempfile} #{target}), :silence => true)
|
39
43
|
|
40
44
|
exec(%(sudo chown -v #{chown} #{target}), :silence => true) if !chown.nil?
|
41
45
|
exec(%(sudo chmod -v #{chmod} #{target}), :silence => true) if !chmod.nil?
|
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.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -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: 4032799031056895282
|
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: 4032799031056895282
|
278
278
|
requirements: []
|
279
279
|
rubyforge_project:
|
280
280
|
rubygems_version: 1.8.25
|