Skip to content
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

Add more config extensions, job blueprint, console application and more #113

Merged
merged 22 commits into from
Jun 5, 2023
Merged

Add more config extensions, job blueprint, console application and more #113

merged 22 commits into from
Jun 5, 2023

Conversation

PAXANDDOS
Copy link
Contributor

@PAXANDDOS PAXANDDOS commented Mar 27, 2023

Q A
New feature? Yes!
Breaking changes? Yes!
Bug fix? Yes!
Deprecations? Yes!
Issues resolved Fixes #112
Fixes #110

Added

Commit Description
a8227e4 Support for more config file extensions: php and json. This also made it possible to move symfony/yaml package from dependencies. All configuration logic is now stored in Resque\Config.
66086aa Extendable console application. This makes it easier for users to run Resque commands within their own code or another Symfony Console. Also makes it easy to add their own commands. Previously application wasn't defined and its logic was dumped in the binary file.
d087db4 Job blueprint which is meant to be a base for defining jobs. Users can easily get all info about methods and their arguments.
setUp and tearDown functions now will receive the current Job instance.
0ac1b11 PHP DocBlocks to the main Resque class to help with intellisense. callStatic() breaks the intellisense in IDE's, adding respectful @method declarations of all possible methods is the only thing to make it work
c2f165e Added tools/ folder which is to contain various binaries. Currently stores only PHP CS Fixer. This folder is ignored during export.
4a23ffb Suggestions for ext-mongodb extension and mongodb/mongodb package

Changed

Commit Description
383cc7a Minimum PHP version is now 7.2. Supported PHP versions are ^7.2 or ^8.0. (I reverted the "typed properties" feature because apparently, that's a bad practice for libraries, even packages with minimum PHP version 8 don't use them. Anyway, I already got what I wanted from them, and made enough type fixes in the previous PR)
f74dc66 Default configuration file should have the name resque instead of config (e.g. resque.php). Having "config" for a package in users' projects is rather confusing
a8227e4 Refactored structure to follow PSR-4 autoloading standard (used to follow PSR-0). Basically, I had to unwrap the src/Resque folder, that's where most of the file changes come from
c2f165e Improved deployment. Now only mandatory files are included in the dist package (ignored in .gitattributes)
c158f57 Worker to log on a DEBUG level when no queues are found (instead of INFO). It's more of a debug information. When the user has set debug level to info and didn't add any queues, the log file will be populated every time, increasing file size, which is bad
b806a97 Bumped predis/predis dependency to ^2.1
383cc7a Changed phpunit/phpunit dependency version to ^8.0 or ^9.0
A lot of minor improvements here and there

Deprecated

