next_rails 1.4.4 → 1.4.6
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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -1
- data/README.md +1 -1
- data/exe/bundle_report +2 -2
- data/lib/next_rails/bundle_report/rails_version_compatibility.rb +84 -0
- data/lib/next_rails/bundle_report.rb +8 -59
- data/lib/next_rails/gem_info.rb +1 -1
- data/lib/next_rails/version.rb +1 -1
- data/lib/next_rails.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebc27419f01357f8e9d26fd7b7c5022ebd7993cc83c055f97d8ae1941de7c0e3
|
4
|
+
data.tar.gz: 06d4d044f30b054aa99ad746e389c44753248d99d7d829d11687e6fd344b45e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ad7eb2b31696266e009755d91689787761b74ebf719728a1ff8070ba49afe1b1fee97cb97f0539b30572fd31a3175d548dbcbb67245a70fc706e2dd76082fe
|
7
|
+
data.tar.gz: c1f025b9b067b4949fbea7611d6560d2ffd2edf70988be503022ea83704f5ddf88e8bff2907099efecc734665b72f088c47295842bfc6a80642cea3d876a3fed
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
-
# main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.4.
|
1
|
+
# main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.4.6...main)
|
2
2
|
|
3
3
|
- [BUGFIX: example](https://github.com/fastruby/next_rails/pull/<number>)
|
4
4
|
|
5
5
|
* Your changes/patches go here.
|
6
6
|
|
7
|
+
# v1.4.6 / 2025-04-15 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.5...v1.4.6)
|
8
|
+
|
9
|
+
- [BUFIX: Fix compatibilities performance bug](https://github.com/fastruby/next_rails/pull/150)
|
10
|
+
|
11
|
+
# v1.4.5 / 2025-03-07 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.4...v1.4.5)
|
12
|
+
|
13
|
+
- [Move rails_version compatibility to its own class](https://github.com/fastruby/next_rails/pull/137)
|
14
|
+
|
7
15
|
# v1.4.4 / 2025-02-26 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.3...v1.4.4)
|
8
16
|
|
9
17
|
- [FEATURE: Update deprecation tracker to support newer Rails versions (7.1+)](https://github.com/fastruby/next_rails/pull/142)
|
data/README.md
CHANGED
@@ -140,7 +140,7 @@ next_rails --help # For more options and examples
|
|
140
140
|
This command helps you dual-boot your application.
|
141
141
|
|
142
142
|
```bash
|
143
|
-
|
143
|
+
next_rails --init # Create Gemfile.next and Gemfile.next.lock
|
144
144
|
vim Gemfile # Tweak your dependencies conditionally using `next?`
|
145
145
|
next bundle install # Install new gems
|
146
146
|
next rails s # Start server using Gemfile.next
|
data/exe/bundle_report
CHANGED
@@ -67,9 +67,9 @@ at_exit do
|
|
67
67
|
when "outdated" then NextRails::BundleReport.outdated(options.fetch(:format, nil))
|
68
68
|
else
|
69
69
|
if options[:ruby_version]
|
70
|
-
NextRails::BundleReport.
|
70
|
+
NextRails::BundleReport.ruby_compatibility(ruby_version: options.fetch(:ruby_version, "2.3"))
|
71
71
|
else
|
72
|
-
NextRails::BundleReport.
|
72
|
+
NextRails::BundleReport.rails_compatibility(rails_version: options.fetch(:rails_version, "5.0"), include_rails_gems: options.fetch(:include_rails_gems, false))
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class NextRails::BundleReport::RailsVersionCompatibility
|
2
|
+
def initialize(gems: NextRails::GemInfo.all, options: {})
|
3
|
+
@gems = gems
|
4
|
+
@options = options
|
5
|
+
end
|
6
|
+
|
7
|
+
def generate
|
8
|
+
erb_output
|
9
|
+
end
|
10
|
+
|
11
|
+
def incompatible_gems_by_state
|
12
|
+
@incompatible_gems_by_state ||= begin
|
13
|
+
incompatible_gems.each { |gem| gem.find_latest_compatible(rails_version: rails_version) }
|
14
|
+
incompatible_gems.group_by { |gem| gem.state(rails_version) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def erb_output
|
21
|
+
template = <<-ERB
|
22
|
+
<% if incompatible_gems_by_state[:found_compatible] -%>
|
23
|
+
<%= Rainbow("=> Incompatible with Rails #{rails_version} (with new versions that are compatible):").white.bold %>
|
24
|
+
<%= Rainbow("These gems will need to be upgraded before upgrading to Rails #{rails_version}.").italic %>
|
25
|
+
|
26
|
+
<% incompatible_gems_by_state[:found_compatible].each do |gem| -%>
|
27
|
+
<%= gem_header(gem) %> - upgrade to <%= gem.latest_compatible_version.version %>
|
28
|
+
<% end -%>
|
29
|
+
|
30
|
+
<% end -%>
|
31
|
+
<% if incompatible_gems_by_state[:incompatible] -%>
|
32
|
+
<%= Rainbow("=> Incompatible with Rails #{rails_version} (with no new compatible versions):").white.bold %>
|
33
|
+
<%= Rainbow("These gems will need to be removed or replaced before upgrading to Rails #{rails_version}.").italic %>
|
34
|
+
|
35
|
+
<% incompatible_gems_by_state[:incompatible].each do |gem| -%>
|
36
|
+
<%= gem_header(gem) %> - new version, <%= gem.latest_version.version %>, is not compatible with Rails #{rails_version}
|
37
|
+
<% end -%>
|
38
|
+
|
39
|
+
<% end -%>
|
40
|
+
<% if incompatible_gems_by_state[:no_new_version] -%>
|
41
|
+
<%= Rainbow("=> Incompatible with Rails #{rails_version} (with no new versions):").white.bold %>
|
42
|
+
<%= Rainbow("These gems will need to be upgraded by us or removed before upgrading to Rails #{rails_version}.").italic %>
|
43
|
+
<%= Rainbow("This list is likely to contain internal gems, like Cuddlefish.").italic %>
|
44
|
+
|
45
|
+
<% incompatible_gems_by_state[:no_new_version].each do |gem| -%>
|
46
|
+
<%= gem_header(gem) %> - new version not found
|
47
|
+
<% end -%>
|
48
|
+
|
49
|
+
<% end -%>
|
50
|
+
<%= Rainbow(incompatible_gems.length.to_s).red %> gems incompatible with Rails <%= rails_version %>
|
51
|
+
ERB
|
52
|
+
|
53
|
+
erb_version = ERB.version
|
54
|
+
if erb_version =~ /erb.rb \[([\d\.]+) .*\]/
|
55
|
+
erb_version = $1
|
56
|
+
end
|
57
|
+
|
58
|
+
if Gem::Version.new(erb_version) < Gem::Version.new("2.2")
|
59
|
+
ERB.new(template, nil, "-").result(binding)
|
60
|
+
else
|
61
|
+
ERB.new(template, trim_mode: "-").result(binding)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def gem_header(_gem)
|
66
|
+
header = Rainbow("#{_gem.name} #{_gem.version}").bold
|
67
|
+
header << Rainbow(" (loaded from git)").magenta if _gem.sourced_from_git?
|
68
|
+
header
|
69
|
+
end
|
70
|
+
|
71
|
+
def incompatible_gems
|
72
|
+
@incompatible_gems ||= @gems.reject do |gem|
|
73
|
+
gem.compatible_with_rails?(rails_version: rails_version) || (!include_rails_gems && gem.from_rails?)
|
74
|
+
end.sort_by { |gem| gem.name }
|
75
|
+
end
|
76
|
+
|
77
|
+
def rails_version
|
78
|
+
@options[:rails_version]
|
79
|
+
end
|
80
|
+
|
81
|
+
def include_rails_gems
|
82
|
+
@options[:include_rails_gems]
|
83
|
+
end
|
84
|
+
end
|
@@ -8,69 +8,18 @@ module NextRails
|
|
8
8
|
module BundleReport
|
9
9
|
extend self
|
10
10
|
|
11
|
-
def
|
12
|
-
return
|
11
|
+
def ruby_compatibility(ruby_version: nil)
|
12
|
+
return unless ruby_version
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
end.sort_by { |gem| gem.name }
|
17
|
-
|
18
|
-
incompatible_gems.each { |gem| gem.find_latest_compatible(rails_version: rails_version) }
|
19
|
-
|
20
|
-
incompatible_gems_by_state = incompatible_gems.group_by { |gem| gem.state(rails_version) }
|
21
|
-
|
22
|
-
puts erb_output(incompatible_gems_by_state, incompatible_gems, rails_version)
|
14
|
+
options = { ruby_version: ruby_version }
|
15
|
+
puts RubyVersionCompatibility.new(options: options).generate
|
23
16
|
end
|
24
17
|
|
25
|
-
def
|
26
|
-
|
27
|
-
<% if incompatible_gems_by_state[:found_compatible] -%>
|
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 %>
|
30
|
-
|
31
|
-
<% incompatible_gems_by_state[:found_compatible].each do |gem| -%>
|
32
|
-
<%= gem_header(gem) %> - upgrade to <%= gem.latest_compatible_version.version %>
|
33
|
-
<% end -%>
|
34
|
-
|
35
|
-
<% end -%>
|
36
|
-
<% if incompatible_gems_by_state[:incompatible] -%>
|
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 %>
|
39
|
-
|
40
|
-
<% incompatible_gems_by_state[:incompatible].each do |gem| -%>
|
41
|
-
<%= gem_header(gem) %> - new version, <%= gem.latest_version.version %>, is not compatible with Rails #{rails_version}
|
42
|
-
<% end -%>
|
43
|
-
|
44
|
-
<% end -%>
|
45
|
-
<% if incompatible_gems_by_state[:no_new_version] -%>
|
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 %>
|
49
|
-
|
50
|
-
<% incompatible_gems_by_state[:no_new_version].each do |gem| -%>
|
51
|
-
<%= gem_header(gem) %> - new version not found
|
52
|
-
<% end -%>
|
53
|
-
|
54
|
-
<% end -%>
|
55
|
-
<%= Rainbow(incompatible_gems.length.to_s).red %> gems incompatible with Rails <%= rails_version %>
|
56
|
-
ERB
|
57
|
-
|
58
|
-
erb_version = ERB.version
|
59
|
-
if erb_version =~ /erb.rb \[([\d\.]+) .*\]/
|
60
|
-
erb_version = $1
|
61
|
-
end
|
62
|
-
|
63
|
-
if Gem::Version.new(erb_version) < Gem::Version.new("2.2")
|
64
|
-
ERB.new(template, nil, "-").result(binding)
|
65
|
-
else
|
66
|
-
ERB.new(template, trim_mode: "-").result(binding)
|
67
|
-
end
|
68
|
-
end
|
18
|
+
def rails_compatibility(rails_version: nil, include_rails_gems: nil)
|
19
|
+
return unless rails_version
|
69
20
|
|
70
|
-
|
71
|
-
|
72
|
-
header << Rainbow(" (loaded from git)").magenta if _gem.sourced_from_git?
|
73
|
-
header
|
21
|
+
options = { rails_version: rails_version, include_rails_gems: include_rails_gems }
|
22
|
+
puts RailsVersionCompatibility.new(options: options).generate
|
74
23
|
end
|
75
24
|
|
76
25
|
def compatible_ruby_version(rails_version)
|
data/lib/next_rails/gem_info.rb
CHANGED
@@ -109,7 +109,7 @@ module NextRails
|
|
109
109
|
|
110
110
|
def find_latest_compatible(rails_version: nil)
|
111
111
|
dependency = Gem::Dependency.new(@name)
|
112
|
-
fetcher = Gem::SpecFetcher.new
|
112
|
+
fetcher = Gem::SpecFetcher.fetcher # Use fetcher instead of ::new to reduce object allocation.
|
113
113
|
|
114
114
|
# list all available data for released gems
|
115
115
|
list, errors = fetcher.available_specs(:released)
|
data/lib/next_rails/version.rb
CHANGED
data/lib/next_rails.rb
CHANGED
@@ -5,6 +5,7 @@ require "next_rails/version"
|
|
5
5
|
require "next_rails/init"
|
6
6
|
require "next_rails/bundle_report"
|
7
7
|
require "next_rails/bundle_report/ruby_version_compatibility"
|
8
|
+
require "next_rails/bundle_report/rails_version_compatibility"
|
8
9
|
require "deprecation_tracker"
|
9
10
|
|
10
11
|
module NextRails
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: next_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernesto Tagwerker
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rainbow
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- lib/deprecation_tracker.rb
|
184
184
|
- lib/next_rails.rb
|
185
185
|
- lib/next_rails/bundle_report.rb
|
186
|
+
- lib/next_rails/bundle_report/rails_version_compatibility.rb
|
186
187
|
- lib/next_rails/bundle_report/ruby_version_compatibility.rb
|
187
188
|
- lib/next_rails/gem_info.rb
|
188
189
|
- lib/next_rails/init.rb
|