Add download features

This commit is contained in:
miziomon 2014-03-17 13:20:13 +01:00
parent 6dd055d72d
commit 14862f10d3
4 changed files with 36 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ vendor/
deployer.phar
pages/
.idea/
/nbproject/

View File

@ -59,4 +59,14 @@ class Remote implements RemoteInterface
}
$this->sftp->put($to, $from, NET_SFTP_LOCAL_FILE);
}
/**
* download file from remote in current directory
* @param type $from
* @param type $to
*/
public function downloadFile($from, $to)
{
return $this->sftp->get($from, $to);
}
}

View File

@ -185,6 +185,20 @@ class Tool
}
}
public function download($remote, $local)
{
$this->checkConnected();
$this->writeln("Downloading file <info>$remote</info> to <info>$local</info>");
$status = $this->remote->downloadFile($remote , $local );
if (!$status) {
throw new \RuntimeException("Download error");
}
$this->writeln("Download complete");
}
public function cd($directory)
{
$this->checkConnected();

View File

@ -80,6 +80,17 @@ function upload($from, $to)
Context::get()->upload($from, $to);
}
/**
*
* @param type $from
* @param type $to
*/
function download($from, $to)
{
Context::get()->download($from, $to);
}
/**
* Change current directory for whole connect session.
* @param string $directory