-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add Rails master appraisals in preparation for Rails 5 #1976
Conversation
appraise "4.2.awsv1" do | ||
gem "rails", "~> 4.2.0" | ||
appraise "master.awsv1" do | ||
gem 'rails', github: "rails/rails" | ||
gem "aws-sdk", "~> 1.5" | ||
end |
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.
Do we need to take this combination into account? When is AWS v1 end of life?
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.
Not sure about v1 support (this would be another big breaking change deprecation), but I can look into this.
Thanks so much @maclover7! Seems like the red CI comes from Thanks again! |
Pushed up change that should fix dependency resolution problems - hopefully we can see whether the test suite passes on master now. |
I don't know how AWS works. But if people are moving on to v2, as most Rails apps moved to 4, then it could be plausible to say "paperclip 5 only with AWS v2". But to be fair the code is already written, and I wouldn't expect it to change much, so it might not be worth it if it will bring unhappy users. |
If we are going to deprecate AWS v1 support, I'd say we should include deprecation warnings in the next release out the door, to give time to upgrade. |
👍 👏 |
Should I open up a ticket on rails/rails for that "syntax error" that's breaking the rails master travis build? https://travis-ci.org/thoughtbot/paperclip/jobs/79552598#L237 @tute |
It looks like that's Ruby >2 syntax. We should add an exception for Rails master/5 and Ruby 2 CI run (see for example https://github.com/doorkeeper-gem/doorkeeper/blob/master/.travis.yml#L16-L18). |
@tute Can you check my .travis.yml syntax - updated it in last commit to try and stop 2.0 and rails master from running |
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- rvm: jruby-19mode | ||
- rvm: rbx-2 | ||
exclude: | ||
- gemfile: master.awsv1.gemfile |
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.
Do we need to add the gemfiles/
path?
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.
yep, i think that's what the problem is. will squash down all of my commits before merging in :P
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.
yep, i think that's what the problem is. will squash down all of my commits before merging in :P
Excellent, and rebase on top of latest master too. Thank you, @maclover7! 👏
7ab68cf
to
57637b0
Compare
Rebased and consolidated --> just for maintenance of the code, is there any way to streamline our gemfiles and appraisals? Getting very cluttered now by testing 4 versions of Rails and 3 versions of aws-sdk. cc @jyurek |
I've been restarting CI but we always get the same timeout. Makes me think there's actually something wrong with either rails or our code? |
ba25c10
to
41a6c8e
Compare
Rebased your branch on top of latest master. Right now, That said, latest CI run had the following failure that we'll need to address:
Thanks! |
- gemfiles/4.2.awsv1.gemfile | ||
- gemfiles/4.2.awsv2.0.gemfile | ||
- gemfiles/4.2.awsv2.1.gemfile | ||
- gemfiles/master.awsv1.gemfile |
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.
I so want to get rid of AWS V1. :|
41a6c8e
to
8e4095f
Compare
This PR is back to "normal" failures, to be worked on. |
@maclover7 will rebase your branch, and make it point to 5 beta1, à la doorkeeper-gem/doorkeeper#753, unless you'd rather do it yourself, or do it differently. Thanks! |
Will start with smaller PRs removing from master unsupported versions of Rails (3.2 and 4.1), and AWS v1. |
8e4095f
to
e080faf
Compare
Rebased! Going to have a ton of time to work on this after tomorrow (yay school vacation!). Key stuff is to get out a 4.x release with deprecations, and then to move forward with 5.0.0, after Rails 5 is released. |
That is great! You might want to rebase again after #2074, with smaller CI matrix. I will now work on removing from master AWS v1 support. |
e080faf
to
2e01f84
Compare
- gemfiles/4.2.awsv1.gemfile | ||
- gemfiles/4.2.awsv2.1.gemfile | ||
- gemfiles/master.awsv2.0.gemfile | ||
- gemfiles/master.awsv2.1.gemfile |
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.
Should we do master
or 5.0.0.beta1
?
a80fc61
to
8016fcb
Compare
Did Rails 5 change Validators API? It looks like Fixing |
@sgrif: is the behavior described in #1976 (comment) an expected ActiveRecord change? Thank you. |
1c0d262
to
22c522f
Compare
The reason specs fail in Rails 5 seem to be that this validation block never runs: https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/validators.rb#L67-L69 send(:"before_#{attribute}_post_process", :if => if_clause, :unless => unless_clause) do |*args|
validator_class.new(options.dup).validate(self)
end I can't spot why that is. |
@rafaelfranca can you spot if a change in Rails 5 around callbacks (aside from the new option |
Not that I'm aware. The only change I remember is the way we internally execute a callback but that also changes in Rails 4.2 so you would be able to see the same problem in 4.2 if it was caused by that. |
1579de1
to
1c07805
Compare
module Reporting | ||
def silence_stream(stream) | ||
old_stream = stream.dup | ||
stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') |
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.
Line is too long. [86/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@kitop thank you very much for your help on this! I'd merge it as is, let me know if you'd like to change anything on the code or the commits before doing so. |
- Also bump Travis Ruby 2.2.x version to 2.2.4
`bundle exec rails -v` was taking seconds every time, making the test suite run very slow. This changes the code to compare the version against `ActiveRecord::VERSION`, which is going to be the same one as `rails -v`, making it much, much faster. Simplifies condition: we no longer support Rails < 4.2, so we test for `>= "5.0"` or fallback to `4.2` branch.
Ref: rails/rails@2386daa Specifically: > Chains of callbacks defined **with** a `:terminator` option will > maintain their existing behavior of halting as soon as a `before_` > callback matches the terminator's expectation. For instance, > ActiveModel's callbacks will still halt the chain when a `before_` > callback returns `false`. In terminator callbacks, the `result` value changed to be a lambda now. This change reflects that, updating the terminator to compare the result of the block to `false`. Also: * Removes Rails 4.1 branch (we don't support it anymore) * Rewrite for legibility: change `unless` for `if`
Ref: rails/rails@481e49c `silence_stream` was deprecated in Rails 4.2 and removed in Rails 5 because it was not thread safe. Paperclip is not running the tests in threaded mode, it's safe to add the method back in a test support module.
While working on this branch, Kito found that this test fails due to: rails/rails@6ec8ba1#diff-fdcf8b65b5fb954372c6fe1ddf284c78R76 We are not yet sure if it's a bug in paperclip or in Rails itself. With current `ActiveModel::Errors` implementation the following happens: ``` record.errors # => @messages = {} record.errors.include?(:foo) # => false record.errors # => @messages = { :foo => [] } ``` Which bit us in: https://github.com/thoughtbot/paperclip/blob/69f18375333234b6f395300266e2612936bd242e/lib/paperclip/validators/attachment_file_name_validator.rb#L23 Another related Rails commit: rails/rails@b97035d I worked around the issue by changing what we assert in this spec. I am still not sure that this is a bug in current Rails master. cc @kitop for review
1c07805
to
799845e
Compare
#1973
Also reorganized Appraisals to make it easier to understand