
Homebrew's actually ended up using a fair few gems. While we want to avoid Bundler at runtime (and this PR still does that, in fact uses Bundler even less at runtime than it did before) writing our own version to use at build-time seems redundant.
19 lines
351 B
Ruby
19 lines
351 B
Ruby
require "hbc/container/naked"
|
|
require "macho"
|
|
|
|
module Hbc
|
|
class Container
|
|
class Executable < Naked
|
|
def self.me?(criteria)
|
|
return true if criteria.magic_number(/^#!\s*\S+/)
|
|
|
|
begin
|
|
MachO.open(criteria.path).header.executable?
|
|
rescue MachO::MagicError
|
|
false
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|