Skip to content

Commit

Permalink
🚚 Rename the package to acorn-prettify
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Dec 29, 2023
1 parent ff461e5 commit ba4f0c8
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 73 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Acorn Pretty
# Acorn Prettify

![Latest Stable Version](https://img.shields.io/packagist/v/roots/acorn-pretty.svg?style=flat-square)
![Total Downloads](https://img.shields.io/packagist/dt/roots/acorn-pretty.svg?style=flat-square)
![Build Status](https://img.shields.io/github/actions/workflow/status/roots/acorn-pretty/main.yml?branch=main&style=flat-square)
![Latest Stable Version](https://img.shields.io/packagist/v/roots/acorn-prettify.svg?style=flat-square)
![Total Downloads](https://img.shields.io/packagist/dt/roots/acorn-prettify.svg?style=flat-square)
![Build Status](https://img.shields.io/github/actions/workflow/status/roots/acorn-prettify/main.yml?branch=main&style=flat-square)

Acorn Pretty contains a collection of modules to apply theme-agnostic front-end modifications to your Acorn-powered WordPress sites.
Acorn Prettify contains a collection of modules to apply theme-agnostic front-end modifications to your Acorn-powered WordPress sites.

## Requirements

Expand All @@ -16,31 +16,31 @@ Acorn Pretty contains a collection of modules to apply theme-agnostic front-end
Install via Composer:

```sh
$ composer require roots/acorn-pretty
$ composer require roots/acorn-prettify
```

## Getting Started

Start by publishing the package configuration:

```sh
$ php artisan vendor:publish --tag=acorn-pretty-config
$ php artisan vendor:publish --tag=acorn-prettify-config
```

Review the published config file to get an understanding of the optimizations that Acorn Pretty has enabled out of the box.
Review the published config file to get an understanding of the optimizations that Acorn Prettify has enabled out of the box.

## Usage

Acorn Pretty immediately begins working with a sane set of defaults once installed in your Acorn project.
Acorn Prettify immediately begins working with a sane set of defaults once installed in your Acorn project.

## Bug Reports

If you discover a bug in Acorn Pretty, please [open an issue](https://github.com/roots/acorn-pretty/issues).
If you discover a bug in Acorn Prettify, please [open an issue](https://github.com/roots/acorn-prettify/issues).

## Contributing

Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

## License

Acorn Pretty is provided under the [MIT License](LICENSE.md).
Acorn Prettify is provided under the [MIT License](LICENSE.md).
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "roots/acorn-pretty",
"name": "roots/acorn-prettify",
"type": "package",
"description": "Theme-agnostic front-end modifications for WordPress",
"license": "MIT",
Expand All @@ -22,7 +22,7 @@
],
"autoload": {
"psr-4": {
"Roots\\AcornPretty\\": "src/"
"Roots\\AcornPrettify\\": "src/"
}
},
"require": {
Expand All @@ -34,7 +34,7 @@
"extra": {
"acorn": {
"providers": [
"Roots\\AcornPretty\\AcornPrettyServiceProvider"
"Roots\\AcornPrettify\\AcornPrettifyServiceProvider"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
20 changes: 14 additions & 6 deletions src/AcornPretty.php → src/AcornPrettify.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Roots\AcornPretty;
namespace Roots\AcornPrettify;

use Illuminate\Support\Collection;
use Roots\Acorn\Application;
use Roots\AcornPretty\Modules\AbstractModule;
use Roots\AcornPrettify\Modules\AbstractModule;

class AcornPretty
class AcornPrettify
{
/**
* The Application instance.
Expand All @@ -19,7 +19,7 @@ class AcornPretty
protected Collection $config;

/**
* The Acorn Pretty modules.
* The Acorn Prettify modules.
*/
protected array $modules = [
Modules\CleanUpModule::class,
Expand All @@ -28,20 +28,28 @@ class AcornPretty
];

/**
* Create a new Acorn Pretty instance.
* Create a new Acorn Prettify instance.
*
* @return void
*/
public function __construct(Application $app)
{
$this->app = $app;
$this->config = collect(
$this->app->config->get('pretty')
$this->app->config->get('prettify', [])
)->map(fn ($value) => collect($value));

add_filter('init', fn () => collect($this->modules)
->reject(fn ($module) => $module instanceof AbstractModule)
->each(fn ($module) => $module::make($this->app, $this->config))
);
}

/**
* Make a new instance of the Acorn Prettify.
*/
public static function make(Application $app): self
{
return new static($app);
}
}
34 changes: 34 additions & 0 deletions src/AcornPrettifyServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Roots\AcornPrettify;

use Illuminate\Support\ServiceProvider;

class AcornPrettifyServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/prettify.php', 'prettify');

$this->app->singleton('Roots\AcornPrettify', fn () => AcornPrettify::make($this->app));
}

/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/../config/prettify.php' => $this->app->configPath('prettify.php'),
], 'prettify-config');

$this->app->make('Roots\AcornPrettify');
}
}
36 changes: 0 additions & 36 deletions src/AcornPrettyServiceProvider.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Contracts/Module.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Roots\AcornPretty\Contracts;
namespace Roots\AcornPrettify\Contracts;

interface Module
{
Expand Down
2 changes: 1 addition & 1 deletion src/Document.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Roots\AcornPretty;
namespace Roots\AcornPrettify;

use DOMDocument;
use DOMNodeList;
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/AbstractModule.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Roots\AcornPretty\Modules;
namespace Roots\AcornPrettify\Modules;

use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Roots\Acorn\Application;
use Roots\AcornPretty\Contracts\Module;
use Roots\AcornPrettify\Contracts\Module;

abstract class AbstractModule implements Module
{
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/CleanUpModule.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Roots\AcornPretty\Modules;
namespace Roots\AcornPrettify\Modules;

use Illuminate\Support\Str;
use Roots\AcornPretty\Document;
use Roots\AcornPrettify\Document;

class CleanUpModule extends AbstractModule
{
Expand Down
18 changes: 9 additions & 9 deletions src/Modules/NiceSearchModule.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Roots\AcornPretty\Modules;
namespace Roots\AcornPrettify\Modules;

class NiceSearchModule extends AbstractModule
{
/**
* The default search endpoint.
* The seach query string.
*/
protected string $defaultEndpoint = '/?s=';
protected string $query = '/?s=';

/**
* The pretty search endpoint.
* The search slug.
*/
protected string $prettyEndpoint = '/search/';
protected string $slug = '/search/';

/**
* Handle the module.
Expand All @@ -29,7 +29,7 @@ public function handle(): void
}

/**
* Redirect query string search results to the pretty URL.
* Redirect query string search results to the search slug.
*/
protected function handleRedirect(): self
{
Expand Down Expand Up @@ -80,13 +80,13 @@ protected function handleYoastSeo(): self
}

/**
* Rewrite the search query string to a pretty URL.
* Rewrite the search query string to a slug.
*/
public function rewriteUrl(string $url): string
{
return str_replace(
$this->defaultEndpoint,
$this->prettyEndpoint,
$this->query,
$this->slug,
$url
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/RelativeUrlsModule.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Roots\AcornPretty\Modules;
namespace Roots\AcornPrettify\Modules;

use Illuminate\Support\Str;

Expand Down

0 comments on commit ba4f0c8

Please sign in to comment.