lib/simple_provision/scp.rb in simple_provision-0.99.4 vs lib/simple_provision/scp.rb in simple_provision-0.99.5
- old
+ new
@@ -1,8 +1,8 @@
module SimpleProvision
class SCP
- FILENAME = "fss.tar.gz"
+ FILENAME = "simpro.tar.gz"
def initialize(server, opts)
@server, @opts = server, opts
end
@@ -22,21 +22,31 @@
if includes.empty?
raise "Both files and scripts are empty. You should provide some"
end
- `tar -czf #{FILENAME} #{includes.join(" ")}`
+ system("mkdir tmp")
+ system("mkdir tmp/files")
+ system("mkdir tmp/scripts")
+ files.each do |f|
+ system("cp #{f} tmp/files/")
+ end
+ scripts.each do |f|
+ system("cp #{f} tmp/scripts/")
+ end
+
+ system("cd tmp && tar -czf #{FILENAME} files/ scripts/")
end
def scp_files_to_server
- @server.scp(FILENAME, ".")
+ @server.scp("tmp/#{FILENAME}", ".")
end
def extract_remote_archive
@server.ssh("tar -xzf #{FILENAME}")
end
def remove_local_archive
- `rm -f #{FILENAME}`
+ `rm -rf tmp`
end
end
end