Skip to content

Commit

Permalink
Official 4.2 release:
Browse files Browse the repository at this point in the history
Signed-off-by: Baki Goxhaj <banago@gmail.com>
#227: Implements storing password in a separate file outside of the ini file.
#237: Fixes user-imput passowors with special chars.
  • Loading branch information
banago committed Apr 17, 2016
2 parents 79f63d7 + c0cefb0 commit 89493d7
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea
/vendor
/dev
composer.lock
Expand Down
Binary file modified bin/phploy.phar
Binary file not shown.
6 changes: 3 additions & 3 deletions phploy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; This is a sample deploy.ini file. You can specify as many
; This is a sample phploy.ini file. You can specify as many
; servers as you need and use normal or quickmode configuration.
;
; NOTE: If a value in the .ini file contains any non-alphanumeric
Expand All @@ -24,7 +24,7 @@
purge[] = "cache/"
pre-deploy[] = "wget http://staging-example.com/pre-deploy/test.php --spider --quiet"
post-deploy[] = "wget http://staging-example.com/post-deploy/test.php --spider --quiet"

[production]
quickmode = ftp://example:password@production-example.com:21/path/to/installation
passive = true
Expand All @@ -34,6 +34,6 @@
skip[] = 'libs/*'
skip[] = 'config/*'
skip[] = 'src/*.scss'
purge[] = "cache/"
purge[] = "cache/"
pre-deploy[] = "wget http://staging-example.com/pre-deploy/test.php --spider --quiet"
post-deploy[] = "wget http://staging-example.com/post-deploy/test.php --spider --quiet"
13 changes: 12 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PHPloy
**Version 4.1.3**
**Version 4.2**

PHPloy is an incremental Git FTP and SFTP deployment tool. By keeping track of the state of the remote server(s) it deploys only the files that were committed since the last deployment. PHPloy supports submodules, sub-submodules, deploying to multiple servers and rollbacks. PHPloy requires **PHP 5.4+** and **Git 1.8+**.

Expand Down Expand Up @@ -79,6 +79,17 @@ The `phploy.ini` file holds your project configuration. It should be located in
```

If your password is missing in the `phploy.ini` file, PHPloy will interactively ask you for your password.
There is also an option to store the password in a file called `.phploy`.

```
[staging]
password=password
[production]
password=password
```

This feature is especially useful if you would like to share your phploy.ini via Git but hide your password from the public.

## Multiple servers

Expand Down
27 changes: 25 additions & 2 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,25 @@
use League\Flysystem\Filesystem;
use League\Flysystem\Sftp\SftpAdapter as SftpAdapter;

/**
* Class Connection.
*/
class Connection
{
/**
* @var Filesystem
*/
public $server;

/**
* Connection constructor.
*
* @param string $server
*
* @return Connection
*
* @throws \Exception
*/
public function __construct($server)
{
if (!isset($server['scheme'])) {
Expand All @@ -30,7 +45,9 @@ public function __construct($server)
*
* @param string $server
*
* @throws Exception if it can't connect to FTP server
* @return Filesystem|null
*
* @throws \Exception if it can't connect to FTP server
*/
protected function connectToFtp($server)
{
Expand All @@ -47,14 +64,18 @@ protected function connectToFtp($server)
} catch (\Exception $e) {
echo "\r\nOh Snap: {$e->getMessage()}\r\n";
}

return;
}

/**
* Connects to the SFTP Server.
*
* @param string $server
*
* @throws Exception if it can't connect to FTP server
* @return Filesystem|null
*
* @throws \Exception if it can't connect to FTP server
*/
protected function connectToSftp($server)
{
Expand All @@ -71,5 +92,7 @@ protected function connectToSftp($server)
} catch (\Exception $e) {
echo "\r\nOh Snap: {$e->getMessage()}\r\n";
}

return;
}
}
25 changes: 25 additions & 0 deletions src/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Banago\PHPloy;

/**
* Class Git.
*/
class Git
{
/**
Expand All @@ -19,6 +22,11 @@ class Git
*/
protected $repo;

/**
* Git constructor.
*
* @param null $repo
*/
public function __construct($repo = null)
{
$this->repo = $repo;
Expand All @@ -29,6 +37,8 @@ public function __construct($repo = null)
/**
* Executes a console command and returns the output (as an array).
*
* @param string $command Command to execute
*
* @return array of all lines that were output to the console during the command (STDOUT)
*/
public function exec($command)
Expand Down Expand Up @@ -60,6 +70,14 @@ public function command($command, $repoPath = null)
return $this->exec($command);
}

/**
* Diff versions.
*
* @param string $remoteRevision
* @param string $localRevision
*
* @return array
*/
public function diff($remoteRevision, $localRevision)
{
if (empty($remoteRevision)) {
Expand All @@ -74,6 +92,13 @@ public function diff($remoteRevision, $localRevision)
return $this->command($command);
}

/**
* Checkout given $branch.
*
* @param string $branch
*
* @return array
*/
public function checkout($branch)
{
$command = 'checkout '.$branch;
Expand Down
19 changes: 19 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@

namespace Banago\PHPloy;

use League\CLImate\CLImate;

/**
* Class Options.
*/
class Options
{
/**
* @var CLImate
*/
public $cli;

/**
* Options constructor.
*
* @param CLImate $climate
*/
public function __construct($climate)
{
$this->cli = $climate;
Expand All @@ -14,6 +27,9 @@ public function __construct($climate)
$this->parse();
}

/**
*
*/
protected function build()
{
$this->cli->description('PHPloy - Incremental Git FTP/SFTP deployment tool that supports multiple servers, submodules and rollbacks.');
Expand Down Expand Up @@ -70,6 +86,9 @@ protected function build()
]);
}

/**
*
*/
protected function parse()
{
$this->cli->arguments->parse();
Expand Down
Loading

0 comments on commit 89493d7

Please sign in to comment.