GithubHelp home page GithubHelp logo

imrel / next_rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fastruby/next_rails

0.0 0.0 0.0 52 KB

A companion gem for the "Ten Years of Rails Upgrades" from RailsConf 2018

License: MIT License

Ruby 94.85% Shell 5.15%

next_rails's Introduction

Ten Years of Rails Upgrades

This is a companion to the "Ten Years of Rails Upgrades" conference talk. 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 gems that don't work with Rails 5.2.0
bundle_report compatibility --rails-version=5.2.0
bundle_report --help

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

We don't use MiniTest, so there isn't a prebuilt config for it but I suspect it's pretty similar to DeprecationTracker.track_rspec.

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/deprecations.shitlist.json.

Dual-boot Rails next

This command helps you dual-boot your application.

next --init         # Create Gemfile.next
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:

gem 'next_rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install next_rails

License

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

next_rails's People

Contributors

bronzdoc avatar etagwerker avatar jamie avatar jnraine avatar knappe avatar magneland avatar pendletons avatar

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.