method

generate_bin

Importance_0
v2_5_5 - Show latest stable - 0 notes - Class: Installer
generate_bin() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/installer.rb, line 464
  def generate_bin # :nodoc:
    return if spec.executables.nil? or spec.executables.empty?

    begin
      Dir.mkdir @bin_dir
    rescue SystemCallError
      raise unless File.directory? @bin_dir
    end

    raise Gem::FilePermissionError.new(@bin_dir) unless File.writable? @bin_dir

    spec.executables.each do |filename|
      filename.untaint
      bin_path = File.join gem_dir, spec.bindir, filename

      unless File.exist? bin_path then
        # TODO change this to a more useful warning
        warn "`#{bin_path}` does not exist, maybe `gem pristine #{spec.name}` will fix it?"
        next
      end

      mode = File.stat(bin_path).mode
      FileUtils.chmod mode | 0111, bin_path unless (mode | 0111) == mode

      check_executable_overwrite filename

      if @wrappers then
        generate_bin_script filename, @bin_dir
      else
        generate_bin_symlink filename, @bin_dir
      end

    end
  end
Register or log in to add new notes.