ztk 1.4.14 → 1.4.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,17 +24,20 @@ module ZTK
24
24
  def bootstrap(content, use_sudo=true)
25
25
  tempfile = Tempfile.new("bootstrap")
26
26
 
27
- ::File.open(tempfile.path, 'w') do |file|
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(tempfile.path, tempfile.path)
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 << tempfile.path
40
+ command << remote_tempfile
38
41
  command = command.join(' ')
39
42
 
40
43
  self.exec(command, :silence => true)
@@ -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
- ::File.open(tempfile.path, 'w') do |file|
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(tempfile.path, tempfile.path)
40
+ upload(local_tempfile, remote_tempfile)
37
41
 
38
- exec(%(sudo mv -v #{tempfile.path} #{target}), :silence => true)
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?
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "1.4.14"
4
+ VERSION = "1.4.15"
5
5
 
6
6
  end
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.14
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: -2112883830761548876
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: -2112883830761548876
277
+ hash: 4032799031056895282
278
278
  requirements: []
279
279
  rubyforge_project:
280
280
  rubygems_version: 1.8.25