mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[rubygems/rubygems] bundle-gem learns to find Gemfile template correctly
Removes the symlink for gems.rb.tt and instead uses the singular
template file. Only the destination filename for the gemfile reads from
the `init_gems_rb` setting.
43ce0e1666
This commit is contained in:
parent
54ff3d6996
commit
a4563be05c
2 changed files with 25 additions and 1 deletions
|
@ -79,7 +79,7 @@ module Bundler
|
|||
ensure_safe_gem_name(name, constant_array)
|
||||
|
||||
templates = {
|
||||
"#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
|
||||
"Gemfile.tt" => Bundler.preferred_gemfile_name,
|
||||
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
||||
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
||||
"sig/newgem.rbs.tt" => "sig/#{namespaced_path}.rbs",
|
||||
|
|
|
@ -739,6 +739,30 @@ RSpec.describe "bundle gem" do
|
|||
end
|
||||
end
|
||||
|
||||
context "init_gems_rb setting to true" do
|
||||
before do
|
||||
bundle "config set init_gems_rb true"
|
||||
bundle "gem #{gem_name}"
|
||||
end
|
||||
|
||||
it "generates gems.rb instead of Gemfile" do
|
||||
expect(bundled_app("#{gem_name}/gems.rb")).to exist
|
||||
expect(bundled_app("#{gem_name}/Gemfile")).to_not exist
|
||||
end
|
||||
end
|
||||
|
||||
context "init_gems_rb setting to false" do
|
||||
before do
|
||||
bundle "config set init_gems_rb false"
|
||||
bundle "gem #{gem_name}"
|
||||
end
|
||||
|
||||
it "generates Gemfile instead of gems.rb" do
|
||||
expect(bundled_app("#{gem_name}/gems.rb")).to_not exist
|
||||
expect(bundled_app("#{gem_name}/Gemfile")).to exist
|
||||
end
|
||||
end
|
||||
|
||||
context "gem.test setting set to rspec" do
|
||||
before do
|
||||
bundle "config set gem.test rspec"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue