Hey Patrick,
I just got around to giving this a try. It's exactly what I needed!  Thanks
so much!

graham


On 4/18/07, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:


Message: 1
Date: Wed, 18 Apr 2007 00:14:01 -0400
From: "Patrick Hurley" <[EMAIL PROTECTED]>
Subject: Re: [Rubygems-developers] Building native gems for deployment
To: rubygems-developers@rubyforge.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 4/13/07, Graham Miller <[EMAIL PROTECTED]> wrote:
> So I guess my question would be: what is the best way to install a gem
onto
> a machine without having to do the native compilation step?

I had a similar problem, with very little testing (so far), try this
script, if you have any problems let me know.

pth

---------------------------------------------
#!/usr/bin/env ruby -w

require "rbconfig"
require "rubygems"
require "pp"
require "tmpdir"
require "find"
require "fileutils"

Gem.manage_gems
unless gem = ARGV.first
  puts "You must provide the name of a gem on the command line."
  exit 1
end

gi = Gem::Installer.new(gem)
format = Gem::Format.from_file_by_path(gem)

dir = File.join(Dir.tmpdir, "gembuilder")
FileUtils.rm_r(dir) rescue nil

puts "Unpacking gem"
gi.unpack(dir)

gi.build_extensions(dir, format.spec)
files = []
Find.find(dir) do |fname|
  next if fname == dir
  files << fname.sub(Regexp.quote(dir+"/"),'')
end

spec = format.spec
spec.extensions = []
spec.files += (files - format.spec.files)
spec.platform = Config::CONFIG['arch'].sub(/[\.0-9]*$/, '')

puts "Building gem in #{dir}"
start_dir = Dir.pwd
Dir.chdir(dir) do
  gb = Gem::Builder.new(spec)
  gb.build
  FileUtils.mv Dir.glob("*.gem"), start_dir
end

puts "Cleaning up #{dir}"
FileUtils.rm_rf(dir)



--
Marketcetera Trading Platform
download.run.trade.
www.marketcetera.org
_______________________________________________
Rubygems-developers mailing list
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to