-
Notifications
You must be signed in to change notification settings - Fork 72
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
upgrade roar to current version #242
Conversation
76cb723
to
58b6742
Compare
We really only need to bump roar to 1.0.0 to get the change to namespaces |
Could we change it to support both pre 1.0 and 1.x versions of Roar? Ideally, I think the individual services should decide which version they want to use and Napa should support all versions |
65613c6
to
c6ba31b
Compare
@darbyfrey, is there a pattern for supporting different versions like you suggest? I used a LoadError rescue and this seems to work. I've updated this pull request to support pre and post namespace refactoring. I have change the gemspec to allow higher version changes. Also, the Coercion didn't need a namespace prefix to work. I tested this with an internal app and set roar to Thoughts? |
While this would work, it's not very clear why you're doing the begin/rescue, etc. A simple way to do it would be wrap a conditional around the VERSION value. So, something like:
Are the dependencies clear enough that you could use this approach? |
@@ -25,7 +25,7 @@ Gem::Specification.new do |gem| | |||
gem.add_dependency 'virtus', '~> 1.0.0' | |||
gem.add_dependency 'grape', '~> 0.10.0' | |||
gem.add_dependency 'grape-swagger', '~> 0.9.0' | |||
gem.add_dependency 'roar', '~> 0.12.0' | |||
gem.add_dependency 'roar', '>= 0.12.0' |
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 could use a specific pessimistic approach.
So we could do gem.add_dependency 'roar', '>= 0.12.0', '< 2.0.0'
I agree that it shouldn't cause a LoadError and instead use an |
@darbyfrey I've used your approach. Yeah, that makes perfect sense. I was just totally unsure of the better way to do it. Thanks for the tip. @ochagata, I've added the pessimistic upper bound limiting roar to 1.x |
👍 |
if Roar::VERSION >= '1.0.0' | ||
require 'roar/json' | ||
require 'roar/coercion' | ||
REPRESENTER_JSON_MODULE = Roar::JSON |
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 will set a global constant in any app that uses Napa.
Any reason you can't pull this conditional around the include
within the Representer
class?
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.
that's a good call. will look into doing this
@darbyfrey, I removed the constant, but I'm still not sure if this is the most appropriate method |
This seems fine to me. You could add a helper method to wrap the version check to be more explicit about what you're doing, but that's not totally necessary. +1 from me. Anyone else? |
LGTM +1 |
@ashtonthomas, will you add a note for this change into the CHANGELOG? Then we can merge it in. |
3d46a6a
to
8d23e26
Compare
- this is two years out of date - Removes Representer and Feature namespace - added more stuff for JSONAPI, hypermedia - This is going to bump the Representer gem which could cause issues for some project update our representer to work with various versions of roar allow for higher versions of roar prefer version check over load error pessimistic on upper version of roar avoid using a global constant to include JSON module
8d23e26
to
2ed813b
Compare
@darbyfrey, sorry for the delay. I rebased with master and added the changelog |
Thanks @ashtonthomas! |
upgrade roar to current version
We define a subclass of Roar::Decorator and include some modules which have had their namespace changed in roar 1.0.0.
Roar has seen a lot of new developments recently with support for hypermedia attributes. These changes along with the general value of not restricting dependency versions when we don't need to should merit this pull request.
In this pull request: