Skip to content

Commit 2a12046

Browse files
committed
Remove composer_version option
1 parent 41c85d7 commit 2a12046

File tree

2 files changed

+6
-50
lines changed

2 files changed

+6
-50
lines changed

docs/recipe/deploy/vendors.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
* Config
1212
* [`composer_action`](#composer_action)
1313
* [`composer_options`](#composer_options)
14-
* [`composer_version`](#composer_version)
15-
* [`composer_channel`](#composer_channel)
1614
* Tasks
1715
* [`deploy:vendors`](#deployvendors) — Installing vendors
1816

@@ -27,22 +25,6 @@
2725

2826

2927

30-
### composer_version
31-
[Source](https://github.com/deployphp/deployer/search?q=%22composer_version%22+in%3Afile+language%3Aphp+path%3Arecipe%2Fdeploy+filename%3Avendors.php)
32-
33-
Can be used to choose what composer version to install.
34-
Valid values are any that are [listed here](https://getcomposer.org/download/).
35-
36-
For example:
37-
```php
38-
set('composer_version', '10.10.15')
39-
```
40-
41-
### composer_channel
42-
[Source](https://github.com/deployphp/deployer/search?q=%22composer_channel%22+in%3Afile+language%3Aphp+path%3Arecipe%2Fdeploy+filename%3Avendors.php)
43-
44-
Set this variable to stable, snapshot, preview, 1 or 2 to select which Composer channel to use
45-
4628

4729
## Tasks
4830
### deploy:vendors

recipe/deploy/vendors.php

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,9 @@
66

77
set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader');
88

9-
/**
10-
* Can be used to choose what composer version to install.
11-
* Valid values are any that are [listed here](https://getcomposer.org/download/).
12-
*
13-
* For example:
14-
* ```php
15-
* set('composer_version', '10.10.15')
16-
* ```
17-
*/
18-
set('composer_version', null);
19-
20-
/**
21-
* Set this variable to stable, snapshot, preview, 1 or 2 to select which Composer channel to use
22-
*/
23-
set('composer_channel', null);
24-
9+
// Returns Composer binary path in found. Otherwise try to install latest
10+
// composer version to `.dep/composer.phar`. To use specific composer version
11+
// download desired phar and place it at `.dep/composer.phar`.
2512
set('bin/composer', function () {
2613
if (commandExist('composer')) {
2714
return '{{bin/php}} ' . locateBinaryPath('composer');
@@ -31,22 +18,9 @@
3118
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
3219
}
3320

34-
$composerVersionToInstall = get('composer_version', null);
35-
$composerChannel = get('composer_channel', null);
36-
$installCommand = "cd {{release_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}";
37-
38-
if ($composerVersionToInstall) {
39-
$installCommand .= " -- --version=" . $composerVersionToInstall;
40-
} elseif ($composerChannel) {
41-
$composerValidChannels = ['stable', 'snapshot', 'preview', '1', '2',];
42-
if (!in_array($composerChannel, $composerValidChannels)) {
43-
throw new \Exception('Selected Composer channel ' . $composerChannel . ' is not valid. Valid channels are: ' . implode(', ', $composerValidChannels));
44-
}
45-
$installCommand .= " -- --" . $composerChannel;
46-
}
47-
48-
run($installCommand);
49-
run('mv {{release_path}}/composer.phar {{deploy_path}}/.dep/composer.phar');
21+
warning("Composer binary didn't found. Installing latest composer to \"{{deploy_path}}/.dep/composer.phar\".");
22+
run("cd {{deploy_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
23+
run('mv {{deploy_path}}/composer.phar {{deploy_path}}/.dep/composer.phar');
5024
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
5125
});
5226

0 commit comments

Comments
 (0)