diff options
| author | Xu Cheng | 2014-07-03 18:27:31 +0800 | 
|---|---|---|
| committer | Mike McQuaid | 2014-08-31 19:18:11 +0100 | 
| commit | dbcbf2325e9c2bc0114338ca6c291a1eba5dda65 (patch) | |
| tree | 43c26bd53b37fd156cc41d52375d0bf8be4d5b90 /Library/Contributions | |
| parent | 51dbf0b1893383478fdd9b7146e627bad41af4f8 (diff) | |
| download | homebrew-dbcbf2325e9c2bc0114338ca6c291a1eba5dda65.tar.bz2 | |
brew-services: mkpath first if destination dir not existed
Diffstat (limited to 'Library/Contributions')
| -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  | 
