Remove some monkeypatches
This commit is contained in:
parent
8c613e618b
commit
a40a0e1862
@ -40,7 +40,7 @@ end
|
|||||||
|
|
||||||
class Cmd
|
class Cmd
|
||||||
def initialize path, args
|
def initialize path, args
|
||||||
@arg0 = path.basename.freeze
|
@arg0 = File.basename(path).freeze
|
||||||
@args = args.freeze
|
@args = args.freeze
|
||||||
end
|
end
|
||||||
def mode
|
def mode
|
||||||
|
|||||||
@ -4,19 +4,21 @@
|
|||||||
# But many build-systems expect it to work. This fixes that.
|
# But many build-systems expect it to work. This fixes that.
|
||||||
# NOTE only works if the build-tool calls xcrun without a path prefixed!
|
# NOTE only works if the build-tool calls xcrun without a path prefixed!
|
||||||
|
|
||||||
require "#{File.dirname __FILE__}/../libsuperenv"
|
dirname = File.dirname(__FILE__)
|
||||||
SUPERBIN = __FILE__.dirname.cleanpath.freeze
|
require "#{dirname}/../libsuperenv"
|
||||||
|
SUPERBIN = dirname.cleanpath.freeze
|
||||||
|
|
||||||
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
|
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
|
||||||
ENV['DEVELOPER_DIR'] = ENV['HOMEBREW_DEVELOPER_DIR']
|
ENV['DEVELOPER_DIR'] = ENV['HOMEBREW_DEVELOPER_DIR']
|
||||||
|
|
||||||
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
|
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
|
||||||
if File.exist?("/usr/bin/#{ARGV.first}")
|
if File.exist?("/usr/bin/#{ARGV.first}")
|
||||||
exec "/usr/bin/#{ARGV.shift}", *ARGV unless ENV['HOMEBREW_SDKROOT'].directory?
|
sdkroot = ENV['HOMEBREW_SDKROOT']
|
||||||
|
exec "/usr/bin/#{ARGV.shift}", *ARGV unless sdkroot and File.directory? sdkroot
|
||||||
end
|
end
|
||||||
|
|
||||||
def try path
|
def try path
|
||||||
exec path, *ARGV if File.executable?(path) and path.cleanpath.dirname != SUPERBIN
|
exec path, *ARGV if File.executable?(path) and File.dirname(path.cleanpath) != SUPERBIN
|
||||||
end
|
end
|
||||||
|
|
||||||
arg0 = ARGV.shift
|
arg0 = ARGV.shift
|
||||||
|
|||||||
@ -6,22 +6,18 @@
|
|||||||
$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8"
|
$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8"
|
||||||
|
|
||||||
class String
|
class String
|
||||||
def directory?; File.directory? self end
|
|
||||||
def basename; File.basename self end
|
|
||||||
def cleanpath; require 'pathname'; Pathname.new(self).realpath.to_s rescue self end
|
def cleanpath; require 'pathname'; Pathname.new(self).realpath.to_s rescue self end
|
||||||
def chuzzle; s = chomp; s unless s.empty? end
|
def chuzzle; s = chomp; s unless s.empty? end
|
||||||
def dirname; File.dirname(self) end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class NilClass
|
class NilClass
|
||||||
def chuzzle; end
|
def chuzzle; end
|
||||||
def directory?; false end
|
|
||||||
def split(x); [] end
|
def split(x); [] end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Array
|
class Array
|
||||||
def to_flags prefix
|
def to_flags prefix
|
||||||
select{|path| path.directory? }.uniq.map{|path| prefix+path }
|
select { |path| File.directory? path }.uniq.map { |path| prefix + path }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user