|
13 | 13 |
|
14 | 14 | use hiqdev\assetpackagist\commands\PackageUpdateCommand;
|
15 | 15 | use hiqdev\assetpackagist\models\AssetPackage;
|
| 16 | +use hiqdev\assetpackagist\repositories\PackageRepository; |
16 | 17 | use Yii;
|
17 | 18 | use yii\helpers\Console;
|
18 | 19 |
|
19 | 20 | class AssetPackageController extends \yii\console\Controller
|
20 | 21 | {
|
| 22 | + /** |
| 23 | + * @var PackageRepository |
| 24 | + */ |
| 25 | + protected $packageRepository; |
| 26 | + |
| 27 | + /** |
| 28 | + * MaintenanceController constructor. |
| 29 | + * @param PackageRepository $packageRepository |
| 30 | + * @inheritdoc |
| 31 | + */ |
| 32 | + public function __construct($id, $module, PackageRepository $packageRepository, $config = []) |
| 33 | + { |
| 34 | + parent::__construct($id, $module, $config); |
| 35 | + |
| 36 | + $this->packageRepository = $packageRepository; |
| 37 | + } |
| 38 | + |
21 | 39 | /**
|
22 | 40 | * @param string $type the package type. Can be either `bower` or `npm`
|
23 | 41 | * @param string $name the package name
|
@@ -75,6 +93,14 @@ public function actionUpdateAll()
|
75 | 93 | $this->actionUpdateList(Yii::getAlias('@hiqdev/assetpackagist/config/packages.list'));
|
76 | 94 | }
|
77 | 95 |
|
| 96 | + public function actionAvoid($type, $name) |
| 97 | + { |
| 98 | + $package = new AssetPackage($type, $name); |
| 99 | + $this->packageRepository->markAvoided($package); |
| 100 | + |
| 101 | + echo Console::renderColoredString("Package %N$type/$name%n is %Ravoided%n now\n"); |
| 102 | + } |
| 103 | + |
78 | 104 | public function actionList()
|
79 | 105 | {
|
80 | 106 | $packages = Yii::$app->get('packageStorage')->listPackages();
|
|
0 commit comments