2011-05-26 18:01:21 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class ReattachToUserNamespace < Formula
|
|
|
|
homepage 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard'
|
2012-07-26 12:19:15 +00:00
|
|
|
url 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git', :revision => 'ece1935953593d05e98d8c3ee8f956b2429d633f'
|
|
|
|
version 'ece193'
|
2011-05-26 18:01:21 +00:00
|
|
|
|
2012-08-26 06:33:26 +00:00
|
|
|
head 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git'
|
|
|
|
|
|
|
|
option 'wrap-pbcopy-and-pbpaste', 'Include wrappers for pbcopy/pbpaste that shim in this fix'
|
|
|
|
option 'wrap-launchctl', 'Include wrapper for launchctl with this fix'
|
2011-05-26 18:01:21 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
system "make"
|
|
|
|
bin.install "reattach-to-user-namespace"
|
2012-08-26 06:33:26 +00:00
|
|
|
wrap_pbpasteboard_commands if build.include? 'wrap-pbcopy-and-pbpaste'
|
|
|
|
wrap_launchctl if build.include? 'wrap-launchctl'
|
2011-05-26 18:01:21 +00:00
|
|
|
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
|