method

generate_bin

Importance_0
v1_9_3_125 - 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 280
  def generate_bin
    return if spec.executables.nil? or spec.executables.empty?

    # If the user has asked for the gem to be installed in a directory that is
    # the system gem directory, then use the system bin directory, else create
    # (or use) a new bin dir under the gem_home.
    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
Register or log in to add new notes.