artistan / workbench
为laravel添加可配置的工作台管理命令
0.3
2014-09-29 10:54 UTC
Requires
- php: >=5.3.0
- illuminate/support: 4.2.*
README
为laravel添加可配置的工作台管理命令
Composer 配置
将 artistan workbench 包作为依赖项包含在你的 composer.json 中 Packagist
"require-dev": {
"artistan/workbench": "*"
},
安装
一旦更新了你的 composer 配置,运行 composer install 下载依赖项。
在 app/config/app.php 中的 providers 数组中添加 ServiceProvider
'providers' => array(
'Artistan\Workbench\WorkbenchServiceProvider',
)
Finally, publish the configuration files via `php artisan config:publish artistan/workbench`.
配置
一旦发布了配置文件,你可以在 app/config/packages/artistan/workbench/config.php 文件中添加你的工作台包选项。
/*
* config for commands workbench:*
*/
'packages'=>[
'vendor/package'=>[
'git'=>'git@github.com:vendor/devPackage.git',
'remotes'=>[
'upstream'=>'git@github.com:vendor/masterPackage.git',
'upstream2'=>'git@github.com:vendor/masterPackage.git',
]
],
]
用法
命令行界面
php artisan workbench:install
OPTIONS:
-d : destroy workbench directory and start over from scratch
-u : fetch the remote repositories
-m{string} : merge {remote name} with this branch locally
-c : skip composer install/update
-b : skip bower install
-p : skip publishing assets and configs
详细信息
-
更新存储权限
-
获取包配置 ** de
$this->benchhelper->chStorage(); $packages = \Config::get('workbench::packages'); if($this->option('destroy')){ if ($this->confirm('Are you sure you want to remove all current workbench packages? [yes|no]')) { $this->benchhelper->destroy(); } } foreach($packages as $name=>$package){ echo "PACKAGE: $name\n"; if(isset($package['git'])){ $this->benchhelper->mkdir($name); $action = $this->benchhelper->getGit($name,$package); if($this->option('upstream')){ echo "upstream\n"; $this->benchhelper->getUpstream($name,$package,$this->option('merge')); } if(!$this->option('skipBower')){ $this->benchhelper->bower($name); } if(!$this->option('skipComposer')){ $this->benchhelper->composer($name,$action); } if(!$this->option('skipAssets')){ $this->call('asset:publish', array('--bench' => $name)); } if($this->option('publishConfigs') || $action=='install'){ // this should not be done all the time, first time only (install) $this->call('config:publish', array('argument' => $name, '--path' => 'workbench/'.$name.'/src/config')); } } echo "============================\n\n\n"; } if(!$this->option('skipBower')){ $this->benchhelper->bower(); } if(!$this->option('skipComposer')){ $this->benchhelper->composer(); // remove any packages from vendors directory that you are workbenching $this->benchhelper->composerVendorCleanup(array_keys($packages)); } //$this->call('command:name', array('argument' => 'foo', '--option' => 'bar'));