Commit Description
48ac65c Deprecated CubeConnector (see Monolog CubeHandler)
Deprecated phpiredis config option (see predis/predis#1179)

Removed

Commit Description
9831c1b Removed Sami, an API documentation generator. I guess it was used back in the day, it's been abandoned for a while now

Fixed

Commit Description
010bc56 Custom configuration file not being loaded in the SpeedTest command
4a23ffb MongoDB logger connector using removed classes
7f8b56c SeializableClosure deprecation notice. Was fixed in the previous PR but since I lowered the minimum PHP version, both implementations must be added

Security

Commit Description
07e879c Added final keyword to classes that should not be extended

Tests

PHP PHPUnit Manual (Console) Manual (Web)
7.2
7.3
7.4
8.0
8.1
8.2

Post-word

And that's me again! In my previous PR I was targeting a minor release, but if we're going for v4 I decided to do everything I can to help 😄 There are some changes to make the codebase modern and also features to make usage more comfortable.
I also took care of documentation and changelog.

Also when you will be making a PR from v4 to master, you can use a keyword with the issue number as I did in this and previous PR; and when the PR is merged (to master apparently), it will close the referenced issues. I'm telling you this because I saw that you mainly use GitLab and decided to let you know

- Use CLI version instead of FPM, php-resque is cli-based
- Restructure Dockerfile
- Minor improvements
- Added tools directory which is to contain tools we'd need. Ignored during export. It's better to use such tools from binaries rather than from composer (in libraries)
- Improved .gitattributes. The exported package won't contain files that the user's production won't need
Having `config.yml` for users is rather confusing, this would be more user-friendly
- Added a separate Config class to take control over configuration features. Added support for PHP and JSON configs.
- Using PSR-4 for autoloading. This means that I had to unpack Resque/ folder
- Yaml is now optional, moved it to require-dev and added a suggestion
- Improved composer, added config option
- Removed docs/api/config, which is related to Sami I've removed before
- Some minor improvements I already forgot about
It was impossible to run speed:test command before if the user had a host and port different from 127.0.0.1 and 6379 because speedtest command was loading a predefined config. Now using inline options in Process and passing user-defined config options
- Add 'final' keyword to classes that are not meant to be extended
- Remove unused imports
- Added Job blueprint which users can extend and would easily know about methods and their arguments
- Passing Job instance to setUp and tearDown methods; sometimes it's necessary to know about the job before and after it's run
callStatic() breaks the intellisense in IDE's, adding respectful @method declarations of all possible methods is the only thing to make it work
- Fixed MongoDB handler with correct MongoDB classes. This is apparently pretty old handler. Added suggests to the composer.json
- In Dockerfile using wget instead of git to get the phpiredis repository; installed mongodb
- Reverted typed properties feature
- Lowered minimum supported PHP version to 7.2
- More verbose MongoDB handler, fixed return types
As the minimum supported PHP version lowered, magic methods for serialization stopped working, added both implementations so it would work in any version
- Updated documentation to acknowledge changes in v4
- Refactored to follow modern markdown style
It's more of a debug information. When the user has set debug level to info and didn't add any queues, the log file will be populated every time, increasing file size, which is bad
@xelan
Copy link
Collaborator

xelan commented Mar 29, 2023

Thanks for your work, @PAXANDDOS! Concerning the supported configuration files, I saw that you deleted the config.yml without a replacement. I'm wondering if this might impact the learning curve of new users. Maybe we should keep the file as reference and mention how different formats can be used in the docs? I'd prefer to have a simple out-of-the-box example configuration for basic use cases.

@PAXANDDOS
Copy link
Contributor Author

PAXANDDOS commented Mar 29, 2023

I saw that you deleted the config.yml without a replacement.

It's not really gone, as I said in the PR description - just renamed (config.yml -> resque.yml + formats). Because resque is meant to be used in other people's projects, and having a config.yml in their project root would be somewhat confusing: is it for the project or a package?

Maybe we should keep the file as a reference and mention how different formats can be used in the docs?

Or do you mean that we should keep both the "config" and "resque" files? That would make sense if we are to deprecate the file, but it's the major release anyway

@PAXANDDOS
Copy link
Contributor Author

@xelan Are there any other questions? I believe I described everything in the description

@xelan
Copy link
Collaborator

xelan commented Apr 4, 2023

:shipit:

@xelan Are there any other questions? I believe I described everything in the description

Thanks, your description looks good, I just need a bit of time to review the PR.

@PAXANDDOS
Copy link
Contributor Author

Bump 👀

@xelan
Copy link
Collaborator

xelan commented Apr 21, 2023

Concerning the removal of Sami for doc generation - what would you think about using the maintained fork Doctum instead? Generated API doc is still useful IMHO.
Thanks!

@xelan xelan self-assigned this Apr 21, 2023
@PAXANDDOS
Copy link
Contributor Author

Sorry for the late response.

The tool seems great! I'm not sure if Resque would need it though, the project is not really big. If you wanna target the contributors then DocBlocks within the code should be good. To be fair, I haven't seen many open-source packages using generated API docs. If you still wanna use then maybe we can delay that for v4.1 or something like that?

I just really hope to see current changes in production soon but unfortunately can't do any more contributions for now, got to finish my graduate program

@PAXANDDOS
Copy link
Contributor Author

Bump!

@xelan
Copy link
Collaborator

xelan commented May 16, 2023

Bump!

Hi @PAXANDDOS, I‘m currently out of office and back next week.

Best regards
Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serializable interface deprecated Unable to get code intellisense
2 participants