PageRenderTime 64ms CodeModel.GetById 54ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/site_ruby/1.8/rubygems/ext/rake_builder.rb

http://github.com/agross/netopenspace
Ruby | 39 lines | 21 code | 12 blank | 6 comment | 2 complexity | 383037b3202044d333fe699dc6508fcc MD5 | raw file
 1#--
 2# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 3# All rights reserved.
 4# See LICENSE.txt for permissions.
 5#++
 6
 7require 'rubygems/ext/builder'
 8require 'rubygems/command'
 9
10class Gem::Ext::RakeBuilder < Gem::Ext::Builder
11
12  def self.build(extension, directory, dest_path, results)
13    if File.basename(extension) =~ /mkrf_conf/i then
14      cmd = "#{Gem.ruby} #{File.basename extension}"
15      cmd << " #{Gem::Command.build_args.join " "}" unless Gem::Command.build_args.empty?
16      run cmd, results
17    end
18
19    # Deal with possible spaces in the path, e.g. C:/Program Files
20    dest_path = '"' + dest_path + '"' if dest_path.include?(' ')
21
22    rake = ENV['rake']
23
24    rake ||= begin
25               "\"#{Gem.ruby}\" -rubygems #{Gem.bin_path('rake', 'rake')}"
26             rescue Gem::Exception
27             end
28
29    rake ||= Gem.default_exec_format % 'rake'
30
31    cmd = "#{rake} RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen
32
33    run cmd, results
34
35    results
36  end
37
38end
39