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 start and stop callbacks #1913

Merged
merged 10 commits into from
Jul 11, 2023
Merged

Add start and stop callbacks #1913

merged 10 commits into from
Jul 11, 2023

Conversation

jevin
Copy link
Contributor

@jevin jevin commented Mar 23, 2023

This PR adds lifecycle events to Sinatra. Related issue: #1184

@jevin
Copy link
Contributor Author

jevin commented Mar 23, 2023

This is still missing tests. I'm not sure where they fit in, anyone can give me some pointers?
NVM, the tests need to go in test/server_test.rb

@jevin
Copy link
Contributor Author

jevin commented Mar 26, 2023

Okay this is ready for a review! @zzak (sorry I'm not sure who else to @')

@dentarg
Copy link
Member

dentarg commented May 15, 2023

The code looks good to me.

This is only used if you use Sinatra to start you web server, is that correct?

Can you add some documentation to the README? Maybe even add an example of this to the examples directory?

Thanks

@jevin
Copy link
Contributor Author

jevin commented Jun 14, 2023

Hey @dentarg, sorry I missed your comment!

This is only used if you use Sinatra to start you web server, is that correct?

Correct!

Can you add some documentation to the README? Maybe even add an example of this to the examples directory?

I will get on that!

@jevin
Copy link
Contributor Author

jevin commented Jun 14, 2023

@dentarg I just updated the README and added lifecycle_events.rb in examples!

Also, if you feel like the lifecycle events would make sense for servers NOT started with Sinatra, I'm down to create another PR for this!

Copy link
Member

@dentarg dentarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this reads easier

lib/sinatra/base.rb Outdated Show resolved Hide resolved
lib/sinatra/base.rb Outdated Show resolved Hide resolved
test/server_test.rb Outdated Show resolved Hide resolved
@jevin
Copy link
Contributor Author

jevin commented Jun 21, 2023

@dentarg, I've implemented the changes. Have a look and let me know!

@dentarg
Copy link
Member

dentarg commented Jun 22, 2023

Great, do you mind rebasing to get CI green?

@dentarg dentarg requested a review from a team June 22, 2023 05:22
@jevin jevin force-pushed the add-lifecycle-events branch from d930f92 to a9e8210 Compare June 22, 2023 08:25
@dentarg dentarg merged commit 3fe6297 into sinatra:main Jul 11, 2023
This was referenced Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants