next_rails 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c7f594ed23846772d59319982c2e1b866b2ba2aeea221e9f276b876d1bfa6a5
4
- data.tar.gz: 9f197cf8c84806932c34b5efe31467dab0b58d53408252ce7db193e6547486b2
3
+ metadata.gz: 7531328eccac69326b09b911f6fadb8f69b8d9713e6364af67c756059ed3ea18
4
+ data.tar.gz: 2bdaab8c916972e76b2623ff37519a2363da4537f4f0a4a4ce47b81343c227cf
5
5
  SHA512:
6
- metadata.gz: 9608a14f3d6ec0dd9b939d52b6b94c3670d4ad8a9a4d4ffc70b2b4f459b5545fa762da0a74f0782efd58ec25f293671cc5039e90f2425e7e7d8570e68f4ad7ba
7
- data.tar.gz: 5f3de5c08c617fd74c78d517480cd04747cbf2ac22a6e4348005dae32ba387596f5a74b4ac2b31a6489fedd3d267213432ec94a000ad5cd0162c99b22e4d90c0
6
+ metadata.gz: e65d7cb5da7f4eee2b56210db1a64a2a989a089b84f8ff7024385865710ef78c95aa3eeb16d4f1c194c67a0cf47f51b2970aeeccd6c3fde876c44e000c0d867a
7
+ data.tar.gz: 6926ab189b14413dcda593151c3a5586c71dc1ac7880fea0a024a16eb536bb03e46dafb72f568e1c04bb29c155b20423ce1b39fa749cd2ee01409974c3939332
@@ -1,4 +1,4 @@
1
- name: Run rake task
1
+ name: Continuous Integration
2
2
 
3
3
  on:
4
4
  push:
@@ -13,23 +13,7 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  strategy:
15
15
  matrix:
16
- ruby-version: [3.2, 3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3]
17
-
18
- steps:
19
- - uses: actions/checkout@v2
20
- - name: Set up Ruby ${{ matrix.ruby-version }}
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: ${{ matrix.ruby-version }}
24
- bundler-cache: true
25
- - name: Run rake task
26
- run: bundle exec rake
27
-
28
- test_older:
29
- runs-on: ubuntu-20.04
30
- strategy:
31
- matrix:
32
- ruby-version: [2.2, 2.1, 2.0.0]
16
+ ruby-version: ["3.3", "3.2", "3.1", "3.0", "2.7", "2.6"]
33
17
 
34
18
  steps:
35
19
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,7 +1,19 @@
1
- # main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.3.0...main)
1
+ # main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.4.0...main)
2
2
 
3
3
  * Your changes/patches go here.
4
4
 
