next_rails 1.4.2 → 1.4.4

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: b13f13c670fce82d34e9baa5ba3b3526d572df3a4fd0b84c5d5dd7aa60ed19e6
4
- data.tar.gz: 85da22eeafda96b703e0570474d11e15221769a466da4282521873d948355d1f
3
+ metadata.gz: d1c67d799d599530c9a05a6dc5c45ce565a131cd9d3ae1ef0d433931873ea9e2
4
+ data.tar.gz: d48ba5e3aa9332eb34d0a489dbc3977640dd15ffe51845d4c1050ba794ea5a27
5
5
  SHA512:
6
- metadata.gz: 1314801c4953aa8fb2c0a9f6b0946ad71b0a383bc809db6a5ac2abd282cc977db91ab51f9786b79120031c926e5ecfa6cb05cdf117bde21070dc5952cace48bb
7
- data.tar.gz: 73881a50677a8c10ade9a63ed9eb78f730dc1e2c4a2fe02b425a7e9f3bb67de13ae9532e5266548d86e6ed6d98e41b750bd70e2f8a02b2f3fab393c091276e3b
6
+ metadata.gz: b8083833e12cfaa07b7787b28fc1ce088b42ad09bada36d81af657787a10dadfe6b8f30e0925cb85b96f568dcd7bdf9bf4b1a1ff3bc3f5941e9c19a2767a84dd
7
+ data.tar.gz: b838fe07dc40f693974088d1e828210f335139c17a17f183dcaeca1beb2b1a87a9d83634efe3d9e03ba1402469c39810250bcb2a8641fac2f615caa0aeb9c65b
@@ -13,7 +13,7 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  strategy:
15
15
  matrix:
