Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dg/ftp-deployment
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.5.0
Choose a base ref
...
head repository: dg/ftp-deployment
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 16 commits
  • 20 files changed
  • 4 contributors

Commits on Aug 29, 2021

  1. Copy the full SHA
    bff1d3b View commit details
  2. typo (#149)

    arxeiss authored Aug 29, 2021
    Copy the full SHA
    dcaef26 View commit details

Commits on Nov 26, 2021

  1. Copy the full SHA
    15e8ce4 View commit details

Commits on Feb 4, 2022

  1. Copy the full SHA
    e5ff0d1 View commit details

Commits on Mar 1, 2022

  1. Copy the full SHA
    9b1e1bb View commit details

Commits on Feb 28, 2023

  1. opened 3.6-dev

    dg committed Feb 28, 2023
    Copy the full SHA
    1b545a7 View commit details
  2. requires PHP 8.0

    dg committed Feb 28, 2023
    Copy the full SHA
    a375d56 View commit details
  3. coding style

    dg committed Feb 28, 2023
    Copy the full SHA
    762f115 View commit details
  4. Copy the full SHA
    5c713aa View commit details
  5. PascalCase constants

    dg committed Feb 28, 2023
    Copy the full SHA
    217c019 View commit details

Commits on Sep 29, 2023

  1. added github workflows

    dg committed Sep 29, 2023
    Copy the full SHA
    50a1395 View commit details

Commits on Oct 2, 2023

  1. Copy the full SHA
    6ad4c51 View commit details

Commits on Mar 19, 2024

  1. Copy the full SHA
    5c024b3 View commit details

Commits on May 2, 2024

  1. github actions updated

    dg committed May 2, 2024
    Copy the full SHA
    a63e1ad View commit details

Commits on May 24, 2024

  1. composer: updated license

    dg committed May 24, 2024
    Copy the full SHA
    98e6a55 View commit details

Commits on Aug 9, 2024

  1. Copy the full SHA
    0ead73b View commit details
31 changes: 31 additions & 0 deletions .github/workflows/coding-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Coding Style

on: [push, pull_request]

jobs:
nette_cc:
name: Nette Code Checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- run: composer create-project nette/code-checker temp/code-checker ^3 --no-progress
- run: php temp/code-checker/code-checker --strict-types --no-progress


nette_cs:
name: Nette Coding Standard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- run: composer create-project nette/coding-standard temp/coding-standard ^3 --no-progress
- run: php temp/coding-standard/ecs check
21 changes: 21 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Static Analysis (only informative)

on:
push:
branches:
- master

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- run: composer install --no-progress --prefer-dist
- run: composer phpstan -- --no-progress
continue-on-error: true # is only informative
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tests

on: [push, pull_request]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.0', '8.1', '8.2', '8.3', '8.4']

fail-fast: false

name: PHP ${{ matrix.php }} tests
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- run: composer install --no-progress --prefer-dist
- run: vendor/bin/tester tests -s -C
- if: failure()
uses: actions/upload-artifact@v3
with:
name: output
path: tests/**/output
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@
"description": "A tool for automated deployment of web applications to an FTP server.",
"keywords": ["deployment", "ftp", "ssh"],
"homepage": "https://github.com/dg/ftp-deployment",
"license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
"license": ["BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
}
],
"require": {
"php": ">=7.4",
"php": ">=8.0",
"ext-zlib": "*",
"phpseclib/phpseclib": "^3.0"
},
@@ -32,7 +32,7 @@
"bin": ["deployment"],
"extra": {
"branch-alias": {
"dev-master": "3.5-dev"
"dev-master": "3.6-dev"
}
}
}
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ FTP Deployment: smart upload
============================

