Giter VIP home page Giter VIP logo

fastruby / next_rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clio/ten_years_rails

451.0 7.0 27.0 179 KB

A toolkit to upgrade your next Rails application

Home Page: https://www.fastruby.io/blog/upgrade-rails/dual-boot/dual-boot-with-rails-6-0-beta.html?utm_source=github&utm_medium=description&utm_campaign=github&utm_term=next-rails

License: MIT License

Ruby 96.19% Shell 3.81%
rails-upgrades upgrade-rails dual-boot hacktoberfest hacktoberfest2022

next_rails's Introduction

Next Rails

This is a toolkit to upgrade your next Rails application. It will help you set up dual booting, track deprecation warnings, and get a report on outdated dependencies for any Rails application.

This project is a fork of ten_years_rails

History

This gem started as a companion to the "Ten Years of Rails Upgrades" conference talk by Jordan Raine.

You'll find various utilities that we use at Clio to help us prepare for and complete Rails upgrades.

These scripts are still early days and may not work in every environment or app.

I wouldn't recommend adding this to your Gemfile long-term. Rather, try out the scripts and use them as a point of reference. Feel free to tweak them to better fit your environment.

Usage

bundle_report

Learn about your Gemfile and see what needs updating.

# Show all out-of-date gems
bundle_report outdated

# Show five oldest, out-of-date gems
bundle_report outdated | head -n 5

# Show all out-of-date gems in machine readable JSON format
bundle_report outdated --json

# Show gems that don't work with Rails 5.2.0
bundle_report compatibility --rails-version=5.2.0

# Show the usual help message
bundle_report --help
# Find minimum compatible ruby version with Rails 7.0.0
bundle_report ruby_check --rails-version=7.0.0

Application usage

Every now and then it will be necessary to add code like this to your application:

if NextRails.next?
  # Do things "the Rails 7 way"
else
  # Do things "the Rails 6.1 way"
end