16
- ruby-version: ["3.3", "3.2", "3.1", "3.0", "2.7", "2.6"]
16
+ ruby-version: ["3.4", "3.3", "3.2", "3.1", "3.0", "2.7", "2.6", "2.5"]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,7 +1,18 @@
1
- # main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.4.2...main)
1
+ # main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.4.4...main)
2
+
3
+ - [BUGFIX: example](https://github.com/fastruby/next_rails/pull/<number>)
2
4
 
3
5
  * Your changes/patches go here.
4
6
 
7
+ # v1.4.4 / 2025-02-26 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.3...v1.4.4)
8
+
9
+ - [FEATURE: Update deprecation tracker to support newer Rails versions (7.1+)](https://github.com/fastruby/next_rails/pull/142)
10
+
11
+ # v1.4.3 / 2025-02-20 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.2...v1.4.3)
12
+
13
+ - [Add next_rails --init](https://github.com/fastruby/next_rails/pull/139)
14
+ - [Add Ruby 3.4 support](https://github.com/fastruby/next_rails/pull/133)
15
+
5
16
  # v1.4.2 / 2024-10-25 [(commits)](https://github.com/fastruby/next_rails/compare/v1.4.1...v1.4.2)
6
17
 
7
18
  - [BUGFIX: Rainbow patch: the methods (bold & white) are not on String](https://github.com/fastruby/next_rails/pull/132)
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
- next --init # Create Gemfile.next and Gemfile.next.lock
143
+ next_next --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
@@ -168,7 +168,7 @@ Or install it yourself as:
168
168
 
169
169
  Execute:
170
170
 
171
- $ next --init
171
+ $ next_rails --init
172
172
 
173
173
  Init will create a Gemfile.next and an initialized Gemfile.next.lock.
174
174
  The Gemfile.next.lock is initialized with the contents of your existing
data/exe/next.sh CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/bin/bash
2
2
  if [[ "${@}" == "--init" ]]; then
3
+ echo "The next --init command is deprecated. Please use the next_rails --init command instead."
3
4
  # Add next? top of Gemfile
4
5
  cat <<-STRING > Gemfile.tmp
5
6
  def next?
data/exe/next_rails CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "optparse"
3
3
  require "next_rails/version"
4
+ require "next_rails"
4
5
 
5
6
  options = {}
6
7
  option_parser = OptionParser.new do |opts|
@@ -11,6 +12,10 @@ option_parser = OptionParser.new do |opts|
11
12
  bin/next_rails --version info # Show the version of the gem installed
12
13
  MESSAGE
13
14
 
15
+ opts.on("--init", "Setup the dual-boot configuration") do
16
+ options[:init] = true
17
+ end
18
+
14
19
  opts.on("--version", "show version of the gem") do
15
20
  options[:version] = true
16
21
  end
@@ -23,6 +28,8 @@ end
23
28
 
24
29
  option_parser.parse!
25
30
 
31
+ puts NextRails::Init.call if options.fetch(:init, false)
32
+
26
33
  if options.fetch(:version, false)
27
34
  puts NextRails::VERSION
28
35
  exit 2
@@ -73,7 +73,17 @@ class DeprecationTracker
73
73
  mode = opts[:mode]
74
74
  transform_message = opts[:transform_message]
75
75
  deprecation_tracker = DeprecationTracker.new(shitlist_path, transform_message, mode)
76
- if defined?(ActiveSupport)
76
+ # Since Rails 7.1 the preferred way to track deprecations is to use the deprecation trackers via
77
+ # `Rails.application.deprecators`.
78
+ # We fallback to tracking deprecations via the ActiveSupport singleton object if Rails.application.deprecators is
79
+ # not defined for older Rails versions.
80
+ if defined?(Rails) && defined?(Rails.application) && defined?(Rails.application.deprecators)
81
+ Rails.application.deprecators.each do |deprecator|
82
+ deprecator.behavior << -> (message, _callstack = nil, _deprecation_horizon = nil, _gem_name = nil) {
83
+ deprecation_tracker.add(message)
84
+ }
85
+ end
86
+ elsif defined?(ActiveSupport)
77
87
  ActiveSupport::Deprecation.behavior << -> (message, _callstack = nil, _deprecation_horizon = nil, _gem_name = nil) {
78
88
  deprecation_tracker.add(message)
79
89
  }
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module NextRails
6
+ # This class is responsible for installing the dual-boot files for your.
7
+ class Init
8
+ def self.call
9
+ new.call
10
+ end
11
+
12
+ def call
13
+ return gemfiles_message unless gemfiles?
14
+ return next_gemfiles_message if next_gemfiles?
15
+
16
+ add_next_conditional
17
+ create_sym_link
18
+ copy_gemfile_lock
19
+ message
20
+ end
21
+
22
+ private
23
+
24
+ def gemfiles?
25
+ %w[Gemfile Gemfile.lock].any? { |file| File.exist?(file) }
26
+ end
27
+
28
+ def gemfiles_message
29
+ 'You must have a Gemfile and Gemfile.lock to run the next_rails --init command.'
30
+ end
31
+
32
+ def next_gemfiles?
33
+ %w[Gemfile.next Gemfile.next.lock].any? { |file| File.exist?(file) }
34
+ end
35
+
36
+ def next_gemfiles_message
37
+ 'The next_rails --init command has already been run.'
38
+ end
39
+
40
+ def add_next_conditional
41
+ File.open('Gemfile.tmp', 'w') do |file|
42
+ file.write <<-STRING
43
+ def next?
44
+ File.basename(__FILE__) == "Gemfile.next"
45
+ end
46
+ STRING
47
+ end
48
+
49
+ File.open('Gemfile', 'r') do |original|
50
+ File.open('Gemfile.tmp', 'a') do |temp|
51
+ temp.write(original.read)
52
+ end
53
+ end
54
+
55
+ File.rename('Gemfile.tmp', 'Gemfile')
56
+ end
57
+
58
+ def create_sym_link
59
+ File.symlink('Gemfile', 'Gemfile.next')
60
+ end
61
+
62
+ def copy_gemfile_lock
63
+ FileUtils.cp('Gemfile.lock', 'Gemfile.next.lock')
64
+ end
65
+
66
+ def message
67
+ <<-MESSAGE
68
+ Created Gemfile.next (a symlink to your Gemfile). Your Gemfile has been modified to support dual-booting!
69
+
70
+ There's just one more step: modify your Gemfile to use a newer version of Rails using the \`next?\` helper method.
71
+
72
+ For example, here's how to go from 5.2.8.1 to 6.0.6.1:
73
+
74
+ if next?
75
+ gem "rails", "6.0.6.1"
76
+ else
77
+ gem "rails", "5.2.8.1"
78
+ end
79
+ MESSAGE
80
+ end
81
+ end
82
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NextRails
4
- VERSION = "1.4.2"
4
+ VERSION = "1.4.4"
5
5
  end
data/lib/next_rails.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "next_rails/gem_info"
4
4
  require "next_rails/version"
5
+ require "next_rails/init"
5
6
  require "next_rails/bundle_report"
6
7
  require "next_rails/bundle_report/ruby_version_compatibility"
7
8
  require "deprecation_tracker"
data/next_rails.gemspec CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "timecop", "~> 0.9.1"
31
31
  spec.add_development_dependency "byebug"
32
32
  spec.add_development_dependency "rexml", "3.3.8" # limited on purpose, new versions don't work with old rubies
33
- spec.add_development_dependency "webmock", "3.16.2" # limited on purpose, new versions don't work with old rubies
33
+ spec.add_development_dependency "webmock", "3.20.0"
34
34
  end
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.2
4
+ version: 1.4.4
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: 2024-10-25 00:00:00.000000000 Z
12
+ date: 2025-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -135,14 +135,14 @@ dependencies:
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 3.16.2
138
+ version: 3.20.0
139
139
  type: :development
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 3.16.2
145
+ version: 3.20.0
146
146
  description: A set of handy tools to upgrade your Rails application and keep it up
147
147
  to date
148
148
  email:
@@ -185,6 +185,7 @@ files:
185
185
  - lib/next_rails/bundle_report.rb
186
186
  - lib/next_rails/bundle_report/ruby_version_compatibility.rb
187
187
  - lib/next_rails/gem_info.rb
188
+ - lib/next_rails/init.rb
188
189
  - lib/next_rails/version.rb
189
190
  - next_rails.gemspec
190
191
  - pull_request_template.md
@@ -207,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  - !ruby/object:Gem::Version
208
209
  version: '0'
209
210
  requirements: []
210
- rubygems_version: 3.5.11
211
+ rubygems_version: 3.5.22
211
212
  signing_key:
212
213
  specification_version: 4
213
214
  summary: A toolkit to upgrade your next Rails application