def generate_bin
return if spec.executables.nil? or spec.executables.empty?
bindir = @bin_dir || Gem.bindir(gem_home)
Dir.mkdir bindir unless File.exist? bindir
raise Gem::FilePermissionError.new(bindir) unless File.writable? bindir
spec.executables.each do |filename|
filename.untaint
bin_path = File.expand_path File.join(gem_dir, spec.bindir, filename)
unless File.exist? bin_path
warn "Hey?!?! Where did #{bin_path} go??"
next
end
mode = File.stat(bin_path).mode | 0111
FileUtils.chmod mode, bin_path
if @wrappers then
generate_bin_script filename, bindir
else
generate_bin_symlink filename, bindir
end
end
end