Skip to content

Commit

Permalink
Support Statamic 3.3 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseleite committed Mar 8, 2022
1 parent 3ddc8f8 commit e2e2e78
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,27 @@ jobs:

strategy:
matrix:
php: [7.4, 7.3, 7.2, 8.0]
laravel: [8.*, 7.*, 6.*]
php: [7.4, 8.0, 8.1]
laravel: [8.*, 9.*]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-20.04]
include:
- laravel: 9.*
testbench: 7.*
testbench-constraint: ^7.0
- laravel: 8.*
testbench: 6.*
laravel-constraint: ^8.18.1
- laravel: 7.*
testbench: 5.*
- laravel: 6.*
testbench: 4.*
laravel-constraint: ^6.6.2
testbench-constraint: ^6.22.0
- php: 7.4
dependency-version: prefer-lowest
additional-deps: '"mockery/mockery:>=1.2.3"'
- php: 8.0
dependency-version: prefer-lowest
additional-deps: '"mockery/mockery:>=1.3.3"'
exclude:
- laravel: 8.*
php: 7.2
- laravel: 9.*
php: 7.4

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ubuntu-latest

Expand All @@ -50,7 +49,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel-constraint || matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" ${{ matrix.additional-deps }} --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel-constraint || matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench-constraint || matrix.testbench }}" ${{ matrix.additional-deps }} --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
}
},
"require": {
"statamic/cms": "~3.1.7 || 3.2.*"
"statamic/cms": "~3.3.0"
},
"require-dev": {
"orchestra/testbench": "^4.0"
"orchestra/testbench": "^6.22.0 || ^7.0"
},
"suggest": {
"spatie/fork": "Required to generate pages concurrently (^0.0.4)."
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"prefer-stable": true
}
7 changes: 6 additions & 1 deletion src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,13 @@ public function bindGlide()
{
$directory = Arr::get($this->config, 'glide.directory');

// Determine which adapter to use for Flysystem 1.x or 3.x.
$localAdapter = class_exists($legacyAdapter = '\League\Flysystem\Adapter\Local')
? $legacyAdapter
: '\League\Flysystem\Local\LocalFilesystemAdapter';

$this->app['League\Glide\Server']->setCache(
new Flysystem(new Local($this->config['destination'] . '/' . $directory))
new Flysystem(new $localAdapter($this->config['destination'] . '/' . $directory))
);

$this->app->bind(UrlBuilder::class, function () use ($directory) {
Expand Down
8 changes: 4 additions & 4 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public function setPage($page)
return $this;
}

public function getScheme()
public function getScheme(): string
{
return explode(':https://', $this->config['base_url'])[0];
}

public function getHttpHost()
public function getHttpHost(): string
{
$withoutScheme = rtrim(explode(':https://', $this->config['base_url'])[1], '/');

Expand All @@ -37,7 +37,7 @@ public function getHttpHost()
return ($length === 0) ? $withoutScheme : substr($withoutScheme, 0, -$length);
}

protected function prepareBaseUrl()
protected function prepareBaseUrl(): string
{
$withoutScheme = rtrim(explode(':https://', $this->config['base_url'])[1], '/');

Expand All @@ -46,7 +46,7 @@ protected function prepareBaseUrl()
return $base !== '' ? '/'.$base : $base;
}

public function getPathInfo()
public function getPathInfo(): string
{
return $this->page->url();
}
Expand Down

0 comments on commit e2e2e78

Please sign in to comment.