Skip to content

Commit bdd8393

Browse files
committed
Merge branch 'release/1.6.0'
2 parents ffdd3a1 + ffba8b9 commit bdd8393

24 files changed

+510
-48
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# v1.6.0
2+
## 12/28/2022
3+
4+
1. [](#new)
5+
* Added new "FlexObjects" basic plugin type [#77](https://github.com/getgrav/grav-plugin-devtools/pull/77)
6+
1. [](#improved)
7+
* Improvements for Tailwind CSS theme + AlpineJS [#74](https://github.com/getgrav/grav-plugin-devtools/pull/74)
8+
* Updated `languages.yaml` [#76](https://github.com/getgrav/grav-plugin-devtools/pull/76)
9+
* Updated links + default branch [#72](https://github.com/getgrav/grav-plugin-devtools/pull/72)
10+
1. [](#bugfix)
11+
* Various PSR Fixes [#71](https://github.com/getgrav/grav-plugin-devtools/pull/71)
12+
113
# v1.5.4
214
## 10/26/2021
315

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: DevTools
22
slug: devtools
33
type: plugin
4-
version: 1.5.4
4+
version: 1.6.0
55
description: Plugin and Theme scaffolding utilities
66
icon: cogs
77
author:

classes/DevToolsCommand.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ protected function createComponent(): bool
128128
if ($template === 'inheritance') {
129129
$parent_theme = $this->component['extends'];
130130
$yaml_file = $this->locator->findResource('themes://' . $parent_theme) . '/' . $parent_theme . '.yaml';
131-
$this->component['config'] = file_get_contents($yaml_file);;
131+
$this->component['config'] = file_get_contents($yaml_file);
132132
}
133133

134134
if (isset($source_theme)) {
@@ -156,8 +156,8 @@ protected function createComponent(): bool
156156
// Do some filename renaming
157157
$base_old_filename = $component_folder . '/' . $current_theme;
158158
$base_new_filename = $component_folder . '/' . $new_theme;
159-
@rename( $base_old_filename . '.php', $base_new_filename . '.php');
160-
@rename( $base_old_filename . '.yaml', $base_new_filename . '.yaml');
159+
@rename($base_old_filename . '.php', $base_new_filename . '.php');
160+
@rename($base_old_filename . '.yaml', $base_new_filename . '.yaml');
161161

162162
$camelized_current = $this->inflector::camelize($current_theme);
163163
$camelized_new = $this->inflector::camelize($name);
@@ -211,7 +211,6 @@ protected function createComponent(): bool
211211
}
212212

213213
echo $source_theme;
214-
215214
} else {
216215
/**
217216
* Use components folder and twig processing
@@ -233,7 +232,7 @@ protected function createComponent(): bool
233232
$templates = Folder::all($component_folder);
234233

235234
try {
236-
foreach($templates as $templateFile) {
235+
foreach ($templates as $templateFile) {
237236
if (Utils::endsWith($templateFile, '.twig') && !Utils::endsWith($templateFile, '.html.twig')) {
238237
$content = $this->twig->processTemplate($templateFile);
239238
$file = File::instance($component_folder . DS . str_replace('.twig', '', $templateFile));
@@ -259,6 +258,20 @@ protected function createComponent(): bool
259258
$bpname = $this->inflector::hyphenize($this->component['bpname']);
260259
rename($component_folder . DS . $type . '.yaml', $component_folder . DS . $bpname . '.yaml');
261260
}
261+
262+
if ($this->component['flex_name']) {
263+
$flex_classes_folder = $component_folder . DS . 'classes' . DS . 'Flex' . DS . 'Types';
264+
$flex_name = strtolower($this->inflector::underscorize($this->component['flex_name']));
265+
$flex_name_camel = $this->inflector::camelize($this->component['flex_name']);
266+
267+
rename($flex_classes_folder . DS . 'flex_name',$flex_classes_folder . DS . $flex_name_camel);
268+
269+
rename($flex_classes_folder . DS . $flex_name_camel . DS . 'Object' . '.php',$flex_classes_folder . DS . $flex_name_camel . DS . $flex_name_camel . 'Object' . '.php');
270+
rename($flex_classes_folder . DS . $flex_name_camel . DS . 'Collection' . '.php',$flex_classes_folder . DS . $flex_name_camel . DS . $flex_name_camel . 'Collection' . '.php');
271+
272+
rename($component_folder . DS . 'blueprints' . DS . 'flex-objects' . DS . $type . '.yaml', $component_folder . DS . 'blueprints' . DS . 'flex-objects' . DS . $flex_name . '.yaml');
273+
}
274+
262275
}
263276

264277
$this->output->writeln('');
@@ -318,13 +331,13 @@ protected function validate(string $type, $value)
318331
break;
319332

320333
case 'description':
321-
if($value === null || trim($value) === '') {
334+
if ($value === null || trim($value) === '') {
322335
throw new \RuntimeException('Description cannot be empty');
323336
}
324337

325338
break;
326339
case 'themename':
327-
if($value === null || trim($value) === '') {
340+
if ($value === null || trim($value) === '') {
328341
throw new \RuntimeException('Theme Name cannot be empty');
329342
}
330343

cli/NewPluginCommand.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Grav\Plugin\Console;
44

55
use Symfony\Component\Console\Input\InputOption;
6+
use Symfony\Component\Console\Question\ChoiceQuestion;
67
use Symfony\Component\Console\Question\Question;
78

89
require_once(__DIR__ . '/../classes/DevToolsCommand.php');
@@ -35,7 +36,7 @@ protected function configure(): void
3536
)
3637
->addOption(
3738
'dev',
38-
null,
39+
null,
3940
InputOption::VALUE_OPTIONAL,
4041
'The name/username of the developer'
4142
)
@@ -136,11 +137,32 @@ protected function serve(): int
136137
$this->component['author']['email'] = $io->askQuestion($question);
137138
}
138139

139-
$this->component['template'] = 'blank';
140+
$question = new ChoiceQuestion(
141+
'Please choose an option',
142+
['blank' => 'Basic Plugin',
143+
'flex' => 'Basic Plugin prepared for custom Flex Objects'
144+
]
145+
);
146+
$this->component['template'] = $io->askQuestion($question);
147+
148+
if ($this->component['template'] === 'flex') {
149+
150+
$question = new Question('Enter Flex Object Name');
151+
$question->setValidator(function ($value) {
152+
return $this->validate('name', $value);
153+
});
154+
$this->component['flex_name'] = $io->askQuestion($question);
155+
156+
$question = new ChoiceQuestion('Please choose a storage type', [
157+
'simple' => 'Basic Storage (1 file for all objects) - no media support',
158+
'file' => 'File Storage (1 file per object)',
159+
'folder' => 'Folder Storage (1 folder per object)'
160+
]);
161+
$this->component['flex_storage'] = $io->askQuestion($question);
162+
}
140163

141164
$this->createComponent();
142165

143166
return 0;
144167
}
145-
146168
}

components/plugin/blank/README.md.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@
55

66
**This README.md file should be modified to describe the features, installation, configuration, and general usage of the plugin.**
77

8-
The **{{ component_title }}** Plugin is an extension for [Grav CMS](http://github.com/getgrav/grav). {{ component.description }}
8+
The **{{ component_title }}** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). {{ component.description }}
99

1010
## Installation
1111

1212
Installing the {{ component_title }} plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.
1313

1414
### GPM Installation (Preferred)
1515

16-
To install the plugin via the [GPM](http://learn.getgrav.org/advanced/grav-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
16+
To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
1717

1818
bin/gpm install {{ component_hyphenated }}
1919

2020
This will install the {{ component_title }} plugin into your `/user/plugins`-directory within Grav. Its files can be found under `/your/site/grav/user/plugins/{{ component_hyphenated }}`.
2121

2222
### Manual Installation
2323

24-
To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
24+
To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](https://getgrav.org/downloads/plugins).
2525

2626
You should now have all the plugin files under
2727

2828
/your/site/grav/user/plugins/{{ component_hyphenated }}
2929

30-
> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/master/blueprints.yaml).
30+
> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/main/blueprints.yaml).
3131

3232
### Admin Plugin
3333

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# v0.1.0
2+
## {{ "now"|date("m/d/Y") }}
3+
4+
1. [](#new)
5+
* ChangeLog started...

components/plugin/flex/LICENSE.twig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

components/plugin/flex/README.md.twig

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{% set component_title = (component.name|titleize) %}
2+
{% set component_hyphenated = (component.name|hyphenize) %}
3+
{% set developer_hyphenated = (component.author.githubid|hyphenize) %}
4+
# {{ component_title }} Plugin
5+
6+
**This README.md file should be modified to describe the features, installation, configuration, and general usage of the plugin.**
7+
8+
The **{{ component_title }}** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). {{ component.description }}
9+
10+
## Installation
11+
12+
Installing the {{ component_title }} plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.
13+
14+
### GPM Installation (Preferred)
15+
16+
To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
17+
18+
bin/gpm install {{ component_hyphenated }}
19+
20+
This will install the {{ component_title }} plugin into your `/user/plugins`-directory within Grav. Its files can be found under `/your/site/grav/user/plugins/{{ component_hyphenated }}`.
21+
22+
### Manual Installation
23+
24+
To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](https://getgrav.org/downloads/plugins).
25+
26+
You should now have all the plugin files under
27+
28+
/your/site/grav/user/plugins/{{ component_hyphenated }}
29+
30+
> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/main/blueprints.yaml).
31+
32+
### Admin Plugin
33+
34+
If you use the Admin Plugin, you can install the plugin directly by browsing the `Plugins`-menu and clicking on the `Add` button.
35+
36+
## Configuration
37+
38+
Before configuring this plugin, you should copy the `user/plugins/{{ component_hyphenated }}/{{ component_hyphenated }}.yaml` to `user/config/plugins/{{ component_hyphenated }}.yaml` and only edit that copy.
39+
40+
Here is the default configuration and an explanation of available options:
41+
42+
```yaml
43+
enabled: true
44+
```
45+
46+
Note that if you use the Admin Plugin, a file with your configuration named {{component_hyphenated}}.yaml will be saved in the `user/config/plugins/`-folder once the configuration is saved in the Admin.
47+
48+
## Usage
49+
50+
**Describe how to use the plugin.**
51+
52+
## Credits
53+
54+
**Did you incorporate third-party code? Want to thank somebody?**
55+
56+
## To Do
57+
58+
- [ ] Future plans, if any
59+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{% set githubid = component.author.githubid ?: component.author.name|hyphenize -%}
2+
name: {{ component.name|titleize }}
3+
slug: {{ component.name|hyphenize }}
4+
type: plugin
5+
version: 0.1.0
6+
description: {{ component.description }}
7+
icon: plug
8+
author:
9+
name: {{ component.author.name }}
10+
email: {{ component.author.email }}
11+
homepage: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}
12+
demo: http://demo.yoursite.com
13+
keywords: grav, plugin, etc
14+
bugs: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}/issues
15+
docs: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}/blob/develop/README.md
16+
license: MIT
17+
18+
dependencies:
19+
- { name: grav, version: '>=1.6.0' }
20+
21+
form:
22+
validation: loose
23+
fields:
24+
enabled:
25+
type: toggle
26+
label: PLUGIN_ADMIN.PLUGIN_STATUS
27+
highlight: 1
28+
default: 0
29+
options:
30+
1: PLUGIN_ADMIN.ENABLED
31+
0: PLUGIN_ADMIN.DISABLED
32+
validate:
33+
type: bool
34+
text_var:
35+
type: text
36+
label: PLUGIN_{{ component.name|underscorize|upper }}.TEXT_VARIABLE
37+
help: PLUGIN_{{ component.name|underscorize|upper }}.TEXT_VARIABLE_HELP

0 commit comments

Comments
 (0)