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

Fix cleanup! and prepare! Deprecations with Rails 5 #948

Merged
merged 4 commits into from Mar 31, 2017

Conversation

atomaka
Copy link

@atomaka atomaka commented Oct 21, 2016

Rails 5 deprecates cleanup! and prepare! causing a large amount of log spam from Delayed::Job:

DEPRECATION WARNING: cleanup! is deprecated and will be removed from Rails 5.1 (use Rails.application.reloader.reload! instead of cleanup + prepare) (called from require at bin/rails:9)
DEPRECATION WARNING: prepare! is deprecated and will be removed from Rails 5.1 (use Rails.application.reloader.prepare! instead) (called from require at bin/rails:9)

The first commit fixes existing issues with rubocop. Any easy corrections were made. Those that required refactorings were disabled.

@coveralls
Copy link

coveralls commented Oct 21, 2016

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling aeb7088 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

coveralls commented Nov 9, 2016

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling a866207 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@thomasdarde
Copy link

Hi , any reason for this PR not to be merged ?

@simonknoll
Copy link

@thomasdarde because the build failed.

@thomasdarde
Copy link

@atomaka Hi andrew, do you think you can update your PR for the build to pass ? Or tell me and I'll create another one

@atomaka
Copy link
Author

atomaka commented Mar 15, 2017

I'll take a look this evening. The build is failing because of a dependency issue on JRuby builds and, unfortunately, I haven't used JRuby. I briefly look at this five months ago when I submitted the PR, but didn't see an immediate fix. If this will be considered for merge, though, I'll spend a bit more time to get it to pass the builds.

For those that are still struggling with this, you can monkey patch on load to save yourselves from the log headaches: #944 (comment)

@thomasdarde
Copy link

Thanks @atomaka , maybe just rebasing the PR will solve the issue, I hope it's not to much work.

Copy link
Member

@albus522 albus522 left a comment

Choose a reason for hiding this comment

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

Couple of nit picks, but then we can probably get this merged in.

.gitignore Outdated
@@ -5,3 +5,4 @@
.rvmrc
/coverage
Gemfile.lock
.ruby-version
Copy link
Member

Choose a reason for hiding this comment

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

Nit pick, can we not include this please

Copy link
Author

Choose a reason for hiding this comment

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

This was just for my personal testing. This isn't prepared. Seeing what it takes to pass build.

Gemfile Outdated
if rails_version == 'edge' || rails_version.match(/5\.\d+\.\d+/)
gem 'activerecord-jdbcsqlite3-adapter',
git: 'https://github.com/jruby/activerecord-jdbc-adapter.git',
branch: 'rails-5'
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment here about when this can be taken out.

Copy link
Author

Choose a reason for hiding this comment

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

Yup. See first comment. Still in process of testing. See comment I am about to type

@albus522
Copy link
Member

Sorry for the inactivity, things have been kind of crazy for me

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 44c7478 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@atomaka
Copy link
Author

atomaka commented Mar 15, 2017

The issue here is that the activerecord-jdbc-adapter no longer works with Rails 5. There's a long lived issue about it dating back to December 2015. It was closed for some reason, but the issue persists (as can bee seen in the comment history). There is a branch that has Rails 5 support (that I am testing builds against now), but I don't know the support level on that branch.

It might be wiser to drop Rails 5 support with Jruby until they resolve the issue upstream.

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 73a92a4 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

Using Delayed::Job with Rails 5 will currently spam logs with a
deprecation message for cleanup! and prepare! in favor of
ActiveSupport::Reloader.  When ActiveSupport::Reloader is present, it
will be used. Otherwise, it will fall back to cleanup! and prepare!.
See jruby/activerecord-jdbc-adapter#700 which
is unresolved since December 2015, but closed.  A branch exists and we
can try using that to maintain support.
@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling d5af5c5 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.875% when pulling f2a2850 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling f2a2850 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling f2a2850 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling f2a2850 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

Some important notes for this:

BlockLength cop was disabled completely because of a large amount of
violations in the specs.

DuplicatedGem cop was disabled completely because we are using
conditionals to determine Gem versions and it was being triggered. I
don't see any other options for this cop so it looks like the only
option is to ignore.

YAMLLoad wants to use safe_load over load.  Not sure that's supported on
older versions

A few cops were disabled in specific code locations because I did not
know enough about the code to update and be sure that there was no risk.
@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 740bbca on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling 8877f67 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@atomaka
Copy link
Author

atomaka commented Mar 15, 2017

Only one more build failure. Rails 4.2.0 on Ruby 2.0 because of a Nokogiri issue. I'm not sure how to resolve, especially since when I reproduce locally, the correct version of Nokogiri is installed.

|-127-> rm -f Gemfile.lock && rbenv local 2.0.0-p598 && RAILS_VERSION="~> 4.2.0" bundle install
[SNIP]
Installing nokogiri 1.6.8.1 with native extensions
[SNIP]
Bundle complete! 13 Gemfile dependencies, 51 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Full version in gist: https://gist.github.com/atomaka/ba5f4909cb82e07347b6181ad2f5948f

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling d2383c4 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling d2383c4 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling d2383c4 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage decreased (-0.3%) to 90.867% when pulling d2383c4 on atomaka:bugfix/rails5-reloader into e3772d4 on collectiveidea:master.

@albus522 albus522 merged commit 10b1f1e into collectiveidea:master Mar 31, 2017
danielmorrison added a commit to collectiveidea/awesome_nested_set that referenced this pull request Apr 6, 2017
Based on some code from DelayedJob that seems to work. collectiveidea/delayed_job#948
danielmorrison added a commit to collectiveidea/awesome_nested_set that referenced this pull request Apr 6, 2017
Based on some code from DelayedJob that seems to work. collectiveidea/delayed_job#948
@cseelus
Copy link

cseelus commented Apr 24, 2017

Still not in master to work with Rails 5.1? 🤔

@timhaines
Copy link

@albus522 What's required to get this released in a new version of the gem?

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.

None yet

7 participants