Skip to content

Commit eaeabb6

Browse files
Statamic 5 Support (#164)
1 parent 3c21353 commit eaeabb6

File tree

7 files changed

+24
-71
lines changed

7 files changed

+24
-71
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
php: [8.0, 8.1, 8.2]
16-
laravel: [9.*, 10.*]
15+
php: [8.1, 8.2, 8.3]
16+
laravel: [10.*, 11.*]
1717
stability: [prefer-lowest, prefer-stable]
1818
os: [ubuntu-latest]
1919
include:
2020
- os: windows-latest
21-
php: 8.1
22-
laravel: 9.*
21+
php: 8.3
22+
laravel: 10.*
2323
stability: prefer-stable
2424
- os: windows-latest
25-
php: 8.1
26-
laravel: 10.*
25+
php: 8.3
26+
laravel: 11.*
2727
stability: prefer-stable
2828
exclude:
29-
- php: 8.0
30-
laravel: 10.*
29+
- php: 8.1
30+
laravel: 11.*
3131

3232
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
3333

@@ -52,7 +52,7 @@ jobs:
5252

5353
- name: Send Slack notification
5454
uses: 8398a7/action-slack@v2
55-
if: failure()
55+
if: failure() && github.event_name == 'schedule'
5656
with:
5757
status: ${{ job.status }}
5858
author_name: ${{ github.actor }}

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@
44
55
## Installation
66

7-
Install the package using Composer:
7+
You can install the Static Site Generator package with the following command:
88

99
```
10-
composer require statamic/ssg
10+
php please install:ssg
1111
```
1212

13-
If you want or need to customize the way the site is generated, you can do so by publishing and modifying the config file with the following command:
14-
15-
```
16-
php artisan vendor:publish --provider="Statamic\StaticSite\ServiceProvider"
17-
```
18-
19-
The config file will be in `config/statamic/ssg.php`. This is optional and you can do it anytime.
13+
The command will install the `statamic/ssg` package via Composer, optionally publish the configuration file and prompt you if you wish to install the `spatie/fork` package for running [multiple workers](#multiple-workers).
2014

2115

2216
## Usage
@@ -29,6 +23,7 @@ php please ssg:generate
2923

3024
Your site will be generated into a directory which you can deploy however you like. See [Deployment Examples](#deployment-examples) below for inspiration.
3125

26+
3227
### Multiple Workers
3328

3429
For improved performance, you may spread the page generation across multiple workers. This requires Spatie's [Fork](https://github.com/spatie/fork) package. Then you may specify how many workers are to be used. You can use as many workers as you have CPU cores.

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "statamic/ssg",
33
"type": "statamic-addon",
4-
"description": "Static site generator for Statamic 3.",
4+
"description": "Generate static sites with Statamic.",
55
"autoload": {
66
"psr-4": {
77
"Statamic\\StaticSite\\": "src"
@@ -15,7 +15,7 @@
1515
"extra": {
1616
"statamic": {
1717
"name": "Static Site Generator",
18-
"description": "Static Site Generator addon"
18+
"description": "Generate static sites with Statamic."
1919
},
2020
"laravel": {
2121
"providers": [
@@ -24,10 +24,10 @@
2424
}
2525
},
2626
"require": {
27-
"statamic/cms": "^4.0"
27+
"statamic/cms": "^5.0"
2828
},
2929
"require-dev": {
30-
"orchestra/testbench": "^7.0 || ^8.0"
30+
"orchestra/testbench": "^8.0 || ^9.0"
3131
},
3232
"config": {
3333
"allow-plugins": {

src/Generator.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Routing\Router;
1010
use Illuminate\Support\Arr;
1111
use League\Flysystem\Filesystem as Flysystem;
12+
use League\Flysystem\Local\LocalFilesystemAdapter;
1213
use Statamic\Contracts\Imaging\UrlBuilder;
1314
use Statamic\Facades\Collection;
1415
use Statamic\Facades\Entry;
@@ -120,13 +121,8 @@ public function bindGlide()
120121

121122
$directory = Arr::get($this->config, 'glide.directory');
122123

123-
// Determine which adapter to use for Flysystem 1.x or 3.x.
124-
$localAdapter = class_exists($legacyAdapter = '\League\Flysystem\Adapter\Local')
125-
? $legacyAdapter
126-
: '\League\Flysystem\Local\LocalFilesystemAdapter';
127-
128124
$this->app['League\Glide\Server']->setCache(
129-
new Flysystem(new $localAdapter($this->config['destination'].'/'.$directory))
125+
new Flysystem(new LocalFilesystemAdapter($this->config['destination'].'/'.$directory))
130126
);
131127

132128
$this->app->bind(UrlBuilder::class, function () use ($directory) {

tests/Localized/GenerateTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Filesystem\Filesystem;
66
use Statamic\Facades\Config;
7+
use Statamic\Facades\Site;
78
use Tests\Concerns\RunsGeneratorCommand;
89
use Tests\TestCase;
910

@@ -18,8 +19,9 @@ protected function getEnvironmentSetUp($app)
1819
parent::getEnvironmentSetUp($app);
1920

2021
$app['config']->set('statamic.editions.pro', true);
22+
$app['config']->set('statamic.system.multisite', true);
2123

22-
$app['config']->set('statamic.sites.sites', [
24+
Site::setSites([
2325
'default' => [
2426
'name' => 'English',
2527
'locale' => 'en_US',

tests/TestCase.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ protected function resolveApplicationConfiguration($app)
6464
parent::resolveApplicationConfiguration($app);
6565

6666
$configs = [
67-
'assets', 'cp', 'forms', 'routes', 'static_caching',
68-
'sites', 'stache', 'system', 'users',
67+
'assets', 'cp', 'forms', 'routes', 'static_caching', 'stache', 'system', 'users',
6968
];
7069

7170
foreach ($configs as $config) {
72-
$app['config']->set("statamic.$config", require(__DIR__."/../vendor/statamic/cms/config/{$config}.php"));
71+
$app['config']->set("statamic.$config", require (__DIR__."/../vendor/statamic/cms/config/{$config}.php"));
7372
}
7473
}
7574

0 commit comments

Comments
 (0)