diff options
| author | Xu Cheng | 2014-07-03 18:27:31 +0800 |
|---|---|---|
| committer | Mike McQuaid | 2014-08-31 19:18:11 +0100 |
| commit | 369de0a05d50fafc9f0bf0d56b1521989970744f (patch) | |
| tree | 0821c09885a1bcacca90653e06fc82eae4011add | |
| parent | 372945299dc52b04338ad58ac666f105e2f463f2 (diff) | |
| download | brew-369de0a05d50fafc9f0bf0d56b1521989970744f.tar.bz2 | |
brew-services: mkpath first if destination dir not existed
| -rwxr-xr-x | Library/Contributions/cmd/brew-services.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Contributions/cmd/brew-services.rb b/Library/Contributions/cmd/brew-services.rb index be61f9e84..a14dea86f 100755 --- a/Library/Contributions/cmd/brew-services.rb +++ b/Library/Contributions/cmd/brew-services.rb @@ -246,6 +246,7 @@ module ServicesCli temp.flush rm service.dest if service.dest.exist? + service.dest_dir.mkpath unless service.dest_dir.directory? cp temp.path, service.dest # clear tempfile @@ -317,8 +318,11 @@ class Service # Path to a static plist file, this is always `homebrew.mxcl.<formula>.plist`. def plist; @plist ||= formula.prefix + "#{label}.plist" end + # Path to destination plist directory, if run as root it's `boot_path`, else `user_path`. + def dest_dir; (ServicesCli.root? ? ServicesCli.boot_path : ServicesCli.user_path) end + # Path to destination plist, if run as root it's in `boot_path`, else `user_path`. - def dest; (ServicesCli.root? ? ServicesCli.boot_path : ServicesCli.user_path) + "#{label}.plist" end + def dest; dest_dir + "#{label}.plist" end # Returns `true` if formula implements #startup_plist or file exists. def plist?; formula.installed? && (plist.file? || formula.respond_to?(:startup_plist)) end |
