update command
parent
fb88053b95
commit
5a3afa371f
|
|
@ -14,8 +14,8 @@ class ExtensionMakeCommand extends Command
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'admin:ext-make
|
protected $signature = 'admin:ext-make
|
||||||
{name : The name of the extension. Eg: author-name/extension-name}
|
{name : The name of the extension. Eg: author-name/extension-name}
|
||||||
{--namespace= : The namespace of the extension.}
|
{--namespace= : The namespace of the extension.}
|
||||||
{--theme}
|
{--theme}
|
||||||
';
|
';
|
||||||
|
|
@ -97,11 +97,12 @@ class ExtensionMakeCommand extends Command
|
||||||
if (! file_exists($this->extensionDir)) {
|
if (! file_exists($this->extensionDir)) {
|
||||||
$this->makeDir();
|
$this->makeDir();
|
||||||
}
|
}
|
||||||
|
$name = $this->argument('name');
|
||||||
|
|
||||||
$this->package = str_replace('.', '/', $this->argument('name'));
|
$this->package = str_replace('.', '/', 'Peidikeji/'.ucfirst($name));
|
||||||
$this->extensionName = str_replace('/', '.', $this->package);
|
$this->extensionName = str_replace('/', '.', $this->package);
|
||||||
|
|
||||||
$this->basePath = rtrim($this->extensionDir, '/').'/'.ltrim($this->package, '/');
|
$this->basePath = rtrim($this->extensionDir, '/').'/'.ltrim(strtolower($name), '/');
|
||||||
|
|
||||||
if (is_dir($this->basePath)) {
|
if (is_dir($this->basePath)) {
|
||||||
return $this->error(sprintf('The extension [%s] already exists!', $this->package));
|
return $this->error(sprintf('The extension [%s] already exists!', $this->package));
|
||||||
|
|
@ -188,7 +189,7 @@ TREE;
|
||||||
// make composer.json
|
// make composer.json
|
||||||
$composerContents = str_replace(
|
$composerContents = str_replace(
|
||||||
['{package}', '{alias}', '{namespace}', '{className}'],
|
['{package}', '{alias}', '{namespace}', '{className}'],
|
||||||
[$this->package, '', str_replace('\\', '\\\\', $this->namespace).'\\\\', $this->className],
|
[strtolower($this->package), strtolower($this->className), str_replace('\\', '\\\\', $this->namespace).'\\\\', $this->className],
|
||||||
file_get_contents(__DIR__.'/stubs/extension/composer.json.stub')
|
file_get_contents(__DIR__.'/stubs/extension/composer.json.stub')
|
||||||
);
|
);
|
||||||
$this->putFile('composer.json', $composerContents);
|
$this->putFile('composer.json', $composerContents);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue