diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index c1c4f14be2786..f1f35f386df1f 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -71,12 +71,6 @@ Homebrew/CompactBlank: # `blank?` is not necessarily available here: - "Homebrew/extend/enumerable.rb" -Homebrew/FormulaPathMethods: - Exclude: - # TODO: Remove this after Homebrew/core has applied formula autocorrections. - - "/**/Formula/**/*.rb" - - "**/Formula/**/*.rb" - Homebrew/NoFileutilsRmrf: Include: - "/**/{Formula,Casks}/**/*.rb" diff --git a/Library/Homebrew/service.rb b/Library/Homebrew/service.rb index 00b290b46baa1..02412deb95cff 100644 --- a/Library/Homebrew/service.rb +++ b/Library/Homebrew/service.rb @@ -3,6 +3,7 @@ require "ipaddr" require "on_system" +require "utils/path" require "utils/service" module Homebrew @@ -12,6 +13,7 @@ module Homebrew class Service extend Forwardable include OnSystem::MacOSAndLinux + include Utils::Path RUN_TYPE_IMMEDIATE = :immediate RUN_TYPE_INTERVAL = :interval diff --git a/Library/Homebrew/test/service_spec.rb b/Library/Homebrew/test/service_spec.rb index d2839cf810222..88a18a13abe01 100644 --- a/Library/Homebrew/test/service_spec.rb +++ b/Library/Homebrew/test/service_spec.rb @@ -44,6 +44,18 @@ def stub_formula_with_service_sockets(sockets_var) end end + describe "#formula_opt_bin" do + it "is available in service blocks" do + f = stub_formula do + service do + run formula_opt_bin("foo")/"foo" + end + end + + expect(f.service.run).to eq([(HOMEBREW_PREFIX/"opt/foo/bin/foo").to_s]) + end + end + describe "#process_type" do it "throws for unexpected type" do f = stub_formula do