summaryrefslogtreecommitdiff
path: root/spec/bundler
diff options
context:
space:
mode:
authorOKURA Masafumi <masafumi.o1988@gmail.com>2021-09-20 23:18:14 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-10-09 09:07:47 +0900
commit7e506716d2c7085c6f243705a0b6eb79b2176c49 (patch)
tree5c3a86747b89538561fdb001ea383f234c0f1d8b /spec/bundler
parent91f794b5160e9253410d06b0811451d7db448720 (diff)
Newly generated gems require Ruby 2.6.0
In 2021, Ruby 2.5 and older are EOL. We can set the default required Ruby version to 2.6.0 to encourage people to use newer Ruby. If the command is executed with old Ruby, it falls back to 2.3.0. It's still possible to create a gem for older Ruby just by changing two lines of code (one in gemspec and another is in rubocop.yml).
Diffstat (limited to 'spec/bundler')
-rw-r--r--spec/bundler/commands/newgem_spec.rb2
-rw-r--r--spec/bundler/support/path.rb18
2 files changed, 17 insertions, 3 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 0a4e683a04..5ba513861c 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -569,7 +569,7 @@ RSpec.describe "bundle gem" do
it "sets a minimum ruby version" do
bundle "gem #{gem_name}"
- expect(generated_gemspec.required_ruby_version).to eq(Gem::Requirement.new(Gem.ruby_version < Gem::Version.new("2.4.a") ? ">= 2.3.0" : ">= 2.4.0"))
+ expect(generated_gemspec.required_ruby_version.to_s).to start_with(">=")
end
it "requires the version file" do
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index a98ef7c6cf..a73b3e699e 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -283,11 +283,25 @@ module Spec
end
def rubocop_gemfile_basename
- source_root.join("tool/bundler/#{RUBY_VERSION.start_with?("2.3") ? "rubocop23_gems.rb" : "rubocop_gems.rb"}")
+ filename = if RUBY_VERSION.start_with?("2.3")
+ "rubocop23_gems"
+ elsif RUBY_VERSION.start_with?("2.4")
+ "rubocop24_gems"
+ else
+ "rubocop_gems"
+ end
+ source_root.join("tool/bundler/#{filename}.rb")
end
def standard_gemfile_basename
- source_root.join("tool/bundler/#{RUBY_VERSION.start_with?("2.3") ? "standard23_gems.rb" : "standard_gems.rb"}")
+ filename = if RUBY_VERSION.start_with?("2.3")
+ "standard23_gems"
+ elsif RUBY_VERSION.start_with?("2.4")
+ "standard24_gems"
+ else
+ "standard_gems"
+ end
+ source_root.join("tool/bundler/#{filename}.rb")
end
extend self