homebrew-core/Formula/reattach-to-user-namespace.rb
Jack Nagel 348fa749f3 GitDownloadStrategy optimization
The current series of fetch invocations in GitDownloadStrategy has the
unfortunate behavior of fetching full history even in shallow clones
that only need the history between the clone point and the remote HEAD.
It should be possible to determine if it is actually necessary to fetch
the full history, including all tags, and if it is not to avoid this
overhead.

Fixes Homebrew/homebrew#11958, and several other recurring problems.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-01 21:46:42 -05:00

38 lines
1.3 KiB
Ruby

require 'formula'
class ReattachToUserNamespace < Formula
head 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git'
homepage 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard'
url 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git', :revision => 'dadea0aa48259c704d0b412b9588de2f5623e323'
version 'dadea0'
def options
[
['--wrap-pbcopy-and-pbpaste', 'Include wrappers for pbcopy/pbpaste that shim in this fix'],
['--wrap-launchctl', 'Include wrapper for launchctl with this fix']
]
end
def install
system "make"
bin.install "reattach-to-user-namespace"
wrap_pbpasteboard_commands if ARGV.include? '--wrap-pbcopy-and-pbpaste'
wrap_launchctl if ARGV.include? '--wrap-launchctl'
end
def wrap_pbpasteboard_commands
make_executable_with_content('pbcopy', 'cat - | reattach-to-user-namespace /usr/bin/pbcopy')
make_executable_with_content('pbpaste', 'reattach-to-user-namespace /usr/bin/pbpaste')
end
def wrap_launchctl
make_executable_with_content('launchctl', 'reattach-to-user-namespace /bin/launchctl "$@"')
end
def make_executable_with_content(executable_name, content_lines)
executable = bin.join(executable_name)
content = [*content_lines].unshift("#!/bin/sh").join("\n")
executable.write(content)
executable.chmod(0755)
end
end