-
Notifications
You must be signed in to change notification settings - Fork 251
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
Support rack 2 #151
Support rack 2 #151
Conversation
@brynary Hello, are you there? |
@perlun yes I think so. Removing |
4f5dfb7
to
a3d78bf
Compare
@perlun By the way, below part of the modification in this PR is to prevent test error for
|
Gemfile
Outdated
@@ -2,7 +2,8 @@ source 'https://rubygems.org' | |||
|
|||
gem 'rspec' | |||
gem "rack" | |||
gem "sinatra" | |||
gem "sinatra", "~> 2.0.0.rc2" |
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.
Does this mean we now only support Rack 2 or does the code still work w/ Rack 1? Can we be sure? 😄 I think it would be good if the gem properly supports both Rack 1 and Rack 2 for the time being, especially since Sinatra 2.x hasn't reached version 2.0.0 yet.
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.
Maybe something like Appraisal could be used
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.
@junaruga - see my question above. |
@perlun ok I will change the files. |
a39dead
to
7a9148a
Compare
I prepared both rack 2 and 1 test to use 2 Gemfiles referring below gem packages' cases. Ideally, I think common gems for rack 2 and rack 1 test should be managed in As However I do not want to update I want to update As a information, use cases for
|
@perlun ah just moment. I want to rebase again. |
7a9148a
to
211bbeb
Compare
@perlun ok I did rebase again. I think that this style's merit is, after "Squash and merge", I guess that we can see 2 commits' information from github web UI. |
@perlun I know that basically we only accept "Squash and merge". But in this case, when I consider about this today again, I want to commit these 2 commits keeping original commit to respect original contributor. |
@junaruga Fair enough. I changed the options to support "rebase merge": It means both commits will be retained, so you preserve the original author commit unchanged, and your commit on top of it. Is that acceptable from your POV? If not, just let me know. |
@perlun yes I can accept it. Great. Thanks. Can you approve the review for the PR? |
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.
One idea that I'm thinking about. Will it work? If not, let me know and I'll approve it as-is.
.travis.yml
Outdated
rvm: | ||
- 2.2.7 | ||
- 2.3.4 | ||
- 2.4.1 | ||
- ruby-head | ||
- jruby-9.1.8.0 | ||
- jruby-head | ||
gemfile: | ||
- Gemfile | ||
- gemfiles/Gemfile.rack-1 |
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.
Would it be possible to move this file to the top-level? I.e. to name it Gemfile.rack-1.x
or something in the top-level folder instead. Makes it easier to find it that way.
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.
@perlun ok, it looks good. As we still have only 2 kind of Gemfile
, moving it to the top-level makes sense. Let me try it.
It makes sense. After changing on your way, it works! |
@@ -66,7 +66,7 @@ | |||
:input => StringIO.new(data) | |||
} | |||
env = Rack::MockRequest.env_for("/", options) | |||
params = Rack::Utils::Multipart.parse_multipart(env) | |||
params = Rack::Multipart.parse_multipart(env) |
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.
@junaruga Does the Rack::Multipart
class/module exist in Rack 1.x as well? I mean, is this approach fine with both Rack versions?
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.
@perlun yes it exists in Rack 1.x too. Yes it is fine for both rack 1.x and 2.x. Because Rack::Multipart
exists in both versions.
This modification is because rack
project have just deleted the code to access from Rack::Utils
to Multipart
from rack 2.x.
Below are the commit in rack
. and You can also see this kind of modification (replacement) in the commit.
$ git show b2d73960e9ea6b8b15321ef190f13a290d1aedf0 lib/rack/utils.rb
...
- Multipart = Rack::Multipart
-
...
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.
OK, great. Then I will approve and merge this now. Thanks @junaruga!
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.
Approved now. I will let you merge so you get the rebasing done right.
* Prepare test environment for both rack 1 and rack 2 on Travis. * Update .travis.yml. * Add "bundle list" in script section to check rack's version from Travis log page. * Update Gemfile for rack 2 test, and add gemfiles/Gemfile.rack-1 for rack 1 test. * Keep codeclimate-test-reporter version < 1. To supress deprecated warning temporary. Later update it to latest version. * Add gems to Gemfile for Thorfile. * Specify sinatra 2.0.0.rc2 version for rack 2 test. * Delete Gemfile.lock * Fix test suite for Rack 2.x compatiblity.
@perlun Thanks! Merged! |
@junaruga I was reminded that the "rebase individual commits" option is a bit ugly in that it does not keep any track whatsoever of the PR number (#151) and the new, rebased commits. This is not so nice I think, so maybe it's better to use the regular merge commits in these cases (even though I still think "squashed merge" is better for many cases). I'll change the settings accordingly. |
@perlun OK. |
It's no big deal Jun. I think the problem is with how GitHub handles "rebase individual commits". Take a look at 3e6fc7c I was about to say, but hey... it does actually show now in the GitHub UI that it comes from #151 after all. That's nice! I'll reenable the "rebase individual commits" option after all, it isn't that bad as I thought. 😆 |
Oh okay. I am seeing the commit page. Good catch, Github UI! |
Now rack latest version is 2.0.1
https://rubygems.org/gems/rack
And latest version Rails 5.0.0.1 has used rack 2 with latest version rack-test.
https://github.com/rails/rails/blob/v5.0.0.1/actionpack/actionpack.gemspec#L24
Also sinatra 2.0.0beta has used rack2
https://rubygems.org/gems/sinatra/versions/2.0.0.beta2
So, I think that it's time for our rack-test to support rack 2.x.
Currently we need to re-create Gemfile.lock after this PR.
However personally I think we do not need to manage Gemfile.lock on github.
If the module is complicated such as Rails, it may be useful to manage Gemfile.lock on github.
https://github.com/rails/rails/blob/v5.0.0.1/Gemfile.lock
But if the module is not complicated such "rack", it may be better not to manage Gemfile.lock on github with set it on .gitignore.
https://github.com/rack/rack/blob/2.0.1/.gitignore#L8
I included this pull-request's commit hash too.
#148