Skip to content

Commit 61478da

Browse files
Only support latest stable Laravel version (#496)
1 parent 67cfc6b commit 61478da

File tree

175 files changed

+791
-4997
lines changed

Some content is hidden

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

175 files changed

+791
-4997
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,22 @@ on:
99
- cron: "0 0 * * *"
1010

1111
env:
12-
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist -o -n"
12+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist -o -n"
1313

1414
jobs:
1515
tests:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php-version: [7.2, 7.3, 7.4, 8.0]
19+
php-version: [7.3, 7.4, 8.0]
2020

21-
laravel-version: [6, 7, 8]
22-
23-
os: [ubuntu-latest]
21+
os: [ubuntu-latest, windows-latest, macos-latest]
2422

2523
dependencies: [locked]
2624

2725
experimental: [false]
2826

29-
include:
30-
- php-version: 7.4
31-
laravel-version: 7
32-
dependencies: highest
33-
os: ubuntu-latest
34-
experimental: false
35-
36-
- php-version: 7.4
37-
laravel-version: 7
38-
os: windows-latest
39-
dependencies: locked
40-
experimental: false
41-
42-
- php-version: 7.4
43-
laravel-version: 7
44-
os: macos-latest
45-
dependencies: locked
46-
experimental: false
47-
48-
name: PHP ${{ matrix.php-version }} - L${{ matrix.laravel-version }} - ${{ matrix.os }}
27+
name: PHP ${{ matrix.php-version }} - ${{ matrix.os }}
4928

5029
runs-on: ${{ matrix.os }}
5130

@@ -63,14 +42,14 @@ jobs:
6342
uses: actions/cache@v2
6443
with:
6544
path: ${{ steps.determine-composer-cache-directory.outputs.directory }}
66-
key: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-${{ hashFiles('**/composer.lock') }}
67-
restore-keys: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-
45+
key: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
46+
restore-keys: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-composer-
6847

6948
- name: Setup PHP
7049
uses: shivammathur/setup-php@v2
7150
with:
7251
php-version: ${{ matrix.php-version }}
73-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
52+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, fileinfo
7453
coverage: none
7554
ini-values: "memory_limit=-1"
7655

@@ -104,12 +83,8 @@ jobs:
10483
max_attempts: 5
10584
command: composer install ${{ env.COMPOSER_FLAGS }}
10685

107-
- name: Select Laravel version
108-
uses: nick-invision/retry@v1
109-
with:
110-
timeout_minutes: 5
111-
max_attempts: 5
112-
command: composer require "laravel/framework:${{ matrix.laravel-version }}.*" --no-update
86+
- name: Install Laravel
87+
run: composer require laravel/framework --no-update
11388

11489
- name: Run tests
11590
run: vendor/bin/phpunit --verbose

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
_Blueprint_ is an open-source tool for **rapidly generating multiple** Laravel components from a **single, human readable** definition.
1010

11-
Watch a quick [demo of Blueprint](https://www.youtube.com/watch?v=A_gUCwni_6c) in action and continue reading this document to get started.
11+
Watch a quick [demo of Blueprint](https://www.youtube.com/watch?v=A_gUCwni_6c) in action and continue reading to get started.
1212

1313
## Requirements
1414
Blueprint requires a Laravel application running version 6.0 or higher.
@@ -72,8 +72,12 @@ From these simple 20 lines of YAML, Blueprint will generate all of the following
7272
- An _event_ class for `NewPost` complete with a `post` property set through the _constructor_.
7373
- A _Blade template_ of `post/index.blade.php` rendered by `PostController@index`.
7474

75-
_**Note:** This example assumes features within a default Laravel application such as the `User` model and `app.blade.php
76-
layout. Otherwise, the generated test may have failures._
75+
_**Note:** This example assumes features within a default Laravel application such as the `User` model and `app.blade.php` layout. Otherwise, the generated test may have failures._
7776

7877
## Documentation
7978
Browse the [Blueprint Docs](https://blueprint.laravelshift.com/) for full details on [defining models](https://blueprint.laravelshift.com/docs/defining-models/), [defining controllers](https://blueprint.laravelshift.com/docs/defining-controllers/), [advanced configuration](https://blueprint.laravelshift.com/docs/advanced-configuration/), and [extending Blueprint](https://blueprint.laravelshift.com/docs/extending-blueprint/).
79+
80+
## Support Policy
81+
Starting with version 2, Blueprint only generates code for the latest stable version of Laravel (currently Laravel 8). If you need to support older versions of Laravel, you may use version 1 or upgrade your application ([try using Shift](https://laravelshift.com)).
82+
83+
Blueprint still follows [semantic versioning](https://semver.org/). However, it does so with respect to its grammar. Any changes to the grammar will increase its major version number. Otherwise, minor version number increases will contain new features. This includes generating code for future versions of Laravel.

UPGRADE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Upgrade Guide
2+
3+
## Upgrading from 1.x to 2.x
4+
Version 2.x was a superficial major release to reflect Blueprint's new [Support Policy](https://github.com/laravel-shift/blueprint#support-policy). There were no changes to the underlying grammar. A few configuration options and methods were changed. Additional notes are below. You may view the full set of changes in [#496](https://github.com/laravel-shift/blueprint/pull/496).
5+
6+
### Configuration changes
7+
The following configuration options were changed to reflect new conventions in Laravel 8.
8+
9+
- `models_namespace` default value is now `Models`.
10+
- `generate_fqcn_route` was removed. Blueprint now generates all routes using fully qualified class names and tuples.
11+
12+
### Removed methods
13+
The following static methods on the `Blueprint` class were changed:
14+
15+
- `supportsReturnTypeHits` was renamed to `useReturnTypeHints`.
16+
- `isLaravel8OrHigher` was removed.
17+
- `isPHP7OrHigher` was removed.

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"license": "MIT",
1010
"require": {
1111
"doctrine/dbal": "^2.9 || ^3.0",
12-
"illuminate/console": "^6.0 || ^7.0 || ^8.0",
13-
"illuminate/filesystem": "^6.0 || ^7.0 || ^8.0",
14-
"illuminate/support": "^6.0 || ^7.0 || ^8.0",
12+
"illuminate/console": "^8.0",
13+
"illuminate/filesystem": "^8.0",
14+
"illuminate/support": "^8.0",
1515
"laravel-shift/faker-registry": "^0.1",
16-
"symfony/yaml": "^4.3 || ^5.0"
16+
"symfony/yaml": "^5.1.4"
1717
},
1818
"require-dev": {
1919
"mockery/mockery": "^1.3",
20-
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0",
21-
"phpunit/phpunit": "^8.0 || ^9.3"
20+
"orchestra/testbench": "^6.0",
21+
"phpunit/phpunit": "^9.3"
2222
},
2323
"suggest": {
2424
"jasonmccreary/laravel-test-assertions": "Required to use additional assertions in generated tests (^1.0)."

config/blueprint.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
'namespace' => 'App',
1717

18-
1918
/*
2019
|--------------------------------------------------------------------------
2120
| Component Namespaces
@@ -27,10 +26,9 @@
2726
| your own custom namespace when generating these components.
2827
|
2928
*/
30-
'models_namespace' => '',
29+
'models_namespace' => 'Models',
3130
'controllers_namespace' => 'Http\\Controllers',
3231

33-
3432
/*
3533
|--------------------------------------------------------------------------
3634
| Application Path
@@ -116,20 +114,6 @@
116114
*/
117115
'use_guarded' => false,
118116

119-
/*
120-
|--------------------------------------------------------------------------
121-
| Generate FQCN Routes
122-
|--------------------------------------------------------------------------
123-
|
124-
| By default, Blueprint follows the Laravel convention of the controller
125-
| namespace matches the namespace set within the RouteServiceProvider.
126-
| However, you may configure Blueprint to generate routes using a
127-
| "tuple syntax" in cases where you may not use this property
128-
| or wish to improve static analysis.
129-
|
130-
*/
131-
'generate_fqcn_route' => false,
132-
133117
/*
134118
|--------------------------------------------------------------------------
135119
| Generators

phpunit.xml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4-
backupGlobals="false"
5-
backupStaticAttributes="false"
6-
bootstrap="vendor/autoload.php"
7-
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false">
13-
<testsuites>
14-
<testsuite name="Unit">
15-
<directory suffix="Test.php">./tests/Unit</directory>
16-
</testsuite>
17-
18-
<testsuite name="Feature">
19-
<directory suffix="Test.php">./tests/Feature</directory>
20-
</testsuite>
21-
</testsuites>
22-
<filter>
23-
<whitelist processUncoveredFilesFromWhitelist="true">
24-
<directory suffix=".php">./src</directory>
25-
</whitelist>
26-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Unit">
10+
<directory suffix="Test.php">./tests/Unit</directory>
11+
</testsuite>
12+
<testsuite name="Feature">
13+
<directory suffix="Test.php">./tests/Feature</directory>
14+
</testsuite>
15+
</testsuites>
2716
</phpunit>

src/Blueprint.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,9 @@ public static function appPath()
3030
return str_replace('\\', '/', config('blueprint.app_path'));
3131
}
3232

33-
public static function supportsReturnTypeHits()
33+
public static function useReturnTypeHints()
3434
{
35-
return boolval(config('blueprint.use_return_types')) && self::isPHP7OrHigher();
36-
}
37-
38-
public static function isPHP7OrHigher()
39-
{
40-
return version_compare(PHP_VERSION, '7.0.0', '>=');
41-
}
42-
43-
public static function isLaravel8OrHigher()
44-
{
45-
return version_compare(App::version(), '8.0.0', '>=');
35+
return boolval(config('blueprint.use_return_types'));
4636
}
4737

4838
public function parse($content, $strip_dashes = true)

src/Commands/BuildCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ function ($file) {
7676
$this->line('');
7777
}
7878
);
79+
80+
return 0;
7981
}
8082

8183
/**

src/Commands/EraseCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ public function __construct(Filesystem $filesystem)
3333
$this->filesystem = $filesystem;
3434
}
3535

36-
/**
37-
* Execute the console command.
38-
*
39-
* @return mixed
40-
*/
4136
public function handle()
4237
{
4338
$contents = $this->filesystem->get('.blueprint');
@@ -72,7 +67,7 @@ function ($file) {
7267

7368
$this->filesystem->put('.blueprint', $blueprint->dump($generated));
7469

75-
$this->call('blueprint:trace');
70+
return $this->call('blueprint:trace');
7671
}
7772

7873
private function outputStyle($action)

src/Commands/InitCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ class InitCommand extends Command
2020
*/
2121
protected $description = 'An alias for "blueprint:new" command';
2222

23-
/**
24-
* Execute the console command.
25-
*
26-
* @return mixed
27-
*/
2823
public function handle()
2924
{
30-
$this->call(\Blueprint\Commands\NewCommand::class);
25+
return $this->call(\Blueprint\Commands\NewCommand::class);
3126
}
3227
}

0 commit comments

Comments
 (0)