[Rubygems-developers] PATCH: install.rb to install bin directory

Chad Fowler chad at chadfowler.com
Wed Dec 3 08:29:56 EST 2003


I applied this.  For some reason I thought at first you were talking about 
adding support for installing "bin" files from gems.  :)

As for the next task, I would encourage you to look for features you want 
that don't yet exist.

One thing Matz specifically asked for was the ability to convert gems to 
native package formats (such as dpkg or rpm).  Rich had a specific idea on 
how to do this, but I can't remember what it was.  Rich?

I may get started on that piece as well.

Chad

On Wed, 3 Dec 2003, Gavin Sinclair wrote:

# Folks,
# 
# Here is a patch that causes install.rb to handle the bin directory.
# Please review it with the following in mind:
#  - it only installs *.cmd if it is being run on a Windows or DOS
#    system (correct on Windows & Cygwin on my machine)
#  - it installs the bin files with permissions 0755
#  - I didn't use the 'srcdir' parameter in this, because I don't
#    get it (it seems to me this file is hacked and slashed from
#    somewhere else anyway)
# 
# I added a couple of comments and renamed a couple of variables.  Also
# fixed a regex warning on line 14.
# 
# Do with it as you will.
# 
# Cheers,
# Gavin
# 
# PS. Wanna throw another task my way?  This project's great! :)
# (Installed my first gem today...)
# 
# 
# Index: install.rb
# ===================================================================
# RCS file: /var/cvs/rubygems/rubygems/install.rb,v
# retrieving revision 1.4
# diff -u -u -r1.4 install.rb
# --- install.rb  22 Nov 2003 18:58:46 -0000      1.4
# +++ install.rb  3 Dec 2003 10:39:41 -0000
# @@ -11,34 +11,55 @@
#  $site_libdir = $:.find {|x| x =~ /site_ruby$/}
#  if !$site_libdir
#    $site_libdir = File.join($libdir, "site_ruby")
# -elsif $site_libdir !~ Regexp.quote($version)
# +elsif $site_libdir !~ Regexp.new(Regexp.quote($version))
#    $site_libdir = File.join($site_libdir, $version)
#  end
# 
#  def install_rb(srcdir = nil)
# +  ### Install 'lib' files.
# +
#    libdir = "lib"
#    libdir = File.join(srcdir, libdir) if srcdir
# -  path = []
# -  dir = []
# +  paths = []
# +  dirs = []
#    Find.find(libdir) do |f|
#      next unless FileTest.file?(f)
#      next if (f = f[libdir.length+1..-1]) == nil
#      next if (/CVS$/ =~ File.dirname(f))
# -    path.push f
# -    dir |= [File.dirname(f)]
# +    paths.push f
# +    dirs |= [File.dirname(f)]
#    end
# -  for f in dir
# +
# +  # Create the necessary directories.
# +  for f in dirs
#      next if f == "."
#      next if f == "CVS"
#      File::makedirs(File.join($site_libdir, f))
#    end
# -  for f in path
# +
# +  # Install the files.
# +  for f in paths
#      File::install(File.join("lib", f), File.join($site_libdir, f), 0644, true)
#    end
#    gem_dir = File.join(Config::CONFIG['libdir'], 'ruby', 'gems', Config::CONFIG['ruby_version'])
#    ["specifications", "cache"].each do |subdir|
#      File::makedirs(File.join(gem_dir, subdir))
#    end
# +
# +  ## Install the 'bin' files.
# +
# +  bindir = CONFIG['bindir']
# +  is_windows_platform = CONFIG["arch"] =~ /dos|win32/i
# +  Find.find('bin') do |f|
# +    next if f =~ /\bCVS\b/
# +    next if f =~ /\.cmd$/ and not is_windows_platform
# +    next if FileTest.directory?(f)
# +    source = f
# +    target = File.join(bindir, File.basename(f))
# +    File::install(source, target, 0755, true)
# +  end
# +
# +  ## Install the 'sources' package bundled with RubyGems.
# 
#    Dir.chdir("packages/sources")
#      load("sources.gemspec")
# 
# _______________________________________________
# Rubygems-developers mailing list
# Rubygems-developers at rubyforge.org
# http://rubyforge.org/mailman/listinfo/rubygems-developers
# 



More information about the Rubygems-developers mailing list