Skip to content

Commit 914d3db

Browse files
committed
bake command return error if account sprinkle is not included - Fix #944
1 parent b31d6ac commit 914d3db

4 files changed

Lines changed: 100 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [v4.3.0]
9+
10+
### Changed Requirements
11+
- Changed minimum PHP Version to 7.1
12+
13+
### Added
14+
- Separated `BakeCommand` class into multiple methods to make it easier for sprinkle to add custom command to the `bake` command.
15+
16+
### Fix
17+
- `bake` command return error if account sprinkle is not included ([#944])
18+
19+
### Changed
20+
- Account sprinkle now extend the Core `BakeCommand` class to add the `create-admin` to the general bake command. Any sprinkle already extending the Core `BakeCommand` might need adjustments.
21+
22+
823
## [v4.2.2]
924

1025
### Added

app/defines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace UserFrosting;
1212

1313
// Some standard defines
14-
define('UserFrosting\VERSION', '4.2.2');
14+
define('UserFrosting\VERSION', '4.3.0-dev');
1515
define('UserFrosting\DS', '/');
1616
define('UserFrosting\PHP_MIN_VERSION', '5.6');
1717
define('UserFrosting\PHP_RECOMMENDED_VERSION', '7.2');
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* UserFrosting (http://www.userfrosting.com)
5+
*
6+
* @link https://github.com/userfrosting/UserFrosting
7+
* @copyright Copyright (c) 2019 Alexander Weissman
8+
* @license https://github.com/userfrosting/UserFrosting/blob/master/LICENSE.md (MIT License)
9+
*/
10+
11+
namespace UserFrosting\Sprinkle\Account\Bakery;
12+
13+
use Symfony\Component\Console\Input\InputInterface;
14+
use Symfony\Component\Console\Output\OutputInterface;
15+
use UserFrosting\Sprinkle\Core\Bakery\BakeCommand as CoreBakeCommand;
16+
17+
/**
18+
* Bake command extension.
19+
* Adding Account provided `create-admin` to the bake command
20+
*/
21+
class BakeCommand extends CoreBakeCommand
22+
{
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
protected function executeConfiguration(InputInterface $input, OutputInterface $output)
27+
{
28+
parent::executeConfiguration($input, $output);
29+
30+
$command = $this->getApplication()->find('create-admin');
31+
$command->run($input, $output);
32+
}
33+
}

app/sprinkles/core/src/Bakery/BakeCommand.php

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,72 @@ protected function execute(InputInterface $input, OutputInterface $output)
5252
{
5353
$this->io->writeln("<info>{$this->title}</info>");
5454

55+
$this->executeSetup($input, $output);
56+
$this->executeDebug($input, $output);
57+
$this->executeConfiguration($input, $output);
58+
$this->executeAsset($input, $output);
59+
$this->executeCleanup($input, $output);
60+
}
61+
62+
/**
63+
* Core setup group of task
64+
*
65+
* @param InputInterface $input
66+
* @param OutputInterface $output
67+
*/
68+
protected function executeSetup(InputInterface $input, OutputInterface $output)
69+
{
5570
$command = $this->getApplication()->find('setup:db');
5671
$command->run($input, $output);
5772

5873
$command = $this->getApplication()->find('setup:smtp');
5974
$command->run($input, $output);
75+
}
6076

77+
/**
78+
* Debug group of task
79+
*
80+
* @param InputInterface $input
81+
* @param OutputInterface $output
82+
*/
83+
protected function executeDebug(InputInterface $input, OutputInterface $output)
84+
{
6185
$command = $this->getApplication()->find('debug');
6286
$command->run($input, $output);
87+
}
6388

89+
/**
90+
* Configuration group of task
91+
*
92+
* @param InputInterface $input
93+
* @param OutputInterface $output
94+
*/
95+
protected function executeConfiguration(InputInterface $input, OutputInterface $output)
96+
{
6497
$command = $this->getApplication()->find('migrate');
6598
$command->run($input, $output);
99+
}
66100

67-
$command = $this->getApplication()->find('create-admin');
68-
$command->run($input, $output);
69-
101+
/**
102+
* Assets setup group of task
103+
*
104+
* @param InputInterface $input
105+
* @param OutputInterface $output
106+
*/
107+
protected function executeAsset(InputInterface $input, OutputInterface $output)
108+
{
70109
$command = $this->getApplication()->find('build-assets');
71110
$command->run($input, $output);
111+
}
72112

113+
/**
114+
* Cleanup group of task
115+
*
116+
* @param InputInterface $input
117+
* @param OutputInterface $output
118+
*/
119+
protected function executeCleanup(InputInterface $input, OutputInterface $output)
120+
{
73121
$command = $this->getApplication()->find('clear-cache');
74122
$command->run($input, $output);
75123
}

0 commit comments

Comments
 (0)