-
-
Notifications
You must be signed in to change notification settings - Fork 97
Pre & Post Build Command Support #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Great work on this as always Pete! I've added two comments, but honestly this comes down to preference I think. If @SRWieZ is okay with it I am too. I have a question though. I might not be understanding fully how this works so please bear with me. Isn't this a question of looping through all the prebuild & postbuild commands & running them? The clever Can you elaborate on why it works like this? |
|
Updated, refactored and simplified. The scope creep was real. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
One thing to consider. Should we cancel the build when a process fails?
| ->with([ | ||
| // Empty class with the HasPreAndPostProcessing trait | ||
| new class | ||
| { | ||
| use HasPreAndPostProcessing; | ||
| }, | ||
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful!
I did consider this and thought it could be creeping. It may also be that you're fine with things failing in the pre or post steps. Definitely discussion worthy and can be revisited if decided we should. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and approved!
Config key defaults provided in NativePHP/laravel#496
This pull request introduces a new trait for handling pre- and post-processing commands in the build process, along with updates to the
BuildCommandclass and associated tests. The most important changes include adding theHasPreAndPostProcessingtrait, updating theBuildCommandto use this trait, and adding tests to ensure the trait works correctly.New Trait for Pre- and Post-Processing:
src/Traits/HasPreAndPostProcessing.php: Introduced theHasPreAndPostProcessingtrait to handle pre- and post-processing commands during the build process. This includes methods for executing commands and retrieving configuration.Updates to BuildCommand:
src/Commands/BuildCommand.php: Updated theBuildCommandclass to use the newHasPreAndPostProcessingtrait and added calls topreProcessandpostProcessmethods in thehandlemethod. [1] [2] [3]Tests for the New Trait:
tests/Mocks/HasPreAndPostProcessingMock.php: Added a mock class to facilitate testing of theHasPreAndPostProcessingtrait.tests/Unit/Traits/HasPreAndPostProcessingTest.php: Added unit tests to verify that thepreProcessandpostProcessmethods execute commands as expected based on configuration.Development Dependency:
composer.json: Addedmockery/mockeryas a development dependency for testing purposes.Closes #493