Skip to content

Commit

Permalink
Normalize bundler bindir
Browse files Browse the repository at this point in the history
This makes bundler consistent with all other gems, and makes the default
installation of Bundler in the release package look like any other
bundler installation.

Before (on preview3, for example), Bundler executable is installed at:

lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/libexec/bundle

Now it's installed in the standard location:

lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/exe/bundle
  • Loading branch information
deivid-rodriguez authored and hsbt committed Dec 13, 2023
1 parent 866b6fc commit 6b3c9ce
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/bundler.gemspec
Expand Up @@ -39,7 +39,7 @@ Gem::Specification.new do |s|
# include the gemspec itself because warbler breaks w/o it
s.files += %w[lib/bundler/bundler.gemspec]

s.bindir = "libexec"
s.bindir = "exe"
s.executables = %w[bundle bundler]
s.require_paths = ["lib"]
end
3 changes: 2 additions & 1 deletion spec/bundler/quality_spec.rb
Expand Up @@ -191,9 +191,10 @@ def check_for_specific_pronouns(filename)
end

it "ships the correct set of files" do
git_list = git_ls_files(ruby_core? ? "lib/bundler lib/bundler.rb libexec/bundle*" : "lib exe CHANGELOG.md LICENSE.md README.md bundler.gemspec")
git_list = tracked_files.reject {|f| f.start_with?("spec/") }

gem_list = loaded_gemspec.files
gem_list.map! {|f| f.sub(%r{\Aexe/}, "libexec/") } if ruby_core?

expect(git_list).to match_array(gem_list)
end
Expand Down
4 changes: 3 additions & 1 deletion spec/bundler/support/helpers.rb
Expand Up @@ -336,7 +336,9 @@ def with_built_bundler(version = nil)

begin
shipped_files.each do |shipped_file|
target_shipped_file = build_path + shipped_file
target_shipped_file = shipped_file
target_shipped_file = shipped_file.sub(/\Alibexec/, "exe") if ruby_core?
target_shipped_file = build_path + target_shipped_file
target_shipped_dir = File.dirname(target_shipped_file)
FileUtils.mkdir_p target_shipped_dir unless File.directory?(target_shipped_dir)
FileUtils.cp shipped_file, target_shipped_file, preserve: true
Expand Down
4 changes: 2 additions & 2 deletions spec/bundler/support/path.rb
Expand Up @@ -80,7 +80,7 @@ def tracked_files
end

def shipped_files
@shipped_files ||= loaded_gemspec.files
@shipped_files ||= ruby_core? ? tracked_files : loaded_gemspec.files
end

def lib_tracked_files
Expand Down Expand Up @@ -268,7 +268,7 @@ def git_ls_files(glob)
end

def tracked_files_glob
ruby_core? ? "lib/bundler lib/bundler.rb spec/bundler man/bundle*" : ""
ruby_core? ? "libexec/bundle* lib/bundler lib/bundler.rb spec/bundler man/bundle*" : "lib exe spec CHANGELOG.md LICENSE.md README.md bundler.gemspec"
end

def lib_tracked_files_glob
Expand Down
2 changes: 1 addition & 1 deletion tool/sync_default_gems.rb
Expand Up @@ -149,7 +149,7 @@ def sync_default_gems(gem)
gemspec_content = File.readlines("#{upstream}/bundler/bundler.gemspec").map do |line|
next if line =~ /LICENSE\.md/

line.gsub("bundler.gemspec", "lib/bundler/bundler.gemspec").gsub('"exe"', '"libexec"')
line.gsub("bundler.gemspec", "lib/bundler/bundler.gemspec")
end.compact.join
File.write("lib/bundler/bundler.gemspec", gemspec_content)

Expand Down

0 comments on commit 6b3c9ce

Please sign in to comment.