-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 73db6b0
Showing
166 changed files
with
38,510 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
vendor/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<p align="center"> | ||
<img src="" align="center" alt="logo" title="Themeboot logo" alt="Themeboot Logo" width="160"> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="//packagist.org/packages/zaghadon/themeboot"> | ||
<img src="https://poser.pugx.org/zaghadon/themeboot/v" alt="Latest Stable Version" title="Latest Stable Version"> | ||
</a> | ||
<a href="//packagist.org/packages/zaghadon/themeboot"> | ||
<img src="https://poser.pugx.org/zaghadon/themeboot/downloads" alt="Total Downloads" title="Total Downloads"> | ||
</a> | ||
<a href="//packagist.org/packages/zaghadon/themeboot"> | ||
<img src="https://poser.pugx.org/zaghadon/themeboot/license" alt="License" title="License"> | ||
</a> | ||
<h1 align="center"> | ||
Themeboot CLI | ||
</h1> | ||
</p> | ||
<br> | ||
|
||
# themeboot | ||
|
||
[Themeboot](https://github.com/zaghadon/themeboot) is A Free and OpenSource Lightweight CLI app to bootstrap WordPress Theme Development created by @zaghadon. | ||
This repository is the official repository for `themeboot`. | ||
|
||
### Why themeboot | ||
|
||
Me self no know ooh, but as e be, if you use it and you like it eh, Just send me your project link let me list it on the `Created with` section and why you enjoyed it so I can update this section too please. Thank you <3 | ||
|
||
## Getting Started | ||
|
||
You'll need `php-cli`, [Composer](https://getcomposer.org/) and A local [WordPress](https://wordpress.org) installation to get started. | ||
|
||
Simple Installation: | ||
Make sure to place Composer's system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system. This directory exists in different locations based on your operating system; however, some common locations include: | ||
|
||
macOS: $HOME/.composer/vendor/bin | ||
Windows: %USERPROFILE%\AppData\Roaming\Composer\vendor\bin | ||
GNU / Linux Distributions: $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin | ||
|
||
You could also find the composer's global installation path by running composer global about and looking up from the first line. | ||
|
||
Run `composer global require zaghadon/themeboot` to install Themeboot Globally in your computer. | ||
Run `themeboot` to verify successful installation. | ||
|
||
Another Way is to clone the project directly to your computer. Change Directory to the cloned project, Install composer dependency and allow the post installation cmd script to export the Shell Script to your local environment PATH to enable global access. | ||
|
||
Run `git clone https://github.com/zaghadon/themeboot.git` | ||
Run `cd themeboot` | ||
Run `composer install` | ||
|
||
If the post install script didn't run successfully, you can manually install it globally by: | ||
- Windows : Adding the path to `themeboot` to system PATH variable. | ||
-Linux : Run `sudo ln -s /usr/local/bin/themeboot /path/to/themeboot` replacing path to with your themeboot installation location. This would create a symlink between your local global bin folder and themeboot executable binary. | ||
|
||
Run `themeboot` to verify successful installation. | ||
|
||
Simple Usage: | ||
|
||
Change Directory to the theme Folder of your wordpress installation. | ||
`cd **/wp-content/themes/` | ||
Initialize new theme development with themeboot | ||
`themeboot init` | ||
|
||
|
||
## Contributing | ||
|
||
Contributions are very welcome! You can contribute with code, documentation, filing issues... | ||
|
||
## Credits | ||
|
||
* WP Theme Scaffold created by @krafthaus_ is based on Underscores http://krafthaus.co.id/, (C) 2012-2016 Automattic, Inc. | ||
Underscores is distributed under the terms of the GNU GPL v2 or later. | ||
|
||
* [Minicli](https://github.com/zaghadon/themeboot) is an experimental dependency-free toolkit for building CLI-centric applications in PHP. | ||
Minicli was created as [an educational experiment](https://dev.to/erikaheidi/bootstrapping-a-cli-php-application-in-vanilla-php-4ee) and a way to go dependency-free when building simple command-line applications in PHP. It can be used for microservices, personal dev tools, bots and little fun things. | ||
|
||
## Created with Themeboot | ||
|
||
- [Themester](https://github.com/zaghadon/themester) - a Multipurpose WordPress Theme for building beautiful dynamic websites (Under Development). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Command; | ||
|
||
use Minicli\Command\CommandController; | ||
|
||
class BaseController extends CommandController | ||
{ | ||
public function handle() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Command\Help; | ||
|
||
use Minicli\App; | ||
use Minicli\Command\CommandController; | ||
|
||
class DefaultController extends CommandController | ||
{ | ||
/** @var array */ | ||
protected $command_map = []; | ||
|
||
public function boot(App $app) | ||
{ | ||
parent::boot($app); | ||
$this->command_map = $app->command_registry->getCommandMap(); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$this->getPrinter()->info('Available Commands'); | ||
|
||
foreach ($this->command_map as $command => $sub) { | ||
|
||
$this->getPrinter()->newline(); | ||
$this->getPrinter()->out($command, 'info_alt'); | ||
|
||
if (is_array($sub)) { | ||
foreach ($sub as $subcommand) { | ||
if ($subcommand !== 'default') { | ||
$this->getPrinter()->newline(); | ||
$this->getPrinter()->out(sprintf('%s%s','└──', $subcommand)); | ||
} | ||
} | ||
} | ||
$this->getPrinter()->newline(); | ||
} | ||
|
||
$this->getPrinter()->newline(); | ||
$this->getPrinter()->newline(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Command\Help; | ||
|
||
use Minicli\Command\CommandController; | ||
use Minicli\Output\Filter\ColorOutputFilter; | ||
use Minicli\Output\Helper\TableHelper; | ||
|
||
class TableController extends CommandController | ||
{ | ||
public function handle() | ||
{ | ||
$this->getPrinter()->display('Testing Tables'); | ||
|
||
$table = new TableHelper(); | ||
$table->addHeader(['Header 1', 'Header 2', 'Header 3']); | ||
|
||
for($i = 1; $i <= 10; $i++) { | ||
$table->addRow([$i, rand(0, 10), "other string $i"]); | ||
} | ||
|
||
$this->getPrinter()->newline(); | ||
$this->getPrinter()->rawOutput($table->getFormattedTable(new ColorOutputFilter())); | ||
$this->getPrinter()->newline(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Command\Help; | ||
|
||
use Minicli\Command\CommandController; | ||
|
||
class TestController extends CommandController | ||
{ | ||
public function handle() | ||
{ | ||
$name = $this->hasParam('user') ? $this->getParam('user') : 'World'; | ||
$this->getPrinter()->display(sprintf("Hello, %s!", $name)); | ||
|
||
print_r($this->getParams()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
|
||
namespace App\Command\Init; | ||
|
||
use Minicli\Command\CommandController; | ||
use Minicli\Input; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
class DefaultController extends CommandController | ||
{ | ||
public function handle() | ||
{ | ||
$this->getPrinter()->info('Initializing New WordPress Theme Scafffold'); | ||
$this->getPrinter()->info('Provide the projects details to begin'); | ||
|
||
$title = (new Input('What is the Theme Title?: '))->read(); | ||
$this->getPrinter()->newline(); | ||
$titleurl = (new Input('What is the Theme URI?: '))->read(); | ||
$this->getPrinter()->newline(); | ||
$description = (new Input('Theme Description?: '))->read(); | ||
$this->getPrinter()->newline(); | ||
$author = (new Input('What is the name of the Author?: '))->read(); | ||
$this->getPrinter()->newline(); | ||
$authorurl = (new Input('What is the Author URI?: '))->read(); | ||
$this->getPrinter()->newline(); | ||
$textdomain = (new Input('Text Domain (Slug)?: '))->read(); | ||
$this->getPrinter()->newline(); | ||
$tags = (new Input('Tags (seperated by comma)?: '))->read(); | ||
|
||
$this->getPrinter()->display('Details Stored Successfully'); | ||
$this->getPrinter()->display('Preparing to copy files'); | ||
|
||
$themeDir = '.'; | ||
if ($this->hasParam('themeDir')) { | ||
$themeDir = './' . $this->getParam('themeDir'); | ||
} | ||
|
||
$filesystem = new Filesystem(); | ||
$filesystem->mirror(__DIR__ . '/../../Stubs/theme-scaffold', $themeDir); | ||
$this->getPrinter()->display('Files Copied Successfully'); | ||
|
||
$cssorigin = $themeDir . '/style.css'; | ||
$details = ['title'=>$title,'themeuri'=>$titleurl,'author'=>$author,'authoruri'=>$authorurl,'description'=>$description,'text-domain'=>$textdomain,'tags'=>$tags]; | ||
$this->prepend($this->prepDetails($details),$cssorigin); | ||
$this->getPrinter()->success('Theme Scaffold initialized Successfully. Go to your WP Admin Dashboard and Install theme. Enjoy Development'); | ||
|
||
$this->getPrinter()->newline(); | ||
} | ||
|
||
public function prepend($string, $orig_filename) | ||
{ | ||
$context = stream_context_create(); | ||
$orig_file = fopen($orig_filename, 'r', 1, $context); | ||
|
||
$temp_filename = tempnam(sys_get_temp_dir(), 'php_prepend_'); | ||
file_put_contents($temp_filename, $string); | ||
file_put_contents($temp_filename, $orig_file, FILE_APPEND); | ||
|
||
fclose($orig_file); | ||
unlink($orig_filename); | ||
rename($temp_filename, $orig_filename); | ||
} | ||
|
||
public function prepDetails(array $details) | ||
{ | ||
$themeDetails = <<<EOD | ||
/* | ||
Theme Name: {$details['title']} | ||
Theme URI: {$details['themeuri']} | ||
Author: {$details['author']} | ||
Author URI: {$details['authoruri']} | ||
Description: Custom theme: {$details['description']} | ||
Version: 1.0.0 | ||
License: GNU General Public License v2 or later | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
Text Domain: {$details['text-domain']} | ||
Tags: {$details['tags']} | ||
This theme, like WordPress, is licensed under the GPL. | ||
Use it to make something cool, have fun, and share what you've learned with others. | ||
WP Theme Scaffold is based on Underscores http://krafthaus.co.id/, (C) 2012-2016 Automattic, Inc. | ||
Underscores is distributed under the terms of the GNU GPL v2 or later. | ||
Normalizing styles have been helped along thanks to the fine work of | ||
Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/ | ||
*/ | ||
/*-------------------------------------------------------------- | ||
>>> TABLE OF CONTENTS: | ||
---------------------------------------------------------------- | ||
# Normalize | ||
# Typography | ||
# Elements | ||
# Forms | ||
# Navigation | ||
## Links | ||
## Menus | ||
# Accessibility | ||
# Alignments | ||
# Clearings | ||
# Widgets | ||
# Content | ||
## Posts and pages | ||
## Comments | ||
# Infinite scroll | ||
# Media | ||
## Captions | ||
## Galleries | ||
--------------------------------------------------------------*/ | ||
/*-------------------------------------------------------------- | ||
# Normalize | ||
--------------------------------------------------------------*/ | ||
EOD; | ||
return $themeDetails; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\ComposerScripts\Installer; | ||
|
||
|
||
class Installer{ | ||
static public function Install(){ | ||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { | ||
exec('pathman /au '. __DIR__.'/../../themeboot'); | ||
} else { | ||
shell_exec('sudo ln -s /usr/local/bin/themeboot '. __DIR__.'/../../themeboot'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory" : "src/vendors" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# wp-theme-scaffold | ||
template theme to developer create advance themplate |
Oops, something went wrong.