diff options
| author | Mike McQuaid | 2017-10-18 10:48:19 +0100 |
|---|---|---|
| committer | GitHub | 2017-10-18 10:48:19 +0100 |
| commit | dc9ea9c786f5346b691687924140b8e90b136c3f (patch) | |
| tree | 08988ddb4defcd97c980de55130cf3aaad3d8515 /Library/Homebrew/extend | |
| parent | 1d40061c69fd11ed5b05c94c46c6004d56b11acb (diff) | |
| parent | dd9415c8d3c07b4fa2ac066e867297ff06c64568 (diff) | |
| download | brew-dc9ea9c786f5346b691687924140b8e90b136c3f.tar.bz2 | |
Merge pull request #3315 from maxim-belkin/linux-caveats-plist
caveats.rb: empty method on Linux
Diffstat (limited to 'Library/Homebrew/extend')
| -rw-r--r-- | Library/Homebrew/extend/os/caveats.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/extend/os/mac/caveats.rb | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/os/caveats.rb b/Library/Homebrew/extend/os/caveats.rb new file mode 100644 index 000000000..e67138087 --- /dev/null +++ b/Library/Homebrew/extend/os/caveats.rb @@ -0,0 +1 @@ +require "extend/os/mac/caveats" if OS.mac? diff --git a/Library/Homebrew/extend/os/mac/caveats.rb b/Library/Homebrew/extend/os/mac/caveats.rb new file mode 100644 index 000000000..d912a8307 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/caveats.rb @@ -0,0 +1,45 @@ +class Caveats + def plist_caveats + s = [] + if f.plist || (keg&.plist_installed?) + plist_domain = f.plist_path.basename(".plist") + + # we readlink because this path probably doesn't exist since caveats + # occurs before the link step of installation + # Yosemite security measures mildly tighter rules: + # https://github.com/Homebrew/legacy-homebrew/issues/33815 + if !plist_path.file? || !plist_path.symlink? + if f.plist_startup + s << "To have launchd start #{f.full_name} now and restart at startup:" + s << " sudo brew services start #{f.full_name}" + else + s << "To have launchd start #{f.full_name} now and restart at login:" + s << " brew services start #{f.full_name}" + end + # For startup plists, we cannot tell whether it's running on launchd, + # as it requires for `sudo launchctl list` to get real result. + elsif f.plist_startup + s << "To restart #{f.full_name} after an upgrade:" + s << " sudo brew services restart #{f.full_name}" + elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" + s << "To restart #{f.full_name} after an upgrade:" + s << " brew services restart #{f.full_name}" + else + s << "To start #{f.full_name}:" + s << " brew services start #{f.full_name}" + end + + if f.plist_manual + s << "Or, if you don't want/need a background service you can just run:" + s << " #{f.plist_manual}" + end + + # pbpaste is the system clipboard tool on macOS and fails with `tmux` by default + # check if this is being run under `tmux` to avoid failing + if ENV["TMUX"] && !quiet_system("/usr/bin/pbpaste") + s << "" << "WARNING: brew services will fail when run under tmux." + end + end + s.join("\n") + "\n" unless s.empty? + end +end |
