Skip to content

Commit b760baa

Browse files
committed
Update docgen
1 parent 84c12f7 commit b760baa

9 files changed

Lines changed: 53 additions & 27 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"test": "phpunit",
3434
"check": "php-cs-fixer check",
3535
"fix": "php-cs-fixer fix",
36+
"docgen": "php bin/docgen",
3637
"phpstan": "phpstan analyse -c phpstan.neon --memory-limit 1G",
3738
"phpstan:baseline": "@phpstan --generate-baseline tests/phpstan-baseline.neon"
3839
},

contrib/crontab.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
namespace Deployer;
2626

27-
2827
// Get path to bin
2928
set('bin/crontab', function () {
3029
return which('crontab');

docs/api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,21 @@ timestamp(): string
600600
Returns current timestamp in UTC timezone in ISO8601 format.
601601

602602

603+
## quote()
604+
605+
```php
606+
quote(string $arg): string
607+
```
608+
609+
Quotes a string for safe use as a shell argument using ANSI-C $'...' syntax.
610+
Safe characters (alphanumeric, `/.-+@:=,%`) are returned unquoted.
611+
612+
```php
613+
run('git log --format=' . quote($format));
614+
run('echo ' . quote("it's a test")); // echo $'it\'s a test'
615+
```
616+
617+
603618
## fetch()
604619

605620
```php

docs/contrib/crontab.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,21 @@ add('crontab:jobs', [
2929

3030
## Configuration
3131
### bin/crontab
32-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L30)
32+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L28)
3333

34+
Recipe for adding crontab jobs.
35+
This recipe creates a new section in the crontab file with the configured jobs.
36+
The section is identified by the *crontab:identifier* variable, by default the application name.
37+
## Configuration
38+
- *crontab:jobs* - An array of strings with crontab lines.
39+
## Usage
40+
```php
41+
require 'contrib/crontab.php';
42+
after('deploy:success', 'crontab:sync');
43+
add('crontab:jobs', [
44+
'* * * * * cd {{current_path}} && {{bin/php}} artisan schedule:run >> /dev/null 2>&1',
45+
]);
46+
```
3447
Get path to bin
3548

3649
```php title="Default value"
@@ -39,7 +52,7 @@ return which('crontab');
3952

4053

4154
### crontab:identifier
42-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L35)
55+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L33)
4356

4457
Set the identifier used in the crontab, application name by default
4558

@@ -49,7 +62,7 @@ return get('application', 'application');
4962

5063

5164
### crontab:use_sudo
52-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L40)
65+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L38)
5366

5467
Use sudo to run crontab. When running crontab with sudo, you can use the `-u` parameter to change a crontab for a different user.
5568

@@ -62,15 +75,15 @@ false
6275
## Tasks
6376

6477
### crontab\:sync {#crontab-sync}
65-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L43)
78+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L41)
6679

6780
Sync crontab jobs.
6881

6982

7083

7184

7285
### crontab\:remove {#crontab-remove}
73-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L87)
86+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L85)
7487

7588
Remove crontab jobs.
7689

docs/recipe/deploy/release.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require 'recipe/deploy/release.php';
1313

1414
## Configuration
1515
### release_name
16-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L11)
16+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L9)
1717

1818
The name of the release.
1919

@@ -26,7 +26,7 @@ return strval(intval($latest) + 1);
2626

2727

2828
### releases_log
29-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L19)
29+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L17)
3030

3131
Holds releases log from `.dep/releases_log` file.
3232
:::info Autogenerated
@@ -37,7 +37,7 @@ The value of this configuration is autogenerated on access.
3737

3838

3939
### releases_list
40-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L34)
40+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L32)
4141

4242
Return list of release names on host.
4343
:::info Autogenerated
@@ -48,7 +48,7 @@ The value of this configuration is autogenerated on access.
4848

4949

5050
### release_path
51-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L61)
51+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L59)
5252

5353
Return release path.
5454
:::info Autogenerated
@@ -59,7 +59,7 @@ The value of this configuration is autogenerated on access.
5959

6060

6161
### release_revision
62-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L72)
62+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L70)
6363

6464
Current release revision. Usually a git hash.
6565

@@ -69,7 +69,7 @@ return run('cat {{release_path}}/REVISION');
6969

7070

7171
### release_or_current_path
72-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L78)
72+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L76)
7373

7474
Return the release path during a deployment
7575
but fallback to the current path otherwise.
@@ -84,15 +84,15 @@ return $releaseExists ? get('release_path') : get('current_path');
8484
## Tasks
8585

8686
### deploy\:release {#deploy-release}
87-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L85)
87+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L83)
8888

8989
Prepares release.
9090

9191
Clean up unfinished releases and prepare next release
9292

9393

9494
### releases {#releases}
95-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L160)
95+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L158)
9696

9797
Shows releases list.
9898

docs/recipe/provision/nodejs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require 'recipe/provision/nodejs.php';
1313

1414
## Configuration
1515
### node_version
16-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/nodejs.php#L7)
16+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/nodejs.php#L5)
1717

1818

1919

@@ -26,7 +26,7 @@ require 'recipe/provision/nodejs.php';
2626
## Tasks
2727

2828
### provision\:node {#provision-node}
29-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/nodejs.php#L10)
29+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/nodejs.php#L8)
3030

3131
Installs npm packages.
3232

recipe/deploy/release.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Deployer\Exception\Exception;
66
use Symfony\Component\Console\Helper\Table;
77

8-
98
// The name of the release.
109
set('release_name', function () {
1110
return within('{{deploy_path}}', function () {

recipe/provision/nodejs.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Deployer;
44

5-
65
set('node_version', '--lts');
76

87
desc('Installs npm packages');

src/functions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -990,15 +990,15 @@ function quote(string $arg): string
990990
return $arg;
991991
}
992992
return "\$'" . strtr($arg, [
993-
'\\' => '\\\\',
994-
"'" => "\\'",
995-
"\f" => '\\f',
996-
"\n" => '\\n',
997-
"\r" => '\\r',
998-
"\t" => '\\t',
999-
"\v" => '\\v',
1000-
"\0" => '\\0',
1001-
]) . "'";
993+
'\\' => '\\\\',
994+
"'" => "\\'",
995+
"\f" => '\\f',
996+
"\n" => '\\n',
997+
"\r" => '\\r',
998+
"\t" => '\\t',
999+
"\v" => '\\v',
1000+
"\0" => '\\0',
1001+
]) . "'";
10021002
}
10031003

10041004
/**

0 commit comments

Comments
 (0)