5
+ # v1.4.1 / 2024-10-22 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.0...v1.4.1)
6
+
7
+ - [BUGFIX: Fix performance regression due to rainbow refinement](https://github.com/fastruby/next_rails/pull/131)
8
+
9
+ # v1.4.0 / 2024-09-24 [(commits)](https://github.com/fastruby/next_rails/compare/v1.3.0...v1.4.0)
10
+
11
+ - [CHORE: Use next_rails namespace on spec tests.](https://github.com/fastruby/next_rails/pull/117)
12
+ - [CHORE: Remove 2.0.0, 2.1, 2.2 Ruby support](https://github.com/fastruby/next_rails/pull/126)
13
+ - [CHORE: Update compatibility for Ruby versions to use Rainbow](https://github.com/fastruby/next_rails/pull/125)
14
+ - [FEATURE: Support compatibility for Ruby versions](https://github.com/fastruby/next_rails/pull/116)
15
+ - [CHORE: Remove GPL licensed dependency Colorize and replace it with Rainbow]
16
+
5
17
  # v1.3.0 / 2023-06-16 [(commits)](https://github.com/fastruby/next_rails/compare/v1.2.4...v1.3.0)
6
18
 
7
19
  - [FEATURE: Add NextRails.next? for application usage (e.g. Rails shims)](https://github.com/fastruby/next_rails/pull/97)
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Next Rails
2
2
 
3
+ [![Continuous Integration](https://github.com/fastruby/next_rails/actions/workflows/main.yml/badge.svg)](https://github.com/fastruby/next_rails/actions/workflows/main.yml)
4
+
3
5
  This is a toolkit to upgrade your next Rails application. It will help you
4
6
  set up dual booting, track deprecation warnings, and get a report on outdated
5
7
  dependencies for any Rails application.
@@ -39,10 +41,14 @@ bundle_report outdated --json
39
41
  # Show gems that don't work with Rails 5.2.0
40
42
  bundle_report compatibility --rails-version=5.2.0
41
43
 
42
- # Show the usual help message
43
- bundle_report --help
44
+ # Show gems that don't work with Ruby 3.0
45
+ bundle_report compatibility --ruby-version=3.0
46
+
44
47
  # Find minimum compatible ruby version with Rails 7.0.0
45
48
  bundle_report ruby_check --rails-version=7.0.0
49
+
50
+ # Show the usual help message
51
+ bundle_report --help
46
52
  ```
47
53
 
48
54
  ### Application usage
data/exe/bundle_report CHANGED
@@ -16,6 +16,7 @@ at_exit do
16
16
 
17
17
  Examples:
18
18
  #{$0} compatibility --rails-version 5.0
19
+ #{$0} compatibility --ruby-version 3.3
19
20
  #{$0} outdated
20
21
  #{$0} outdated --json
21
22
 
@@ -33,6 +34,10 @@ at_exit do
33
34
  options[:rails_version] = rails_version
34
35
  end
35
36
 
37
+ opts.on("--ruby-version [STRING]", "Ruby version to check compatibility against (defaults to 2.3)") do |ruby_version|
38
+ options[:ruby_version] = ruby_version
39
+ end
40
+
36
41
  opts.on("--include-rails-gems", "Include Rails gems in compatibility report (defaults to false)") do
37
42
  options[:include_rails_gems] = true
38
43
  end
@@ -50,7 +55,7 @@ at_exit do
50
55
  begin
51
56
  option_parser.parse!
52
57
  rescue OptionParser::ParseError => e
53
- STDERR.puts e.message.red
58
+ STDERR.puts Rainbow(e.message).red
54
59
  puts option_parser
55
60
  exit 1
56
61
  end
@@ -61,7 +66,11 @@ at_exit do
61
66
  when "ruby_check" then NextRails::BundleReport.compatible_ruby_version(rails_version: options.fetch(:rails_version))
62
67
  when "outdated" then NextRails::BundleReport.outdated(options.fetch(:format, nil))
63
68
  else
64
- NextRails::BundleReport.compatibility(rails_version: options.fetch(:rails_version, "5.0"), include_rails_gems: options.fetch(:include_rails_gems, false))
69
+ if options[:ruby_version]
70
+ NextRails::BundleReport.compatibility(ruby_version: options.fetch(:ruby_version, "2.3"))
71
+ else
72
+ NextRails::BundleReport.compatibility(rails_version: options.fetch(:rails_version, "5.0"), include_rails_gems: options.fetch(:include_rails_gems, false))
73
+ end
65
74
  end
66
75
  end
67
76
 
data/exe/deprecations CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "json"
3
- require "colorize"
3
+ require "rainbow"
4
4
  require "optparse"
5
5
  require "set"
6
6
 
@@ -28,11 +28,11 @@ def print_info(deprecation_warnings, opts = {})
28
28
  end
29
29
  end.sort_by {|message, data| data[:occurrences] }.reverse.to_h
30
30
 
31
- puts "Ten most common deprecation warnings:".underline
31
+ puts Rainbow("Ten most common deprecation warnings:").underline
32
32
  frequency_by_message.take(10).each do |message, data|
33
- puts "Occurrences: #{data.fetch(:occurrences)}".bold
33
+ puts Rainbow("Occurrences: #{data.fetch(:occurrences)}").bold
34
34
  puts "Test files: #{data.fetch(:test_files).to_a.join(" ")}" if verbose
35
- puts message.red
35
+ puts Rainbow(message).red
36
36
  puts "----------"
37
37
  end
38
38
  end
@@ -104,10 +104,10 @@ case options.fetch(:mode, "info")
104
104
  when "run" then run_tests(deprecation_warnings, next_mode: options[:next], tracker_mode: options[:tracker_mode])
105
105
  when "info" then print_info(deprecation_warnings, verbose: options[:verbose])
106
106
  when nil
107
- STDERR.puts "Must pass a mode: run or info".red
107
+ STDERR.puts Rainbow("Must pass a mode: run or info").red
108
108
  puts option_parser
109
109
  exit 1
110
110
  else
111
- STDERR.puts "Unknown mode: #{options[:mode]}".red
111
+ STDERR.puts Rainbow("Unknown mode: #{options[:mode]}").red
112
112
  exit 1
113
113
  end
@@ -1,4 +1,4 @@
1
- require "colorize"
1
+ require "rainbow"
2
2
  require "json"
3
3
 
4
4
  # A shitlist for deprecation warnings during test runs. It has two modes: "save" and "compare"
@@ -150,7 +150,7 @@ class DeprecationTracker
150
150
  end
151
151
 
152
152
  if changed_buckets.length > 0
153
- message = <<-MESSAGE.red
153
+ message = <<-MESSAGE
154
154
  ⚠️ Deprecation warnings have changed!
155
155
 
156
156
  Code called by the following spec files is now generating different deprecation warnings:
@@ -168,7 +168,7 @@ class DeprecationTracker
168
168
  See \e[4;37mdev-docs/testing/deprecation_tracker.md\e[0;31m for more information.
169
169
  MESSAGE
170
170
 
171
- raise UnexpectedDeprecations, message
171
+ raise UnexpectedDeprecations, Rainbow(message).red
172
172
  end
173
173
  end
174
174
 
@@ -0,0 +1,44 @@
1
+ require "rainbow"
2
+
3
+ class NextRails::BundleReport::RubyVersionCompatibility
4
+ MINIMAL_VERSION = 1.0
5
+ attr_reader :gems, :options
6
+
7
+ def initialize(gems: NextRails::GemInfo.all, options: {})
8
+ @gems = gems
9
+ @options = options
10
+ end
11
+
12
+ def generate
13
+ return invalid_message unless valid?
14
+
15
+ message
16
+ end
17
+
18
+ private
19
+
20
+ def message
21
+ output = Rainbow("=> Incompatible gems with Ruby #{ruby_version}:").white.bold
22
+ incompatible.each do |gem|
23
+ output += Rainbow("\n#{gem.name} - required Ruby version: #{gem.gem_specification.required_ruby_version}").magenta
24
+ end
25
+ output += Rainbow("\n\n#{incompatible.length} incompatible #{incompatible.one? ? 'gem' : 'gems' } with Ruby #{ruby_version}").red
26
+ output
27
+ end
28
+
29
+ def incompatible
30
+ gems.reject { |gem| gem.compatible_with_ruby?(ruby_version) }
31
+ end
32
+
33
+ def ruby_version
34
+ options[:ruby_version].to_f
35
+ end
36
+
37
+ def invalid_message
38
+ Rainbow("=> Invalid Ruby version: #{options[:ruby_version]}.").red.bold
39
+ end
40
+
41
+ def valid?
42
+ ruby_version > MINIMAL_VERSION
43
+ end
44
+ end
@@ -1,4 +1,4 @@
1
- require "colorize"
1
+ require "rainbow"
2
2
  require "cgi"
3
3
  require "erb"
4
4
  require "json"
@@ -8,7 +8,9 @@ module NextRails
8
8
  module BundleReport
9
9
  extend self
10
10
 
11
- def compatibility(rails_version: nil, include_rails_gems: nil)
11
+ def compatibility(rails_version: nil, ruby_version: nil, include_rails_gems: nil)
12
+ return puts RubyVersionCompatibility.new(options: { ruby_version: ruby_version }).generate if ruby_version
13
+
12
14
  incompatible_gems = NextRails::GemInfo.all.reject do |gem|
13
15
  gem.compatible_with_rails?(rails_version: rails_version) || (!include_rails_gems && gem.from_rails?)
14
16
  end.sort_by { |gem| gem.name }
@@ -23,8 +25,8 @@ module NextRails
23
25
  def erb_output(incompatible_gems_by_state, incompatible_gems, rails_version)
24
26
  template = <<-ERB
25
27
  <% if incompatible_gems_by_state[:found_compatible] -%>
26
- <%= "=> Incompatible with Rails #{rails_version} (with new versions that are compatible):".white.bold %>
27
- <%= "These gems will need to be upgraded before upgrading to Rails #{rails_version}.".italic %>
28
+ <%= Rainbow("=> Incompatible with Rails #{rails_version} (with new versions that are compatible):").white.bold %>
29
+ <%= Rainbow("These gems will need to be upgraded before upgrading to Rails #{rails_version}.").italic %>
28
30
 
29
31
  <% incompatible_gems_by_state[:found_compatible].each do |gem| -%>
30
32
  <%= gem_header(gem) %> - upgrade to <%= gem.latest_compatible_version.version %>
@@ -32,8 +34,8 @@ module NextRails
32
34
 
33
35
  <% end -%>
34
36
  <% if incompatible_gems_by_state[:incompatible] -%>
35
- <%= "=> Incompatible with Rails #{rails_version} (with no new compatible versions):".white.bold %>
36
- <%= "These gems will need to be removed or replaced before upgrading to Rails #{rails_version}.".italic %>
37
+ <%= Rainbow("=> Incompatible with Rails #{rails_version} (with no new compatible versions):").white.bold %>
38
+ <%= Rainbow("These gems will need to be removed or replaced before upgrading to Rails #{rails_version}.").italic %>
37
39
 
38
40
  <% incompatible_gems_by_state[:incompatible].each do |gem| -%>
39
41
  <%= gem_header(gem) %> - new version, <%= gem.latest_version.version %>, is not compatible with Rails #{rails_version}
@@ -41,16 +43,16 @@ module NextRails
41
43
 
42
44
  <% end -%>
43
45
  <% if incompatible_gems_by_state[:no_new_version] -%>
44
- <%= "=> Incompatible with Rails #{rails_version} (with no new versions):".white.bold %>
45
- <%= "These gems will need to be upgraded by us or removed before upgrading to Rails #{rails_version}.".italic %>
46
- <%= "This list is likely to contain internal gems, like Cuddlefish.".italic %>
46
+ <%= Rainbow("=> Incompatible with Rails #{rails_version} (with no new versions):").white.bold %>
47
+ <%= Rainbow("These gems will need to be upgraded by us or removed before upgrading to Rails #{rails_version}.").italic %>
48
+ <%= Rainbow("This list is likely to contain internal gems, like Cuddlefish.").italic %>
47
49
 
48
50
  <% incompatible_gems_by_state[:no_new_version].each do |gem| -%>
49
51
  <%= gem_header(gem) %> - new version not found
50
52
  <% end -%>
51
53
 
52
54
  <% end -%>
53
- <%= incompatible_gems.length.to_s.red %> gems incompatible with Rails <%= rails_version %>
55
+ <%= Rainbow(incompatible_gems.length.to_s).red %> gems incompatible with Rails <%= rails_version %>
54
56
  ERB
55
57
 
56
58
  erb_version = ERB.version
@@ -66,8 +68,8 @@ module NextRails
66
68
  end
67
69
 
68
70
  def gem_header(_gem)
69
- header = "#{_gem.name} #{_gem.version}".bold
70
- header << " (loaded from git)".magenta if _gem.sourced_from_git?
71
+ header = Rainbow("#{_gem.name} #{_gem.version}").bold
72
+ header << Rainbow(" (loaded from git)").magenta if _gem.sourced_from_git?
71
73
  header
72
74
  end
73
75
 
@@ -154,18 +156,18 @@ module NextRails
154
156
  header = "#{gem.name} #{gem.version}"
155
157
 
156
158
  puts <<-MESSAGE
157
- #{header.bold.white}: released #{gem.age} (latest version, #{gem.latest_version.version}, released #{gem.latest_version.age})
159
+ #{Rainbow(header.bold.white)}: released #{gem.age} (latest version, #{gem.latest_version.version}, released #{gem.latest_version.age})
158
160
  MESSAGE
159
161
  end
160
162
 
161
163
  percentage_out_of_date = ((out_of_date_gems.count / total_gem_count.to_f) * 100).round
162
164
  footer = <<-MESSAGE
163
- #{sourced_from_git_count.to_s.yellow} gems are sourced from git
164
- #{out_of_date_gems.count.to_s.red} of the #{total_gem_count} gems are out-of-date (#{percentage_out_of_date}%)
165
+ #{Rainbow(sourced_from_git_count.to_s).yellow} gems are sourced from git
166
+ #{Rainbow(out_of_date_gems.count.to_s).red} of the #{total_gem_count} gems are out-of-date (#{percentage_out_of_date}%)
165
167
  MESSAGE
166
168
 
167
169
  puts ''
168
170
  puts footer
169
171
  end
170
172
  end
171
- end
173
+ end
@@ -147,5 +147,9 @@ module NextRails
147
147
  rails_dependency.requirement.satisfied_by?(Gem::Version.new(rails_version))
148
148
  end
149
149
  end
150
+
151
+ def compatible_with_ruby?(ruby_version)
152
+ gem_specification.required_ruby_version.satisfied_by?(Gem::Version.new(ruby_version))
153
+ end
150
154
  end
151
155
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NextRails
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.1"
5
5
  end
data/lib/next_rails.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require "next_rails/gem_info"
4
4
  require "next_rails/version"
5
5
  require "next_rails/bundle_report"
6
+ require "next_rails/bundle_report/ruby_version_compatibility"
6
7
  require "deprecation_tracker"
7
8
 
8
9
  module NextRails
data/next_rails.gemspec CHANGED
@@ -22,13 +22,13 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "colorize", ">= 0.8.1"
25
+ spec.add_dependency "rainbow", ">= 3"
26
26
  spec.add_development_dependency "bundler", ">= 1.16", "< 3.0"
27
27
  spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_development_dependency "simplecov", "~> 0.17.1"
30
30
  spec.add_development_dependency "timecop", "~> 0.9.1"
31
31
  spec.add_development_dependency "byebug"
32
- spec.add_development_dependency "rexml", "3.1.7.3" # limited on purpose, new versions don't work with old rubies
32
+ spec.add_development_dependency "rexml", "3.3.8" # limited on purpose, new versions don't work with old rubies
33
33
  spec.add_development_dependency "webmock", "3.16.2" # limited on purpose, new versions don't work with old rubies
34
34
  end
metadata CHANGED
@@ -1,30 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: next_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Tagwerker
8
8
  - Luis Sagastume
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-06-16 00:00:00.000000000 Z
12
+ date: 2024-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: colorize
15
+ name: rainbow
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.8.1
20
+ version: '3'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.8.1
27
+ version: '3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -121,14 +121,14 @@ dependencies:
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 3.1.7.3
124
+ version: 3.3.8
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 3.1.7.3
131
+ version: 3.3.8
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: webmock
134
134
  requirement: !ruby/object:Gem::Requirement
@@ -164,9 +164,7 @@ files:
164
164
  - ".github/workflows/main.yml"
165
165
  - ".gitignore"
166
166
  - ".rspec"
167
- - ".travis.yml"
168
167
  - CHANGELOG.md
169
- - CODEOWNERS
170
168
  - CODE_OF_CONDUCT.md
171
169
  - CONTRIBUTING.md
172
170
  - Gemfile
@@ -185,6 +183,7 @@ files:
185
183
  - lib/deprecation_tracker.rb
186
184
  - lib/next_rails.rb
187
185
  - lib/next_rails/bundle_report.rb
186
+ - lib/next_rails/bundle_report/ruby_version_compatibility.rb
188
187
  - lib/next_rails/gem_info.rb
189
188
  - lib/next_rails/version.rb
190
189
  - next_rails.gemspec
@@ -193,7 +192,7 @@ homepage: https://github.com/fastruby/next_rails
193
192
  licenses:
194
193
  - MIT
195
194
  metadata: {}
196
- post_install_message:
195
+ post_install_message:
197
196
  rdoc_options: []
198
197
  require_paths:
199
198
  - lib
@@ -208,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
207
  - !ruby/object:Gem::Version
209
208
  version: '0'
210
209
  requirements: []
211
- rubygems_version: 3.0.3.1
212
- signing_key:
210
+ rubygems_version: 3.5.11
211
+ signing_key:
213
212
  specification_version: 4
214
213
  summary: A toolkit to upgrade your next Rails application
215
214
  test_files: []
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.3
5
- - 2.4.10
6
- - 2.5.8
7
- - 2.6.6
8
- - 2.7.2
9
- - 3.0.2
10
- before_install: gem install bundler -v 1.16.1
data/CODEOWNERS DELETED
@@ -1,4 +0,0 @@
1
- # These code owners will be the default owners to everything in the repository.
2
- # Unless a posterior rule has precedence, they will be automatically requested
3
- # for review when a pull request is opened.
4
- * @fastruby/black-bunny-brigade