/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. require 'rubygems/ext/builder'
  7. require 'rubygems/command'
  8. class Gem::Ext::RakeBuilder < Gem::Ext::Builder
  9. def self.build(extension, directory, dest_path, results)
  10. if File.basename(extension) =~ /mkrf_conf/i then
  11. cmd = "#{Gem.ruby} #{File.basename extension}"
  12. cmd << " #{Gem::Command.build_args.join " "}" unless Gem::Command.build_args.empty?
  13. run cmd, results
  14. end
  15. # Deal with possible spaces in the path, e.g. C:/Program Files
  16. dest_path = '"' + dest_path + '"' if dest_path.include?(' ')
  17. rake = ENV['rake']
  18. rake ||= begin
  19. "\"#{Gem.ruby}\" -rubygems #{Gem.bin_path('rake', 'rake')}"
  20. rescue Gem::Exception
  21. end
  22. rake ||= Gem.default_exec_format % 'rake'
  23. cmd = "#{rake} RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen
  24. run cmd, results
  25. results
  26. end
  27. end