The NextRails.next? method will use your environment (e.g. ENV['BUNDLE_GEMFILE]) to determine whether your application is running with the next set of dependencies or the current set of dependencies.

This might come in handy if you need to inject Ruby or Rails shims.

Deprecation tracking

If you're using RSpec, add this snippet to rails_helper.rb or spec_helper.rb (whichever loads Rails).

RSpec.configure do |config|
  # Tracker deprecation messages in each file
  if ENV["DEPRECATION_TRACKER"]
    DeprecationTracker.track_rspec(
      config,
      shitlist_path: "spec/support/deprecation_warning.shitlist.json",
      mode: ENV["DEPRECATION_TRACKER"],
      transform_message: -> (message) { message.gsub("#{Rails.root}/", "") }
    )
  end
end

If using minitest, add this somewhere close to the top of your test_helper.rb:

# Tracker deprecation messages in each file
if ENV["DEPRECATION_TRACKER"]
  DeprecationTracker.track_minitest(
    shitlist_path: "test/support/deprecation_warning.shitlist.json",
    mode: ENV["DEPRECATION_TRACKER"],
    transform_message: -> (message) { message.gsub("#{Rails.root}/", "") }
  )
end

Keep in mind this is currently not compatible with the minitest/parallel_fork gem!

Once you have that, you can start using deprecation tracking in your tests:

# Run your tests and save the deprecations to the shitlist
DEPRECATION_TRACKER=save rspec
# Run your tests and raise an error when the deprecations change
DEPRECATION_TRACKER=compare rspec

deprecations command

Once you have stored your deprecations, you can use deprecations to display common warnings, run specs, or update the shitlist file.

deprecations info
deprecations info --pattern "ActiveRecord::Base"
deprecations run
deprecations --help # For more options and examples

Right now, the path to the shitlist is hardcoded so make sure you store yours at spec/support/deprecation_warning.shitlist.json.

next_rails command

You can use next_rails to fetch the version of the gem installed.

next_rails --version
next_rails --help # For more options and examples

Dual-boot Rails next

This command helps you dual-boot your application.

next --init         # Create Gemfile.next and Gemfile.next.lock
vim Gemfile         # Tweak your dependencies conditionally using `next?`
next bundle install # Install new gems
next rails s        # Start server using Gemfile.next

Installation

Add this line to your application's Gemfile

NOTE: If you add this gem to a group, make sure it is the test env group

gem 'next_rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install next_rails

Setup

Execute:

$ next --init

Init will create a Gemfile.next and an initialized Gemfile.next.lock. The Gemfile.next.lock is initialized with the contents of your existing Gemfile.lock lock file. We initialize the Gemfile.next.lock to prevent major version jumps when running the next version of Rails.

Contributing

Have a fix for a problem you've been running into or an idea for a new feature you think would be useful? Want to see how you can support next_rails?

Take a look at the Contributing document for instructions to set up the repo on your machine!

Releases

next_rails adheres to semver. So given a version number MAJOR.MINOR.PATCH, we will increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards compatible manner, and
  3. PATCH version when you make backwards compatible bug fixes.

Here are the steps to release a new version:

  1. Update the version.rb file with the proper version number
  2. Update CHANGELOG.md to have the right headers
  3. Commit your changes to a release/v-1-1-0 branch
  4. Push your changes and submit a pull request
  5. Merge your pull request to the main branch
  6. Git tag the latest version of the main branch (git tag v1.1.0)
  7. Push tags to GitHub (git push --tags)
  8. Build the gem (gem build next_rails.gemspec)
  9. Push the .gem package to Rubygems.org (gem push next_rails-1.1.0.gem)
  10. You are all done!

License

The gem is available as open source under the terms of the MIT License.

next_rails's People

Contributors

arielj avatar boscomonkey avatar bronzdoc avatar cleicar avatar dependabot[bot] avatar dkhan avatar etagwerker avatar fbuys avatar fionadl avatar jamie avatar jnraine avatar juanvqz avatar kindoflew avatar knappe avatar lubc avatar magneland avatar manuca avatar mateusdeap avatar pendletons avatar rishijain avatar sean-dickinson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

next_rails's Issues

[BUG] `next` command clashes with `next` from Next.js library

Expected Behavior

next command should not clash with another library's command.

Actual Behavior

After running these steps:

npm install -g next
next start

I'd like it to use the next.js command.

Possible Fix

Rename the next_rails command to be next_rails so that it doesn't clash with Next.js's next command.

To Reproduce

  1. gem install next_rails
  2. npm install -g next
  3. git clone a next project
  4. next start

See something like this:

rbenv: next: command not found

The `next' command exists in these Ruby versions:
  2.7.2
  3.0.4
  3.1.3
  3.2.2

Then you can check which next command is getting used:

which next
/Users/etagwerker/.rbenv/shims/next

I will abide by the code of conduct

[REQUEST] Make next_rails compatible with older ruby versions

Branch/Commit:

Latest version I guess, it can't be installed

Problem:

next_rails currently requires ruby 2.3.0 or newer, which makes it incompatible with old rails projects using older ruby versions

we should find the reason for this limitation and maybe add some note or workaround, or maybe we can split the gem into different gems with different ruby restrictions if maybe the ruby restrictions is there because one feature and not for everything

I will abide by the code of conduct

[BUG] Coverage reporting for the test suite is inaccurate

IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.

Before we start...:

  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)

Version, Branch, or Commit:

main branch.

Expected behavior:

Coverage should be higher than 77.15%

Actual behavior:

Coverage is reported at 33.95%

Steps to reproduce:

Run the main branch's test suite with COVERAGE=true in your console.

Context and environment:

The problem is related to the suite loading the application code first and then SimpleCov. SimpleCov should be loaded as the very first thing in the spec helper file.

Logs

Current

➜  next_rails git:(main) ✗ COVERAGE=true bundle exec rake
/Users/etagwerker/.rvm/rubies/ruby-2.6.3/bin/ruby -I/Users/etagwerker/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.10.1/lib:/Users/etagwerker/.rvm/gems/ruby-2.6.3/gems/rspec-support-3.10.2/lib /Users/etagwerker/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb

DeprecationTracker
  #add
    groups messages by bucket
    ignores messages when bucket null
    transforms messages before adding them
  #compare
    ignores buckets that have no messages
    raises an error when recorded messages are different for a given bucket
  #save
    saves to disk
    creates the directory if shitlist directory does not exist
    combines recorded and stored messages
    overwrites stored messages with recorded messages with the same bucket
    sorts by bucket
    sorts messages
  #after_run
    calls save if in save mode
    calls compare if in compare mode
    does not save nor compare if mode is invalid
  DeprecationTracker::KernelWarnTracker
    captures Kernel#warn
    captures Kernel.warn

NextRails::BundleReport
  #compatible_ruby_version
    when rails_version is a valid one
The required ruby version is >= 2.7.0 for matched rails version 7.0.0
      returns the correct ruby version
    when partial rails_version is passed as argument
The required ruby version is >= 2.7.0 for matched rails version 7.0.0
      returns the correct ruby version
    when rails_version is an invalid one
Could not find a compatible ruby version
      returns nil for ruby version

NextRails::GemInfo
  #age
    returns a date

NextRails
  has a version number

Finished in 0.05589 seconds (files took 0.43682 seconds to load)
21 examples, 0 failures

Coverage report generated for RSpec to /Users/etagwerker/Projects/fastruby/next_rails/coverage. 183 / 539 LOC (33.95%) covered.

Expected

➜  next_rails git:(main) ✗ COVERAGE=true bundle exec rake
/Users/etagwerker/.rvm/rubies/ruby-2.6.3/bin/ruby -I/Users/etagwerker/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.10.1/lib:/Users/etagwerker/.rvm/gems/ruby-2.6.3/gems/rspec-support-3.10.2/lib /Users/etagwerker/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb

DeprecationTracker
  #add
    groups messages by bucket
    ignores messages when bucket null
    transforms messages before adding them
  #compare
    ignores buckets that have no messages
    raises an error when recorded messages are different for a given bucket
  #save
    saves to disk
    creates the directory if shitlist directory does not exist
    combines recorded and stored messages
    overwrites stored messages with recorded messages with the same bucket
    sorts by bucket
    sorts messages
  #after_run
    calls save if in save mode
    calls compare if in compare mode
    does not save nor compare if mode is invalid
  DeprecationTracker::KernelWarnTracker
    captures Kernel#warn
    captures Kernel.warn

NextRails::BundleReport
  #compatible_ruby_version
    when rails_version is a valid one
The required ruby version is >= 2.7.0 for matched rails version 7.0.0
      returns the correct ruby version
    when partial rails_version is passed as argument
The required ruby version is >= 2.7.0 for matched rails version 7.0.0
      returns the correct ruby version
    when rails_version is an invalid one
Could not find a compatible ruby version
      returns nil for ruby version

NextRails::GemInfo
  #age
    returns a date

NextRails
  has a version number

Finished in 0.05839 seconds (files took 0.51505 seconds to load)
21 examples, 0 failures

Coverage report generated for RSpec to /Users/etagwerker/Projects/fastruby/next_rails/coverage. 314 / 407 LOC (77.15%) covered.

I will abide by the code of conduct

[Feature] Add Badges to README

next_rails is FastRuby's 2nd most starred project (after Skunk) so it would be nice to have badges in the README like the other projects do.

Before we start...:

  • I checked the documentation and didn't find this feature
  • I checked to make sure that this feature has not already been requested

Problem:

As a potential user of next_rails
I want to see relevant stats about the project
So that I can accurately assess if I'd like to use it

I will abide by the code of conduct

README doesn't include a Development section or Contributing section.

The README has information about adding the gem to your project, but no information about contributing or setting up the repo locally.

We should add sections dealing with this information.

The information should include how to setup the project locally and what contribution guidelines we have. For example:
I wasn't sure what link to add in the CHANGELOG. This could be described in the README

NameError: uninitialized constant DeprecationTracker

i am not able to use this gem!
i'd be thankful if i get some support!

prateek@prateek-Vostro-3558:~/Desktop/myProject/project_name$ DEPRECATION_TRACKER=save rspec

An error occurred while loading spec_helper.
Failure/Error:
  DeprecationTracker.track_rspec(
    config,
    shitlist_path: "spec/support/deprecation_warning.shitlist.json",
    mode: ENV["DEPRECATION_TRACKER"],
    transform_message: -> (message) { message.gsub("#{Rails.root}/", "") }
  )

NameError:
  uninitialized constant DeprecationTracker

support spring

Thanks for the work on this fork/gem.

I think that currently commands like next rails c when you have "springified" your rails will cause errors, or will always invoke the previous rails rather than the current one. I think this is a matter of making the ENV var changes exported from the next.sh script in line 39

BUNDLE_GEMFILE=Gemfile.next BUNDLE_CACHE_PATH=vendor/cache.next bundle exec $@

ie. changing this to

    export BUNDLE_GEMFILE=Gemfile.next BUNDLE_CACHE_PATH=vendor/cache.next 
    bundle exec $@

This is quite a small change so it might be easier if a committer did it, but happy to contribute a PR.

Error installing next_rails: zeitwerk requires Ruby version >= 2.4.4.

Hi there, I am trying to use this gem to upgrade a rails app from 3.2 using ruby 2.3.0, but i am unable to install it. I get the following error:

❯ gem install next_rails
Fetching: colorize-0.8.1.gem (100%)
Successfully installed colorize-0.8.1
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: tzinfo-1.2.7.gem (100%)
Successfully installed tzinfo-1.2.7
Fetching: zeitwerk-2.3.1.gem (100%)
ERROR:  Error installing next_rails:
        zeitwerk requires Ruby version >= 2.4.4.


❯ gem env
RubyGems Environment:      
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/share/rvm/gems/ruby-2.3.0@upgrails4
  - USER INSTALLATION DIRECTORY: /home/vagrant/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /usr/share/rvm/rubies/ruby-2.3.0/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/share/rvm/gems/ruby-2.3.0@upgrails4/bin
  - SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/share/rvm/gems/ruby-2.3.0@upgrails4
     - /usr/share/rvm/gems/ruby-2.3.0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/share/rvm/gems/ruby-2.3.0@upgrails4/bin
     - /usr/share/rvm/gems/ruby-2.3.0@global/bin
     - /usr/share/rvm/rubies/ruby-2.3.0/bin
     - /usr/share/rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

Any help will be appreciated, thanks!

Using next_rails on Heroku

IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.

Before we start...:

  • [x ] I checked the documentation and found no answer
  • [x ] I checked to make sure that this issue has not already been filed
  • [ x] I'm reporting the issue to the correct repository (for multi-repository projects)

Version, Branch, or Commit:
next_rails 1.2.0
What branch/commit/version of "next_rails" you are using?
master (I am using the latest version of gem)
Expected behavior:

This fastruby post, seems to imply the next_rails features can be used on staging by setting BUNDLE_GEMFILE=Gemfile.next

In development and test environments I used next_rails to upgrade my app from rails 6.0.5.1 to 6.1.6.1. The next_rails gem was very useful, and all my tests passed and the server ran in 6.0 and 6.1. I was expecting that when I deployed the app to the heroku staging server, that the server would work in 6.0 and when I set BUNDLE_GEMFILE=Gemfile.next using heroku config:set that the server would work with 6.1.
Actual behavior:

In order to debug the problem, I put the following code in the Gemfile
puts "next?: #{next?}, file: #{File.basename(__FILE__)}"
which allowed me to see which state the app was meant to be.

The app deployed to staging, and the server worked with 6.0. I then set BUNDLE_GEMFILE=Gemfile.next and the app crashed with the following error messages.

2022-08-21T04:38:10.315494+00:00 heroku[web.1]: Starting process with command `bundle exec puma -p 42091 -C ./config/puma.rb`
2022-08-21T04:38:10.430822+00:00 heroku[worker.1]: Starting process with command `bundle exec rails jobs:work`
2022-08-21T04:38:11.011685+00:00 heroku[worker.1]: State changed from starting to up
2022-08-21T04:38:11.531042+00:00 app[worker.1]: bundler: failed to load command: rails (/app/vendor/bundle/ruby/2.7.0/bin/rails)
2022-08-21T04:38:11.531229+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/definition.rb:481:in `materialize': Could not find rails-6.1.6.1, actioncable-6.1.6.1, actionmailbox-6.1.6.1, actionmailer-6.1.6.1, actionpack-6.1.6.1, actiontext-6.1.6.1, actionview-6.1.6.1, activejob-6.1.6.1, activemodel-6.1.6.1, activerecord-6.1.6.1, activestorage-6.1.6.1, activesupport-6.1.6.1, railties-6.1.6.1, tzinfo-2.0.5 in any of the sources (Bundler::GemNotFound)
2022-08-21T04:38:11.531255+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/definition.rb:190:in `specs'
2022-08-21T04:38:11.531258+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/definition.rb:238:in `specs_for'
2022-08-21T04:38:11.531259+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/runtime.rb:18:in `setup'
2022-08-21T04:38:11.531261+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler.rb:151:in `setup'
2022-08-21T04:38:11.531263+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/setup.rb:20:in `block in <top (required)>'
2022-08-21T04:38:11.531272+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/ui/shell.rb:136:in `with_level'
2022-08-21T04:38:11.531274+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/ui/shell.rb:88:in `silence'
2022-08-21T04:38:11.531276+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/setup.rb:20:in `<top (required)>'
2022-08-21T04:38:11.531278+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli/exec.rb:56:in `require_relative'
2022-08-21T04:38:11.531287+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli/exec.rb:56:in `kernel_load'
2022-08-21T04:38:11.531289+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli/exec.rb:23:in `run'
2022-08-21T04:38:11.531291+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:483:in `exec'
2022-08-21T04:38:11.531293+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
2022-08-21T04:38:11.531303+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
2022-08-21T04:38:11.531305+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
2022-08-21T04:38:11.531306+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:31:in `dispatch'
2022-08-21T04:38:11.531315+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
2022-08-21T04:38:11.531317+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:25:in `start'
2022-08-21T04:38:11.531319+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/exe/bundle:48:in `block in <top (required)>'
2022-08-21T04:38:11.531321+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
2022-08-21T04:38:11.531323+00:00 app[worker.1]: from /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/exe/bundle:36:in `<top (required)>'
2022-08-21T04:38:11.531333+00:00 app[worker.1]: from /app/vendor/bundle/bin/bundle:113:in `load'
2022-08-21T04:38:11.531335+00:00 app[worker.1]: from /app/vendor/bundle/bin/bundle:113:in `<main>'
2022-08-21T04:38:11.532046+00:00 app[worker.1]: next?: true, file: Gemfile.next
2022-08-21T04:38:11.753017+00:00 heroku[worker.1]: State changed from up to crashed
2022-08-21T04:38:11.760087+00:00 heroku[worker.1]: State changed from crashed to starting
2022-08-21T04:38:11.929927+00:00 heroku[web.1]: Process exited with status 1

Note that at the fourth last line in the error message above, the debug code shows Gemfile.next is being used.

If I do heroku run bash -r staging and then do next bundle install, it installs successfully 6.1. If I then do next rails s then the server starts OK, so I wonder if I need to add some preparation steps to the Procfile, such as web: bundle install?
Steps to reproduce:

How do I achieve this behavior? Use the following format to provide a step-by-step guide:

  1. Produce a dual booting app that has a working server for both versions of rails
  2. Deploy app to heroku, and check the server is working in the earlier version of rails.
  3. heroku run rake config:set BUNDLE_GEMFILE=Gemfile.next -r staging4.
  4. check the server is working in the later version of rails.
    Context and environment:

Provide any relevant information about your setup (Customize the list accordingly based on what info is relevant to this project)

  1. Heroku stack-18
  2. rails 6.1.5.1
  3. rails 6.1.6.1
  4. ruby 2.7.6

I will abide by the code of conduct

[BUG] undefined method after_run when running Minitest version 4

Expected Behavior

Be able to use the Minitest deprecation tracker with Ruby 2.3.8 and Rails 3.2.22.5 using the Minitest gem at version 4.7.5

Actual Behavior

If I run the deprecation tracker it breaks with the following error:

vendor/bundle/ruby/2.3.0/gems/next_rails-1.3.0/lib/deprecation_tracker.rb:107:in `track_minitest': undefined method `after_run' for MiniTest:Module (NoMethodError)

Possible Fix

Add a check in the next_rails gem if the app is using Minitest v4, then instead of using after_run it should use the correct method (I think it was after_tests).

To Reproduce

  1. Have a Rails 3.2 with Ruby 2.3 and have Minitest v4.7.3 installed
  2. Configure the deprecation tracker for Minitest
  3. Run the test suite saving the deprecations
  4. see the error

Additional Information

I researched a little bit it seems like the Minitest gem at version 4.7.3 doesn't have the after_run method, it was initially introduced at version 5.0.0

If there are more questions feel free to ping me, 👍

I will abide by the code of conduct

Errors when running on Ruby 2.3 and Rails 2.3 LTS

When running bundle_report outdated on a Rails 2.3 LTS project the following errorr is returned:

You have already activated activesupport 5.2.4.4, but your Gemfile requires activesupport 2.3.18.31

The complete output is:

WARN: Unresolved specs during Gem::Specification.reset:
      i18n (< 2, >= 0.7)
      minitest (~> 5.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/bundle/gems/next_rails-1.0.2/exe/bundle_report:8:in `require': cannot load such file -- next_rails (LoadError)
	from /usr/local/bundle/gems/next_rails-1.0.2/exe/bundle_report:8:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-1.12.5/lib/bundler/runtime.rb:35:in `block in setup': You have already activated activesupport 5.2.4.4, but your Gemfile requires activesupport 2.3.18.31. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
	from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/runtime.rb:20:in `map'
	from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/runtime.rb:20:in `setup'
	from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup'
	from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/setup.rb:9:in `<top (required)>'
	from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
	from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
	from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
	from /usr/local/bundle/gems/next_rails-1.0.2/exe/bundle_report:57:in `<top (required)>'
	from /usr/local/bundle/bin/bundle_report:22:in `load'
	from /usr/local/bundle/bin/bundle_report:22:in `<main>'

I think if next_rails avoided actionview as a strict dependency by removing spec.add_runtime_dependency "actionview" from the gemspec it might help. Actionview is in fact optional from what I've seen in the code so I believe this wouldn't be an issue.

There is also #4 which is somewhat related.

Merge multiple shitlist.json files into one?

This is an idea proposed by @bronzdoc:

What if we have 12 shitlist.json files because the CI service is running 12 different containers?

It would be great if we can have a sort of "merge" feature that merges shitlist.json files by root cause

It would be great to group by root cause and then list all unique occurrences.

[BUG] bundle_report outdated is raising an exception

  • [x ] I checked the documentation and found no answer
  • [x ] I checked to make sure that this issue has not already been filed
  • [ x] I'm reporting the issue to the correct repository (for multi-repository projects)

Version, Branch, or Commit:

What branch/commit/version of "next_rails" you are using? version 1.2.0

Expected behavior:
When I run bundle_report outdated I expected to see a list of outdated gems.

Actual behavior:

With version v1.2.0 if I run bundle_report outdated

I see the following exception

  3: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/exe/bundle_report:57:in `block in <top (required)>'
  2: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:100:in `outdated'
  1: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:100:in `reject'
/Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/gem_info.rb:72:in `up_to_date?': undefined local variable or method `latest_version' for #<NextRails::GemInfo:0x00007fecaa2b1990> (NameError)

However if I revert to v1.0.4 then bundle_report outdated does provide a list of outdated gems.

As well in v1.2.0 if I run bundle_report compatability it gives the following exception

from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/exe/bundle_report:59:in `block in <top (required)>'
  4: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:16:in `compatibility'
  3: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:16:in `group_by'
  2: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:16:in `each'
  1: from /Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:16:in `block in compatibility'
/Users/myname/.rvm/gems/ruby-2.7.6/gems/next_rails-1.2.0/lib/next_rails/gem_info.rb:82:in `state': undefined method `version' for nil:NilClass (NoMethodError)

I worked out this is because I was not providing the --rails-version option
but in v1.0.4, bundle_report compatability does list the incompatibilities for upgrading to version 5 of rails. Which is not particularly helpful, but nicer than generating an exception. Perhaps a new feature would be to give an error message if someone forgets to add the --rails-version option along the lines of

warning - need to specify the rails version with the --rails-version option.

Steps to reproduce:

How do I achieve this behavior?
Install next_rails gem in Gemfile and bundle install, then

  1. bundle_report outdated
  2. bundle_report compatability
    Context and environment:

Provide any relevant information about your setup (Customize the list accordingly based on what info is relevant to this project)

  1. Version of the software the issue is being opened for.
  2. Operating System: MacOS
  3. Operating System version 12.5.1
  4. Ruby version: 2.7.6

I will abide by the code of conduct

[BUG] Update list of Rails gems to include actionmailbox and actiontext

Expected Behavior

When running bundle_report compatibility --rails-version=7.0 I don't expect to see gems listed that are part of Rails, but I do

Actual Behavior

bundle_report compatibility --rails-version=7.0
=> Incompatible with Rails 7.0 (with new versions that are compatible):
These gems will need to be upgraded before upgrading to Rails 7.0.

actionmailbox 6.1.7 - upgrade to 7.0.0
actiontext 6.1.7 - upgrade to 7.0.0

2 gems incompatible with Rails 7.0

Possible Fix

I believe it can be fixed by adding them to the list here:

private def rails_gems

To Reproduce

See sample output above

Additional Information

I will abide by the code of conduct

[BUG] `KernelWarnTracker#warn` signature is incorrect

Expected Behavior

When I configure the deprecation tracker in a rails_helper file using Ruby 2.7, and when the transform_message option attempts to call methods on the message variable not present in Hash, it shouldn't produce any errors.

Actual Behavior

When I configure the deprecation tracker in a rails_helper file using Ruby 2.7, and when the transform_message option attempts to call methods on the message variable not present in Hash, it produced a NoMethodError

Possible Fix

The issue is because the warn method, as of ruby 2.5, has the uplevel keyword arg. Since our signature only specifies *messages, that ends up becoming a hash with both the messages and the uplevel arg.

Hence, if your transform_message option attempts to manipulate what next_rails provides as a message, it will eventually be given a Hash with the uplevel key.

The most immediate fix is to change the signature of KernelWarnTracker#warn to match the current signature. We'll need to check ruby versions, since this was introduced in ruby 2.5. We'll also probably have to study how to properly deal with the uplevel arg.

To Reproduce

I was able to come up with a spec to reproduce the error. There might be some organizational changes needed concerning the use of contexts, but it catches the bug.

describe "bug when warning uses the uplevel keyword argument" do
  context "given I setup the DeprecationTracker::KernelWarnTracker with a callback that manipulates messages as Strings" do

    DeprecationTracker::KernelWarnTracker.callbacks << -> (message) { message.gsub("Rails.root/", "") }

    context "and given that I call code that emits a warning using the uplevel keyword arg" do
      it "throws a MissingMethod Error" do
        expect{ Kernel.warn("Oh no", uplevel: 1) }.not_to raise_error
      end
    end
  end
end

I will abide by the code of conduct

If `spec/support` directory does not exist, deprecation tracking fails with an ENOENT

Here are the steps to reproduce this issue:

  1. Use a Rails application that has RSpec set up.
  2. Make sure that spec/support does not exist. If it exists, remove that directory.
  3. Run your test suite with DEPRECATION_TRACKER=save in order to save all deprecation warnings in a JSON file.

Current behavior

It will raise an Errno::ENOENT error because it can't find that directory (spec/support)

Expected behavior

It should create the directory if it doesn't find it. It should not raise an Errno::ENOENT

Notes

Here is the output that I have where I was trying to save deprecation warnings:

DEPRECATION_TRACKER=save bundle exec rspec

Randomized with seed 51288
.............................................Capybara starting Puma...
* Version 3.12.6 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:55653
.Unexpected confirm modal - accepting.You should be using `accept_confirm` or `dismiss_confirm`.
.......................................
An error occurred in an `after(:suite)` hook.
Failure/Error:
  File.open(dest, 'wb', s.stat.mode) do |f|
    IO.copy_stream(s, f)
  end

Errno::ENOENT:
  No such file or directory @ rb_sysopen - spec/support/deprecation_warning.shitlist.json
# /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/next_rails-1.0.2/lib/deprecation_tracker.rb:133:in `save'
# /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/next_rails-1.0.2/lib/deprecation_tracker.rb:64:in `block in track_rspec'


Finished in 14.14 seconds (files took 4.19 seconds to load)
85 examples, 0 failures, 1 error occurred outside of examples

Randomized with seed 51288

The project that I was using is https://github.com/fastruby/points which is open source too.

`bundle_report` may confuse local private gem with remote public gem

Description

I came accross this in a project where I had to upgrade rails from 5.2 to 6.1 and it had a private gem called app_store.

The issue may come up if there is a gem with the same name in the public source, in this case, rubygems.

If you go to rubygems you will find an app_store gem there. Here's the github

In this specific case, if I ran bundle_report, it would say:

app_store 0.1.0 - upgrade to 0.1.2

Which has no version restriction on rails and has not been updated in 12 years. The actual gem being used was in the engines/ folder of the project, which did have a restriction on rails and had to be altered to accept rails 6.1.

Expected behavior

bundle_report should've grouped this gem with the other private gems as having no new version found for it. Maybe, ideally, be able to tell that it is a private gem and suggest it's gemspec be updated?

Steps to reproduce

I've not tested this with other gems, but I'd try:

  1. Declare some local private gem in a test project using rails 5 or 6 that has the same name of some public gem in rubygems.
  2. Have the local gem be incompatible with some newer version of rails, like rails 7.
  3. Make sure that it's version is equal to some version of the gem in rubygems. Don't know if this is strictly required, but it would mirror the situation I found.
  4. Add it to the Gemfile like so: gem 'gem_with_same_name_as_some_remote_gem', path: '/local/path'
  5. Run bundle install and then run bundle_report.

[BUG] Tests run twice for PRs

Version, Branch, or Commit:

Main branch

Expected behavior:

Each job in the matrix should run once.

Actual behavior:

Each job is run twice, once because of the pull_request trigger and once because of the push trigger.

image

Steps to reproduce:

  1. Create a PR
  2. Push something to the branch
  3. Jobs for each ruby version are run twice (check the image above)

I will abide by the code of conduct

[REQUEST] Support parallel testing

Description

Splitting test files into multiple processes on continuous integration platforms has become common to reduce run time.

For example, on GitHub Actions, you might create a workflow which utilizes a matrix strategy. You can read a blog post on the subject here.

The compare mode for next_rails is too simplistic to account for this type of setup. Each process will create a different shitlist file which fails the diff comparison.

Possible Implementation

Create a new comparison mode that checks file content.

Committed file:

  "./spec/file_one.rb": [
    "DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is deprecated without replacement. ...",
    "DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is deprecated without replacement. ..."
  ],
  "./spec/file_two.rb": [
    "DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: ...",
    "DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: ..."
  ]

Matrix Job One:

  "./spec/file_one.rb": [
    "DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is deprecated without replacement. ...",
    "DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is deprecated without replacement. ..."
  ]

Matrix Job Two:

  "./spec/file_two.rb": [
    "DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: ...",
    "DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: ..."
  ]

Both Matrix jobs fail when comparing using a diff. However, it would pass if we searched for that content in the committed file.

Resources:

I will abide by the code of conduct

[REQUEST] A command to `promote` the next rails version

Description

When we are ready to move to the next version after some time of dual booting, we have to do some manual steps:

  • remove the old Gemfile.lock, replace it with the Gemfile.next.lock
  • change the if / else conditional in the Gemfile to set the next as the current and add a new next (or remove the conditionals)
  • go through the code looking for conditionals to remove them
  • we might want to set up the next dual boot jump or maybe not and wait until deprecations are fixed for example

It would be nice to have something like next promote or something like that to automate these steps or at least facilitate them. Maybe with some arguments to decide if we want to re-add the new dual booting or just remove it, if we want to do something with conditionals in the code, etc (though we would need to define some conventions for this to make sense)

Possible Implementation

I don't have an implementation idea, I imagine some simple file renaming, file parsing with search/replace can work for the basics.

Resources:

I don't have any resource to link to either.

I will abide by the code of conduct

[FEATURE] `bundle_report outdated` outputs in JSON format when passed optional argument

Optionally specifying JSON as an output format will allow users to easily run bundle_report as a scheduled job (or as part of CI/CD) and alert on required upgrades.

For example: bundle_report outdated --json outputs

[
  {
    "gem": "rspec-support",
    "installed_version": "3.10.2",
    "installed_released_at": "2021-01-28",
    "latest_version": "3.11.0",
    "latest_released_at": "2022-02-09"
  },
  {
    "gem": "rspec-mocks",
    "installed_version": "3.10.2",
    "installed_released_at": "2021-01-28",
    "latest_version": "3.11.0",
    "latest_released_at": "2022-02-09"
  },
  {
    "gem": "msgpack",
    "installed_version": "1.4.2",
    "installed_released_at": "2021-02-01",
    "latest_version": "1.4.5",
    "latest_released_at": "2022-02-15"
  }
]

Link to COC is broken in PR templates

The link in the templates is CODE_OF_CONDUCT.md and that uses the current url, so for pull requests it ends up being https://github.com/fastruby/next_rails/pull/CODE_OF_CONDUCT.md

Not working with github repositories

In my Gemfile I have a number of gems that use the github source because the gem has not been updated e.g.
gem 'apparition', github: 'twalpole/apparition', ref: 'ca86be4d54af835d531dbcd2b86e7b2c77f85f34'
When I run next bundle update I get the following error
The git source https://github.com/twalpole/apparition.git is not yet checked out. Please run bundle install before trying to start your application
Running bundle install just does a successful installation but does not fix the problem.

Is there a way to work around this?

Release v1.0.3

Hi @fastruby/black-bunny-brigade!

There was some confusion in #18 because of an unreleased set of changes in main

Could you please release v1.0.3 this week? It will make it easier to use this gem with older versions of Rails and Ruby.

Thanks!

[BUG] Deprecation Tracker is not working correctly in Rails 4.2

Expected Behavior

Support Rails 4

Actual Behavior

It returns this error message

       ArgumentError:
         wrong number of arguments (given 2, expected 4)
       # /bundle/gems/next_rails-1.0.4/lib/deprecation_tracker.rb:48:in `block in track_rspec'

Possible Fix

Add support for it, According to this article, Rails 4 and before, the ActiveSupport::Deprecation.behavior only accepted 2 arguments.

ActiveSupport::Deprecation.behavior << -> (message, _callstack = nil, _deprecation_horizon = nil, _gem_name = nil) {
deprecation_tracker.add(message)
}

To Reproduce

  1. Install the next_rails gem in a Rails 4 app
  2. Configure the deprecation warning
  3. Run the test suite
  4. Receive the error message above

Additional Information

Wasn't sure if this is a feature or a bug :)

I will abide by the code of conduct

next_rails requires actionview, which depends on activesupport

Problem:

next_rails requires actionview, of which the minimum attainable version is 4.1.0: https://rubygems.org/gems/actionview/versions

In this version, it depends on activesupport version 4.1.2rc:

Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (= 3.2.22.5)

  In Gemfile:
    actionview (~> 4.1) was resolved to 4.1.2.rc1, which depends on
      activesupport (= 4.1.2.rc1)

    rails (= 3.2.22.5) was resolved to 3.2.22.5, which depends on
      activesupport (= 3.2.22.5)

As a result, next_rails cannot be used for Rails 3 upgrade projects.

[BUG] ERB fails to process template with `trim_mode: "-"`

Expected Behavior

Generating the report should succeed with no error.

Actual Behavior

In some cases (maybe specific ERB versions and Ruby versions combination?), there's an error in this line:

https://github.com/fastruby/next_rails/blob/main/lib/next_rails/bundle_report.rb#L52

TypeError: no implicit conversion of Hash into Integer

ERB 2.1.0 does NOT support the trim_mode: keyword argument, it has a positional argument.

Possible Fix

Check which version of ERB is the project running (with ERB.version) and use different parameters.

To Reproduce

Use an old ERB version (has to be older than 2.2)
Call ERB.new("some string", trim_mode: "-").result(binding) and it should fail with the error.
Call ERB.new("some_string", nil, "-").result(binding) and it should work

Additional Information

Found this with ERB 2.1.0 and Ruby 2.3.8.

I will abide by the code of conduct

[REQUEST] Add a `dual-run` command to run a single command with both versions

Description

When using next rails, we can dual boot the app and run different commands either in the current or in the next version of gems.

This is fine but it's really common to need to run the same command in both versions to compare results and currently we have 2 options:

  • run one after the other sequentially
  • run them in different terminals in parallel

The cons of these 2 approaches are:

  • when running sequentially, the time it takes to run everything is added, so if a test file takes 1 minute, running both to compare is 2 minutes. over time, these adds up to a lot of time waiting
  • when running then in different terminals, we have to switch back and fort and manually execute/change commands on both sides

This feature request is about having a binary that would run one single command in the 2 versions in parallel in the same terminal and then print the output of both.

The benefits would be:

  • saves time
  • removes the context switching

Possible Implementation

What I imagine is a script that starts 2 threads. The output of the next version can be streamed back to the main process, so the user can see that things are working. The output of the current version can be captured and printed at the end when both threads finished so the outputs are not mixed.

I don't know what's the best command name, I said dual-run but happy to change it to anything else.

Resources:

We have to be sure to use Ruby 2.0.0 features by default since we want to support that version. https://ruby-doc.org/core-2.0.0/Thread.html

And only use newer features if required for specific Ruby versions.

I will abide by the code of conduct

[BUG] bundle_report compatibility failed in Ruby 2.5

Expected Behavior

Output with the compatibility report

Actual Behavior

root@70c723e353c8:/app# bundle_report compatibility --rails-version=5.1.7
Traceback (most recent call last):
        3: from /usr/local/bundle/gems/next_rails-1.2.4/exe/bundle_report:64:in `block in <top (required)>'
        2: from /usr/local/bundle/gems/next_rails-1.2.4/lib/next_rails/bundle_report.rb:52:in `compatibility'
        1: from /usr/local/lib/ruby/2.5.0/erb.rb:874:in `result'
/usr/local/lib/ruby/2.5.0/erb.rb:872:in `block in result': no implicit conversion of Hash into Integer (TypeError)

root@70c723e353c8:/app# ruby --version
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]

root@70c723e353c8:/app# next_rails --version
1.2.4

Possible Fix

I don't know

To Reproduce

Run the compatibility report with ruby 2.5 version

Additional Information

next_rails version: 1.2.4
ruby version: 2.5

If need more debugging I can help

I will abide by the code of conduct

bundle_report indicates no compatibility with given Rails version despite there is a compatible one

Hello.

I am using the next_rails gem to walk me through the easiest paths to upgrade our codebase.

I had the following dependencies:

gem 'rails',                          '4.2.11.3'
gem 'coffee-rails',                 '4.0.1'

When running bundle exec bundle_report compatibility --rails-version=5.0.0 I got:

=> Incompatible with Rails 5.0.0 (with no new compatible versions):
These gems will need to be removed or replaced before upgrading to Rails 5.0.0.
coffee-rails 4.0.1 - new version, 5.0.0, is not compatible with Rails 5.0.0
15 gems incompatible with Rails 5.0.0

However, version 4.1.1 is compatible with Rails 5.

I am wondering if improving this report to try find the bare minimum version that's compatible with Rails 5 is possible or is out of scope of this gem.

Regards, Matias.

`DEPRECATION_TRACKER=save rspec spec` raises `ArgumentError`

Steps to reproduce this issue:

  • Setup DeprecationTracker by following the README
  • Create spec/support dir
  • Make sure there is at least one deprecation warning in the app
  • Run DEPRECATION_TRACKER=save rspec spec or DEPRECATION_TRACKER=save next rspec spec

Error

ArgumentError:
       wrong number of arguments (given 2, expected 4)
     # /usr/local/bundle/gems/next_rails-1.0.0/lib/deprecation_tracker.rb:48:in `block in track_rspec'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/reporting.rb:21:in `block (2 levels) in warn'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/reporting.rb:21:in `each'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/reporting.rb:21:in `block in warn'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/reporting.rb:20:in `tap'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/reporting.rb:20:in `warn'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/instance_delegator.rb:20:in `warn'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/deprecation/instance_delegator.rb:27:in `warn'
     # /usr/local/bundle/gems/actionpack-5.0.7.2/lib/action_controller/test_case.rb:663:in `non_kwarg_request_warning'
     # /usr/local/bundle/gems/actionpack-5.0.7.2/lib/action_controller/test_case.rb:646:in `process_with_kwargs'
     # /usr/local/bundle/gems/actionpack-5.0.7.2/lib/action_controller/test_case.rb:389:in `get'
     # /usr/local/bundle/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/integration.rb:16:in `block (2 levels) in <module:Integration>'
     # ./spec/controllers/leaderboard_controller_spec.rb:185:in `block (5 levels) in <top (required)>'
     # /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/testing/time_helpers.rb:110:in `travel_to'
     # ./spec/controllers/leaderboard_controller_spec.rb:184:in `block (4 levels) in <top (required)>'
     # /usr/local/bundle/gems/next_rails-1.0.0/lib/deprecation_tracker.rb:56:in `block in track_rspec'
     # /usr/local/bundle/gems/webmock-3.12.2/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'

[FEATURE] copy the Gemfile.lock as Gemfile.next.lock before running

When we create a Gemfile.next.lock from scratch, it uses the latest versions for all dependencies without explicit versions. This applies to dependencies of dependencies too.

Silently updating versions in the Gemfile.next.lock can create bugs that are really hard to debug.

We should always copy the Gemfile.lock as Gemfile.next.lock before running next bundle install for the first time.
By adding an extra step to next --init we can make sure that no unintentional version jumps are made.

We add the extra copy step like this:
cp Gemfile.lock Gemfile.next.lock

For context:

to illustrate the problem, we found that issue in an upgrade today, the client started
the upgrade and there was a dependency on the RestClient gem with > 1.6 , the 
Gemfile.lock sets 1.6.9, but since the Gemfile.next.lock was created from scratch,
it was using the latest 2.x... version, which includes breaking changes! and it was 
pretty hard to debug because it was not related to the things that were updated explicitly

Add support for version output for the command line tool

As a developer and contributor
I would like to be able to quickly check the version of this tool
So that I can more accurately report issues with this gem

I think it would be very useful to support the --version parameter.

Right now there is no easy way to check for the tool's version:

➜  points git:(feature/upgrade-rails-5-2) ✗ bundle_report --version
bundle_report: version unknown
➜  points git:(feature/upgrade-rails-5-2) ✗ next --version
bundler: command not found: --version
Install missing gem executables with `bundle install`
Having trouble running commands with bin/next?
Try running bin/next bundle install, then try your command again.

If I have added the next_rails gem to my Gemfile, then there is a quick workaround:

➜  points git:(feature/upgrade-rails-5-2) ✗ bundle info next_rails
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
  * next_rails (1.0.2)
	Summary: A toolkit to upgrade your next Rails application
	Homepage: https://github.com/fastruby/next_rails
	Path: /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/next_rails-1.0.2

[FEATURE] Check current gems against a desired Ruby version

Similar to what we do with Rails compatibility, we can use the Gemspec for the current Gems to check the supported Ruby versions.

We can compare that with a desired Ruby version to see if a gem would be compatible.

Like... if a current gem version for a given project has a Ruby > 2.0 and < 2.5, we could to ruby_report --comaptible-with 2.6 and it should list that gem saying the current version works up to 2.5 only.

[REQUEST] Make next_rails compatible with Ruby older than 2.0

Branch/Commit:

Main branch

Describe the feature:

It would be great to be able to use next_rails in projects using really old Ruby versions like 1.9.3, since this gem is used a lot for upgrades and there are still applications using this old Ruby version.

This is similar to #50, but while working on that I noticed that supporting older rubies has some breaking changes between < 2.0 and >= 2.0, so I'm adding this second issue to keep track of the older Ruby versions.

Problem:

Currently, next_rails requires Ruby 2.3, I was trying to add support for older ruby versions #54 but I found out that going older than Ruby 2 requires more things to be rewritten and code written differently depending on the Ruby version.

Resources:

Check this for reference: https://bugs.ruby-lang.org/issues/7664
You can also see the error with the keyword arguments syntax when I was testing this: https://github.com/fastruby/next_rails/runs/7201343800?check_suite_focus=true

I will abide by the code of conduct

undefined method `acts_like?' for v1.0.3

When trying to run bundle_report, there is an error because it is trying to call an active support method:

root@96477a78955d:/code# bundle_report outdated
Traceback (most recent call last):
	8: from /usr/local/bundle/gems/next_rails-1.0.3/exe/bundle_report:50:in `block in <top (required)>'
	7: from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/bundle_report.rb:67:in `outdated'
	6: from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/bundle_report.rb:67:in `each'
	5: from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/bundle_report.rb:71:in `block in outdated'
	4: from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/gem_info.rb:56:in `age'
	3: from /usr/local/bundle/gems/actionview-4.2.11.3/lib/action_view/helpers/date_helper.rb:157:in `time_ago_in_words'
	2: from /usr/local/bundle/gems/actionview-4.2.11.3/lib/action_view/helpers/date_helper.rb:82:in `distance_of_time_in_words'
	1: from /usr/local/bundle/gems/activesupport-4.2.11.3/lib/active_support/core_ext/object/with_options.rb:67:in `with_options'
/usr/local/bundle/gems/actionview-4.2.11.3/lib/action_view/helpers/date_helper.rb:111:in `block in distance_of_time_in_words': undefined method `acts_like?' for 2011-08-24 00:00:00 UTC:Time (NoMethodError)

[BUG] `undefined method 'version' for nil:NilClass` when running `bundle_report compatibility`

Expected Behavior

When running bundle exec bundle_report compatibility --rails-version=5.0.0, I should've received a report of incompatible gems

Actual Behavior

Got an error with the following trace:

Traceback (most recent call last):
	5: from /Users/casanova/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/next_rails-1.2.1/exe/bundle_report:59:in `block in <top (required)>'
	4: from /Users/casanova/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/next_rails-1.2.1/lib/next_rails/bundle_report.rb:16:in `compatibility'
	3: from /Users/casanova/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/next_rails-1.2.1/lib/next_rails/bundle_report.rb:16:in `group_by'
	2: from /Users/casanova/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/next_rails-1.2.1/lib/next_rails/bundle_report.rb:16:in `each'
	1: from /Users/casanova/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/next_rails-1.2.1/lib/next_rails/bundle_report.rb:16:in `block in compatibility'
/Users/casanova/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/next_rails-1.2.1/lib/next_rails/gem_info.rb:82:in `state': undefined method `version' for nil:NilClass (NoMethodError)

To Reproduce

Using private gems from a client, so I can't share the full code to replicate. Used the previous command and identified the failing gem, which contained this gemspec:

$:.push File.expand_path("../lib", __FILE__)
require "gem-name/client/version"

Gem::Specification.new do |s|
  s.name          = 'gem-name'
  s.version       = Gem::Name::VERSION
  s.platform      = Gem::Platform::RUBY
  s.authors       = ['Author Name']
  s.email         = ['[email protected]']
  s.homepage      = 'http://github.com/Client/gem-name/'
  s.summary       = 'Client extensions to the gem.'
  s.description   = 'Client extensions to the gem. Including our own custom class.'
  s.files         = `git ls-files`.split("\n") - ["gem-name.gemspec"]
  s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
  s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
  s.require_paths = ['lib']
  s.rdoc_options  = ['--charset=UTF-8']
  s.add_runtime_dependency     'money',                 '~> 3.7'
  s.add_runtime_dependency     'rails'
  s.add_development_dependency 'rake'
  s.add_development_dependency 'minitest'
  s.add_development_dependency 'mocha'
  s.add_development_dependency 'sqlite3'
  s.add_development_dependency 'webmock'
  s.add_development_dependency 'vcr'
  s.add_development_dependency 'simplecov'
  s.add_development_dependency 'appraisal'
end

Additional Information

Please contact me if you need further information or to test out a fix locally through a call.

I will abide by the code of conduct

[BUG] Fix ERB deprecation warning in Ruby 3.1

Expected Behavior

When I run bundle_report compatibility in Ruby 3.1 I don't expect to see any deprecation warnings, but I do

Actual Behavior

bundle_report compatibility --rails-version=7.0
/usr/local/lib/ruby/3.1.0/erb.rb:814: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
/usr/local/lib/ruby/3.1.0/erb.rb:817: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.

Possible Fix

I see a call to ERB.new here, so I think updating the argument list might take care of it:

puts ERB.new(template, nil, "-").result(binding)

To Reproduce

See sample output above

Additional Information

I will abide by the code of conduct

[BUG] undefined local variable or method `latest_version`

Before we start...:

  • [x ] I checked the documentation and found no answer
  • [ x] I checked to make sure that this issue has not already been filed
  • [ x] I'm reporting the issue to the correct repository (for multi-repository projects)

Version, Branch, or Commit:
main

Expected behavior:

Runs the bundle_report outdated with errors

Actual behavior:

After the latest release, when running the outdated report we got an error:

bundle_report outdated
/usr/lib/ruby/gems/2.1.0/gems/next_rails-1.2.0/lib/next_rails/gem_info.rb:72:in `up_to_date?': undefined local variable or method `latest_version' for #<NextRails::GemInfo:0x00000001faaab8> (NameError)
	from /usr/lib/ruby/gems/2.1.0/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:100:in `reject'
	from /usr/lib/ruby/gems/2.1.0/gems/next_rails-1.2.0/lib/next_rails/bundle_report.rb:100:in `outdated'
	from /usr/lib/ruby/gems/2.1.0/gems/next_rails-1.2.0/exe/bundle_report:57:in `block in <top (required)>'

I tested with the previous version and it does not present that issue.

Steps to reproduce:

  1. Step 1: run bundle_report outdated within any application
  2. Step 2: see that the report will fail with the described error

Context and environment:

  1. Version of the software the issue is being opened for: latest (1.2.0)
  2. Operating System: MacOS
  3. Operating System version: 12.5
  4. Ruby version: tested with 2.1.10 and 2.7.5

I will abide by the code of conduct

next_rails doesn't seem to be compatible with Ruby < 2.5

I hit this issue when running on Ruby 2.3.

/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:2121:in `method_missing': undefined method `git_version' for #<Gem::Specification:0x005596b48c4cb8> (NoMethodError)
	from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/gem_info.rb:63:in `sourced_from_git?'
	from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/bundle_report.rb:65:in `select'
	from /usr/local/bundle/gems/next_rails-1.0.3/lib/next_rails/bundle_report.rb:65:in `outdated'
	from /usr/local/bundle/gems/next_rails-1.0.3/exe/bundle_report:50:in `block in <top (required)>'

I did some research on the support of git_version in Gem::Specification class of the Ruby Standard Library and it seems the method was introduced in Ruby 2.6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.