Skip to content

Commit 92b0305

Browse files
jeremyevanshsbt
authored andcommitted
Use optimistic version constraints in bundle gem output
This changes the gemspec and Gemfile to use optimistic versions for dependencies.
1 parent 66ae777 commit 92b0305

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

bundler/lib/bundler/templates/newgem/Gemfile.tt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ source "https://rubygems.org"
66
gemspec
77

88
gem "irb"
9-
gem "rake", "~> 13.0"
9+
gem "rake", ">= 13.0"
1010
<%- if config[:ext] -%>
1111

1212
gem "rake-compiler"
1313
<%- end -%>
1414
<%- if config[:test] -%>
1515

16-
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
16+
gem "<%= config[:test] %>", ">= <%= config[:test_framework_version] %>"
1717
<%- end -%>
1818
<%- if config[:linter] == "rubocop" -%>
1919

20-
gem "rubocop", "~> <%= config[:linter_version] %>"
20+
gem "rubocop", ">= <%= config[:linter_version] %>"
2121
<%- elsif config[:linter] == "standard" -%>
2222

23-
gem "standard", "~> <%= config[:linter_version] %>"
23+
gem "standard", ">= <%= config[:linter_version] %>"
2424
<%- end -%>

bundler/lib/bundler/templates/newgem/newgem.gemspec.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ Gem::Specification.new do |spec|
4545
<%- end -%>
4646

4747
# Uncomment to register a new dependency of your gem
48-
# spec.add_dependency "example-gem", "~> 1.0"
48+
# spec.add_dependency "example-gem", ">= 1.0"
4949
<%- if config[:ext] == 'rust' -%>
50-
spec.add_dependency "rb_sys", "~> 0.9.127"
50+
spec.add_dependency "rb_sys", ">= 0.9.127"
5151
<%- end -%>
5252
<%- if config[:ext] == 'go' -%>
53-
spec.add_dependency "go_gem", "~> 0.2"
53+
spec.add_dependency "go_gem", ">= 0.2"
5454
<%- end -%>
5555

5656
# For more information and examples about making a new gem, check out our

spec/commands/newgem_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def create_temporary_dir(dir)
752752
builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
753753
builder.dependencies
754754
rspec_dep = builder.dependencies.find {|d| d.name == "rspec" }
755-
expect(rspec_dep).to be_specific
755+
expect(rspec_dep).not_to be_specific
756756
end
757757
end
758758

@@ -837,7 +837,7 @@ def create_temporary_dir(dir)
837837
builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
838838
builder.dependencies
839839
minitest_dep = builder.dependencies.find {|d| d.name == "minitest" }
840-
expect(minitest_dep).to be_specific
840+
expect(minitest_dep).not_to be_specific
841841
end
842842

843843
it "builds spec skeleton" do
@@ -898,7 +898,7 @@ def create_temporary_dir(dir)
898898
builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
899899
builder.dependencies
900900
test_unit_dep = builder.dependencies.find {|d| d.name == "test-unit" }
901-
expect(test_unit_dep).to be_specific
901+
expect(test_unit_dep).not_to be_specific
902902
end
903903

904904
it "builds spec skeleton" do
@@ -1829,7 +1829,7 @@ def setup_rust_env
18291829
end
18301830

18311831
it "includes go_gem in gem_name.gemspec" do
1832-
expect(bundled_app("#{gem_name}/#{gem_name}.gemspec").read).to include('spec.add_dependency "go_gem", "~> 0.2"')
1832+
expect(bundled_app("#{gem_name}/#{gem_name}.gemspec").read).to include('spec.add_dependency "go_gem", ">= 0.2"')
18331833
end
18341834

18351835
it "includes go_gem extension in extconf.rb" do

0 commit comments

Comments
 (0)