[![Downloads this Month](https://img.shields.io/packagist/dm/dg/ftp-deployment.svg)](https://packagist.org/packages/dg/ftp-deployment)
[![Tests](https://github.com/dg/ftp-deployment/workflows/Tests/badge.svg?branch=master)](https://github.com/dg/ftp-deployment/actions)
[![Tests](https://github.com/dg/ftp-deployment/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/dg/ftp-deployment/actions/workflows/tests.yml)
[![Latest Stable Version](https://poser.pugx.org/dg/ftp-deployment/v/stable)](https://github.com/dg/ftp-deployment/releases)
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/dg/ftp-deployment/blob/master/license.md)

@@ -186,15 +186,15 @@ This tool will combine scripts together and minify them with the Closure Compile
Installing FTP Deployment
-------------------------

FTP Deployment 3.x requires PHP 7.4 or later (version 2.x requires PHP 5.4 or newer). It also requires openssl extensions for ftps:// and SSH2 extension for sftp:// connections.
FTP Deployment 3.6 requires PHP 8.0 or later. It also requires openssl extensions for ftps:// and SSH2 extension for sftp:// connections.

The easiest way to obtain FTP Deployment is to download [a single PHAR file](https://github.com/dg/ftp-deployment/releases).

If you want to use minification, install [Node.js](https://nodejs.org/en/) and [UglifyES](https://www.npmjs.com/package/uglify-es)
If you want to use minification, install [Node.js](https://nodejs.org/en/), [UglifyJS 3](https://www.npmjs.com/package/uglify-js)
for JavaScript minification and [clean-css](https://www.npmjs.com/package/clean-css-cli) for CSS minification.

```
npm install uglify-es -g
npm install uglify-js -g
npm install clean-css-cli -g
```

@@ -206,9 +206,9 @@ composer create-project dg/ftp-deployment
```

Are you looking for php_ssh2.dll?
- [php_ssh2.dll for PHP 7.4 x86](https://files.nette.org/misc/7.4-x86/php_ssh2.dll)
- [php_ssh2.dll for PHP 7.4 x64](https://files.nette.org/misc/7.4-x64/php_ssh2.dll)
- [php_ssh2.dll for PHP 8.0 x64](https://files.nette.org/misc/8.0-x64/php_ssh2.dll)
- [php_ssh2.dll for PHP 8.1 x64](https://files.nette.org/misc/8.1-x64/php_ssh2.dll)
- [php_ssh2.dll for PHP 8.2 x64](https://files.nette.org/misc/8.2-x64/php_ssh2.dll)

Need SSH authenticate using a public key?

8 changes: 4 additions & 4 deletions src/Deployment/CliRunner.php
Original file line number Diff line number Diff line change
@@ -31,9 +31,7 @@ class CliRunner

/** @var string[] */
public array $ignoreMasks = ['*.bak', '.svn', '.git*', 'Thumbs.db', '.DS_Store', '.idea'];

private Logger $logger;

private string $configFile;

/** test|generate|null */
@@ -206,6 +204,8 @@ private function setupPhp(): void
pcntl_signal(SIGINT, SIG_DFL);
throw new \Exception('Terminated');
});
pcntl_async_signals(true);

} elseif (function_exists('sapi_windows_set_ctrl_handler')) {
sapi_windows_set_ctrl_handler(function () {
throw new \Exception('Terminated');
@@ -219,7 +219,7 @@ private function loadConfig(): ?array
$cmd = new CommandLine(
<<<'XX'
FTP deployment v3.5
FTP deployment v3.6
-------------------
Usage:
deployment <config_file> [-t | --test]
@@ -232,7 +232,7 @@ private function loadConfig(): ?array

XX,
[
'config' => [CommandLine::REALPATH => true],
'config' => [CommandLine::RealPath => true],
],
);

39 changes: 19 additions & 20 deletions src/Deployment/CommandLine.php
Original file line number Diff line number Diff line change
@@ -17,11 +17,11 @@
class CommandLine
{
public const
ARGUMENT = 'argument',
OPTIONAL = 'optional',
REPEATABLE = 'repeatable',
REALPATH = 'realpath',
VALUE = 'default';
Argument = 'argument',
Optional = 'optional',
Repeatable = 'repeatable',
RealPath = 'realpath',
Value = 'default';

/** @var array[] */
private array $options = [];
@@ -31,7 +31,6 @@ class CommandLine

/** @var string[] */
private array $positional = [];

private string $help;


@@ -50,10 +49,10 @@ public function __construct(string $help, array $defaults = [])
$name = end($m[1]);
$opts = $this->options[$name] ?? [];
$this->options[$name] = $opts + [
self::ARGUMENT => (bool) end($m[2]),
self::OPTIONAL => isset($line[2]) || (substr(end($m[2]), 0, 1) === '[') || isset($opts[self::VALUE]),
self::REPEATABLE => (bool) end($m[3]),
self::VALUE => $line[2] ?? null,
self::Argument => (bool) end($m[2]),
self::Optional => isset($line[2]) || (substr(end($m[2]), 0, 1) === '[') || isset($opts[self::Value]),
self::Repeatable => (bool) end($m[3]),
self::Value => $line[2] ?? null,
];
if ($name !== $m[1][0]) {
$this->aliases[$m[1][0]] = $name;
@@ -84,7 +83,7 @@ public function parse(array $args = null): array
}
$name = current($this->positional);
$this->checkArg($this->options[$name], $arg);
if (empty($this->options[$name][self::REPEATABLE])) {
if (empty($this->options[$name][self::Repeatable])) {
$params[$name] = $arg;
next($this->positional);
} else {
@@ -104,19 +103,19 @@ public function parse(array $args = null): array

$opt = $this->options[$name];

if ($arg !== true && empty($opt[self::ARGUMENT])) {
if ($arg !== true && empty($opt[self::Argument])) {
throw new \Exception("Option $name has not argument.");

} elseif ($arg === true && !empty($opt[self::ARGUMENT])) {
} elseif ($arg === true && !empty($opt[self::Argument])) {
if (isset($args[$i]) && $args[$i][0] !== '-') {
$arg = $args[$i++];
} elseif (empty($opt[self::OPTIONAL])) {
} elseif (empty($opt[self::Optional])) {
throw new \Exception("Option $name requires argument.");
}
}
$this->checkArg($opt, $arg);

if (empty($opt[self::REPEATABLE])) {
if (empty($opt[self::Repeatable])) {
$params[$name] = $arg;
} else {
$params[$name][] = $arg;
@@ -126,14 +125,14 @@ public function parse(array $args = null): array
foreach ($this->options as $name => $opt) {
if (isset($params[$name])) {
continue;
} elseif (isset($opt[self::VALUE])) {
$params[$name] = $opt[self::VALUE];
} elseif ($name[0] !== '-' && empty($opt[self::OPTIONAL])) {
} elseif (isset($opt[self::Value])) {
$params[$name] = $opt[self::Value];
} elseif ($name[0] !== '-' && empty($opt[self::Optional])) {
throw new \Exception("Missing required argument <$name>.");
} else {
$params[$name] = null;
}
if (!empty($opt[self::REPEATABLE])) {
if (!empty($opt[self::Repeatable])) {
$params[$name] = (array) $params[$name];
}
}
@@ -149,7 +148,7 @@ public function help(): void

public function checkArg(array $opt, &$arg): void
{
if (!empty($opt[self::REALPATH])) {
if (!empty($opt[self::RealPath])) {
$path = realpath($arg);
if ($path === false) {
throw new \Exception("File path '$arg' not found.");
Loading