-
Notifications
You must be signed in to change notification settings - Fork 162
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
Sequel adapter #152
Sequel adapter #152
Conversation
This looks really nice @appleton. Agree it would be really nice to add the queries interface - would also be good to use a |
@@ -11,6 +11,7 @@ module Adapters | |||
"statesman/adapters/active_record_transition" | |||
autoload :ActiveRecordQueries, | |||
"statesman/adapters/active_record_queries" | |||
autoload :Sequel, "statesman/adapters/sequel" |
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.
What's going on with the whitespace here?
@appleton hey hey 👋 We're thinking ahead to a 2.0 release this side of Christmas, feels like this would be a nice PR to get in? Is there anything left to do on it before it can be merged? |
I think if the tests pass then it should be good to go though we're not using this in any project yet so I can't speak to its stability. We are just considering pulling statesman into a project though so it could be good timing :) |
Well, that said there's no query interface but maybe its okay for that to come later? |
Sorry for the delay in getting back to you! Given this isn't a breaking change & there's no real rush on getting it in, I wonder if it's worth waiting until you're using it in production? What do you think? |
Works for me! On 7 December 2015 at 10:24, Pete Hamilton [email protected] wrote:
|
@appleton - any update? Would love to get this in if you've battle-tested it! |
It's not battle tested, we backed out of the change we were planning to make unfortunately. I'd suggest one of:
|
I'm for extracting into a gem - this isn't going to get the same level of support as the rest of Statesman, and I don't want it to slow down development. @hmarr / @petehamilton - what do you reckon? |
My preference would also be extracting into a gem. Seems like a sensible approach for alternative adapters in general. |
@appleton I am looking for a state machine gem and I am very in favour of this one. However tha lack of Sequel support is weighting in. Apart from the query interface, is this adapter working as it should with statesman? If so, I can fork your adapter and help extracting it into a gem. |
Hey @badosu yeah it should be working just fine, it passes the adapter tests at the very least. I'd be happy to help out with advice or possibly contributions if you want to take it on, I think it's a great idea! |
@appleton Thanks for the quick response. We are going to implement a state machine on our system in the next weeks, I will update you when we come back to this. |
|
||
::Sequel.extension(:inflector) | ||
|
||
def initialize(transition_class, parent_model, observer) |
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.
This method now requires an additional options={}
argument to work on the latest version.
@appleton I will start using your code on the next few days, I'll post my findings and refine the adapter as it will be battle tested on the next weeks. |
@greysteil @hmarr Is there any reason for preferring using null values on the I am developing this specific part for the adapter and this adds considerable complexity, I am not sure of the benefit. Thanks! |
It was a requirement for people adding a Given that the sequel adapter is new, there's no need to support that upgrade path, and you don't need to worry about the |
@greysteil Great! Thanks for the follow up. |
@greysteil @appleton We finally can attest for sure that the code is running fine on production for months and feel confident to contribute the changes. We can update this PR or create a gem for this: @appleton Let me know how it works best for you, since if we publish this in a separate repo we'll lose your commit history, but I'd like to make certain that your contribution credit is not lost. |
Hey @badosu, glad to hear it's working! Please do take it and create your own project, I'm fine with losing the attribution :) |
@hmarr can you or someone from GC make the call on PR versus separate gem? Latter makes sense to me but I'm the world's worst maintainer whilst I'm on the road. |
I'd rather go with a separate gem so there's clear ownership. Having the Mongo adapter in the main repo can make it harder to work on Statesman, as most of the core contributors aren't that familiar with Mongo. Moving future adapters to separate gems seems like a sensible approach. Thanks for pushing this forward @badosu! |
Thanks @hmarr, @greysteil, @appleton! Packaging it into a gem will also help in regard to inclusion of a sequel plugin. That would require a separate gem from statesman anyways. I'll report back as soon as I finish polishing the gem. |
I just released a very preliminar version at https://github.com/badosu/statesman-sequel I'll consider it ready for use when I have migrated all the adapter specs to my suite. For now I am testing the basic behaviour with the plugin included in the gem. Thanks for everyone! |
As of #250 we'll link to that in the README - thanks! |
I'm sure this needs more work, specifically there seems to be a fair bit of behaviour in the ActiveRecord adapter only which would also be applicable here, but I'm opening a PR to get some discussion going.
I'm thinking I could factor out a lot of the active record adapter specs into another shared suite, something like
it_behaves_like "a SQL adapter"
.I guess it would also be useful to implement the queries interface.