Module: Homebrew::Bundle::BrewServices Private
- Defined in:
- bundle/brew_services.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Class Method Summary collapse
- .reset! ⇒ Object private
- .restart(name, file: nil, verbose: false) ⇒ Object private
- .run(name, file: nil, verbose: false) ⇒ Object private
- .start(name, file: nil, verbose: false) ⇒ Object private
- .started?(name) ⇒ Boolean private
- .started_services ⇒ Object private
- .stop(name, keep: false, verbose: false) ⇒ Object private
- .versioned_service_file(name) ⇒ Object private
Class Method Details
.reset! ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
9 10 11 |
# File 'bundle/brew_services.rb', line 9 def self.reset! @started_services = nil end |
.restart(name, file: nil, verbose: false) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
42 43 44 45 46 47 48 49 |
# File 'bundle/brew_services.rb', line 42 def self.restart(name, file: nil, verbose: false) args = ["services", "restart", name] args << "--file=#{file}" if file return unless Bundle.brew(*args, verbose:) started_services << name true end |
.run(name, file: nil, verbose: false) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
33 34 35 36 37 38 39 40 |
# File 'bundle/brew_services.rb', line 33 def self.run(name, file: nil, verbose: false) args = ["services", "run", name] args << "--file=#{file}" if file return unless Bundle.brew(*args, verbose:) started_services << name true end |
.start(name, file: nil, verbose: false) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
24 25 26 27 28 29 30 31 |
# File 'bundle/brew_services.rb', line 24 def self.start(name, file: nil, verbose: false) args = ["services", "start", name] args << "--file=#{file}" if file return unless Bundle.brew(*args, verbose:) started_services << name true end |
.started?(name) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
51 52 53 |
# File 'bundle/brew_services.rb', line 51 def self.started?(name) started_services.include? name end |
.started_services ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'bundle/brew_services.rb', line 55 def self.started_services @started_services ||= begin states_to_skip = %w[stopped none] Utils.safe_popen_read(HOMEBREW_BREW_FILE, "services", "list").lines.filter_map do |line| name, state, _plist = line.split(/\s+/) next if states_to_skip.include? state name end end end |
.stop(name, keep: false, verbose: false) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
13 14 15 16 17 18 19 20 21 22 |
# File 'bundle/brew_services.rb', line 13 def self.stop(name, keep: false, verbose: false) return true unless started?(name) args = ["services", "stop", name] args << "--keep" if keep return unless Bundle.brew(*args, verbose:) started_services.delete(name) true end |
.versioned_service_file(name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'bundle/brew_services.rb', line 67 def self.versioned_service_file(name) env_version = Bundle.formula_versions_from_env[name] return if env_version.nil? formula = Formula[name] prefix = formula.rack/env_version return unless prefix.directory? service_file = if Homebrew::Services::System.launchctl? prefix/"#{formula.plist_name}.plist" else prefix/"#{formula.service_name}.service" end service_file if service_file.file? end |