Skip to content

Commit

Permalink
Use relative path (#33)
Browse files Browse the repository at this point in the history
* [generate:settings:page] New Command

* Use relative path in plugin and theme command
  • Loading branch information
hjuarez20 authored and enzolutions committed Dec 20, 2017
1 parent a9952d1 commit c2eb4df
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/Command/Generate/PluginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use WP\Console\Utils\Site;
use Webmozart\PathUtil\Path;


class PluginCommand extends Command
{
use ConfirmationTrait;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function renderFile(
$flag = null
) {
if (!is_dir(dirname($target))) {
if(!mkdir(dirname($target), 0777, true)){
if (!mkdir(dirname($target), 0777, true)) {
throw new \InvalidArgumentException(
sprintf(
'Path "%s" is invalid. You need to provide a valid path.',
Expand Down
16 changes: 8 additions & 8 deletions src/Generator/PluginGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
class PluginGenerator extends Generator
{
/**
* @param Site $site
* @param string $plugin
* @param string $machineName
* @param string $dir
* @param string $description
* @param string $author
* @param string $authorUrl
* @param Site $site
* @param string $plugin
* @param string $machineName
* @param string $dir
* @param string $description
* @param string $author
* @param string $authorUrl
* @param boolean $test
*/
public function generate(
Expand Down Expand Up @@ -117,7 +117,7 @@ public function generate(
);
}

if($uninstall) {
if ($uninstall) {
$this->renderFile(
'plugin/uninstall.php.twig',
$dir. '/uninstall.php',
Expand Down
18 changes: 9 additions & 9 deletions src/Generator/ThemeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
class ThemeGenerator extends Generator
{
/**
* @param Site $site
* @param string $Theme
* @param string $machineName
* @param string $dir
* @param string $description
* @param string $author
* @param string $authorUrl
* @param array $template_files
* @param string $screenshot
* @param Site $site
* @param string $Theme
* @param string $machineName
* @param string $dir
* @param string $description
* @param string $author
* @param string $authorUrl
* @param array $template_files
* @param string $screenshot
* @param boolean $test
*/
public function generate(
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ public function validateMachineName($machine_name)

public function validatePluginPath($pluginPath, $create = false)
{

if (strlen($pluginPath) > 1 && $pluginPath[strlen($pluginPath)-1] == "/") {
$pluginPath = substr($pluginPath, 0, -1);
}

if (is_dir($pluginPath)) {
return $pluginPath;
}
Expand Down

0 comments on commit c2eb4df

Please sign in to comment.