Skip to content

Commit 73db6b0

Browse files
committed
first commit
0 parents  commit 73db6b0

File tree

166 files changed

+38510
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+38510
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
vendor/

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<p align="center">
2+
<img src="" align="center" alt="logo" title="Themeboot logo" alt="Themeboot Logo" width="160">
3+
</p>
4+
5+
<p align="center">
6+
<a href="//packagist.org/packages/zaghadon/themeboot">
7+
<img src="https://poser.pugx.org/zaghadon/themeboot/v" alt="Latest Stable Version" title="Latest Stable Version">
8+
</a>
9+
<a href="//packagist.org/packages/zaghadon/themeboot">
10+
<img src="https://poser.pugx.org/zaghadon/themeboot/downloads" alt="Total Downloads" title="Total Downloads">
11+
</a>
12+
<a href="//packagist.org/packages/zaghadon/themeboot">
13+
<img src="https://poser.pugx.org/zaghadon/themeboot/license" alt="License" title="License">
14+
</a>
15+
<h1 align="center">
16+
Themeboot CLI
17+
</h1>
18+
</p>
19+
<br>
20+
21+
# themeboot
22+
23+
[Themeboot](https://github.com/zaghadon/themeboot) is A Free and OpenSource Lightweight CLI app to bootstrap WordPress Theme Development created by @zaghadon.
24+
This repository is the official repository for `themeboot`.
25+
26+
### Why themeboot
27+
28+
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
29+
30+
## Getting Started
31+
32+
You'll need `php-cli`, [Composer](https://getcomposer.org/) and A local [WordPress](https://wordpress.org) installation to get started.
33+
34+
Simple Installation:
35+
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:
36+
37+
macOS: $HOME/.composer/vendor/bin
38+
Windows: %USERPROFILE%\AppData\Roaming\Composer\vendor\bin
39+
GNU / Linux Distributions: $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin
40+
41+
You could also find the composer's global installation path by running composer global about and looking up from the first line.
42+
43+
Run `composer global require zaghadon/themeboot` to install Themeboot Globally in your computer.
44+
Run `themeboot` to verify successful installation.
45+
46+
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.
47+
48+
Run `git clone https://github.com/zaghadon/themeboot.git`
49+
Run `cd themeboot`
50+
Run `composer install`
51+
52+
If the post install script didn't run successfully, you can manually install it globally by:
53+
- Windows : Adding the path to `themeboot` to system PATH variable.
54+
-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.
55+
56+
Run `themeboot` to verify successful installation.
57+
58+
Simple Usage:
59+
60+
Change Directory to the theme Folder of your wordpress installation.
61+
`cd **/wp-content/themes/`
62+
Initialize new theme development with themeboot
63+
`themeboot init`
64+
65+
66+
## Contributing
67+
68+
Contributions are very welcome! You can contribute with code, documentation, filing issues...
69+
70+
## Credits
71+
72+
* WP Theme Scaffold created by @krafthaus_ is based on Underscores http://krafthaus.co.id/, (C) 2012-2016 Automattic, Inc.
73+
Underscores is distributed under the terms of the GNU GPL v2 or later.
74+
75+
* [Minicli](https://github.com/zaghadon/themeboot) is an experimental dependency-free toolkit for building CLI-centric applications in PHP.
76+
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.
77+
78+
## Created with Themeboot
79+
80+
- [Themester](https://github.com/zaghadon/themester) - a Multipurpose WordPress Theme for building beautiful dynamic websites (Under Development).

app/.gitkeep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

app/Command/BaseController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Command;
4+
5+
use Minicli\Command\CommandController;
6+
7+
class BaseController extends CommandController
8+
{
9+
public function handle()
10+
{
11+
12+
}
13+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Command\Help;
4+
5+
use Minicli\App;
6+
use Minicli\Command\CommandController;
7+
8+
class DefaultController extends CommandController
9+
{
10+
/** @var array */
11+
protected $command_map = [];
12+
13+
public function boot(App $app)
14+
{
15+
parent::boot($app);
16+
$this->command_map = $app->command_registry->getCommandMap();
17+
}
18+
19+
public function handle()
20+
{
21+
$this->getPrinter()->info('Available Commands');
22+
23+
foreach ($this->command_map as $command => $sub) {
24+
25+
$this->getPrinter()->newline();
26+
$this->getPrinter()->out($command, 'info_alt');
27+
28+
if (is_array($sub)) {
29+
foreach ($sub as $subcommand) {
30+
if ($subcommand !== 'default') {
31+
$this->getPrinter()->newline();
32+
$this->getPrinter()->out(sprintf('%s%s','└──', $subcommand));
33+
}
34+
}
35+
}
36+
$this->getPrinter()->newline();
37+
}
38+
39+
$this->getPrinter()->newline();
40+
$this->getPrinter()->newline();
41+
}
42+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Command\Help;
4+
5+
use Minicli\Command\CommandController;
6+
use Minicli\Output\Filter\ColorOutputFilter;
7+
use Minicli\Output\Helper\TableHelper;
8+
9+
class TableController extends CommandController
10+
{
11+
public function handle()
12+
{
13+
$this->getPrinter()->display('Testing Tables');
14+
15+
$table = new TableHelper();
16+
$table->addHeader(['Header 1', 'Header 2', 'Header 3']);
17+
18+
for($i = 1; $i <= 10; $i++) {
19+
$table->addRow([$i, rand(0, 10), "other string $i"]);
20+
}
21+
22+
$this->getPrinter()->newline();
23+
$this->getPrinter()->rawOutput($table->getFormattedTable(new ColorOutputFilter()));
24+
$this->getPrinter()->newline();
25+
}
26+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace App\Command\Help;
4+
5+
use Minicli\Command\CommandController;
6+
7+
class TestController extends CommandController
8+
{
9+
public function handle()
10+
{
11+
$name = $this->hasParam('user') ? $this->getParam('user') : 'World';
12+
$this->getPrinter()->display(sprintf("Hello, %s!", $name));
13+
14+
print_r($this->getParams());
15+
}
16+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?php
2+
3+
namespace App\Command\Init;
4+
5+
use Minicli\Command\CommandController;
6+
use Minicli\Input;
7+
use Symfony\Component\Filesystem\Filesystem;
8+
9+
class DefaultController extends CommandController
10+
{
11+
public function handle()
12+
{
13+
$this->getPrinter()->info('Initializing New WordPress Theme Scafffold');
14+
$this->getPrinter()->info('Provide the projects details to begin');
15+
16+
$title = (new Input('What is the Theme Title?: '))->read();
17+
$this->getPrinter()->newline();
18+
$titleurl = (new Input('What is the Theme URI?: '))->read();
19+
$this->getPrinter()->newline();
20+
$description = (new Input('Theme Description?: '))->read();
21+
$this->getPrinter()->newline();
22+
$author = (new Input('What is the name of the Author?: '))->read();
23+
$this->getPrinter()->newline();
24+
$authorurl = (new Input('What is the Author URI?: '))->read();
25+
$this->getPrinter()->newline();
26+
$textdomain = (new Input('Text Domain (Slug)?: '))->read();
27+
$this->getPrinter()->newline();
28+
$tags = (new Input('Tags (seperated by comma)?: '))->read();
29+
30+
$this->getPrinter()->display('Details Stored Successfully');
31+
$this->getPrinter()->display('Preparing to copy files');
32+
33+
$themeDir = '.';
34+
if ($this->hasParam('themeDir')) {
35+
$themeDir = './' . $this->getParam('themeDir');
36+
}
37+
38+
$filesystem = new Filesystem();
39+
$filesystem->mirror(__DIR__ . '/../../Stubs/theme-scaffold', $themeDir);
40+
$this->getPrinter()->display('Files Copied Successfully');
41+
42+
$cssorigin = $themeDir . '/style.css';
43+
$details = ['title'=>$title,'themeuri'=>$titleurl,'author'=>$author,'authoruri'=>$authorurl,'description'=>$description,'text-domain'=>$textdomain,'tags'=>$tags];
44+
$this->prepend($this->prepDetails($details),$cssorigin);
45+
$this->getPrinter()->success('Theme Scaffold initialized Successfully. Go to your WP Admin Dashboard and Install theme. Enjoy Development');
46+
47+
$this->getPrinter()->newline();
48+
}
49+
50+
public function prepend($string, $orig_filename)
51+
{
52+
$context = stream_context_create();
53+
$orig_file = fopen($orig_filename, 'r', 1, $context);
54+
55+
$temp_filename = tempnam(sys_get_temp_dir(), 'php_prepend_');
56+
file_put_contents($temp_filename, $string);
57+
file_put_contents($temp_filename, $orig_file, FILE_APPEND);
58+
59+
fclose($orig_file);
60+
unlink($orig_filename);
61+
rename($temp_filename, $orig_filename);
62+
}
63+
64+
public function prepDetails(array $details)
65+
{
66+
$themeDetails = <<<EOD
67+
/*
68+
Theme Name: {$details['title']}
69+
Theme URI: {$details['themeuri']}
70+
Author: {$details['author']}
71+
Author URI: {$details['authoruri']}
72+
Description: Custom theme: {$details['description']}
73+
Version: 1.0.0
74+
License: GNU General Public License v2 or later
75+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
76+
Text Domain: {$details['text-domain']}
77+
Tags: {$details['tags']}
78+
79+
This theme, like WordPress, is licensed under the GPL.
80+
Use it to make something cool, have fun, and share what you've learned with others.
81+
82+
WP Theme Scaffold is based on Underscores http://krafthaus.co.id/, (C) 2012-2016 Automattic, Inc.
83+
Underscores is distributed under the terms of the GNU GPL v2 or later.
84+
85+
Normalizing styles have been helped along thanks to the fine work of
86+
Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/
87+
*/
88+
89+
/*--------------------------------------------------------------
90+
>>> TABLE OF CONTENTS:
91+
----------------------------------------------------------------
92+
# Normalize
93+
# Typography
94+
# Elements
95+
# Forms
96+
# Navigation
97+
## Links
98+
## Menus
99+
# Accessibility
100+
# Alignments
101+
# Clearings
102+
# Widgets
103+
# Content
104+
## Posts and pages
105+
## Comments
106+
# Infinite scroll
107+
# Media
108+
## Captions
109+
## Galleries
110+
--------------------------------------------------------------*/
111+
112+
/*--------------------------------------------------------------
113+
# Normalize
114+
--------------------------------------------------------------*/
115+
EOD;
116+
return $themeDetails;
117+
}
118+
}

app/ComposerScripts/GInstaller.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace App\ComposerScripts\Installer;
4+
5+
6+
class Installer{
7+
static public function Install(){
8+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
9+
exec('pathman /au '. __DIR__.'/../../themeboot');
10+
} else {
11+
shell_exec('sudo ln -s /usr/local/bin/themeboot '. __DIR__.'/../../themeboot');
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)