Class: MacSetup::ServicesInstaller
- Inherits:
-
Object
- Object
- MacSetup::ServicesInstaller
- Defined in:
- lib/mac_setup/services_installer.rb
Constant Summary collapse
- LAUNCH_AGENTS_PATH =
File.("~/Library/LaunchAgents")
- SERVICES_TAP =
"homebrew/services"
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#running_services ⇒ Object
readonly
Returns the value of attribute running_services.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config, status) ⇒ ServicesInstaller
constructor
A new instance of ServicesInstaller.
- #run ⇒ Object
Constructor Details
#initialize(config, status) ⇒ ServicesInstaller
Returns a new instance of ServicesInstaller.
16 17 18 19 20 |
# File 'lib/mac_setup/services_installer.rb', line 16 def initialize(config, status) @config = config @status = status @services = config.services end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/mac_setup/services_installer.rb', line 10 def config @config end |
#running_services ⇒ Object (readonly)
Returns the value of attribute running_services.
10 11 12 |
# File 'lib/mac_setup/services_installer.rb', line 10 def running_services @running_services end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
10 11 12 |
# File 'lib/mac_setup/services_installer.rb', line 10 def services @services end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/mac_setup/services_installer.rb', line 10 def status @status end |
Class Method Details
.run(config, status) ⇒ Object
12 13 14 |
# File 'lib/mac_setup/services_installer.rb', line 12 def self.run(config, status) new(config, status).run end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mac_setup/services_installer.rb', line 22 def run return if services.none? MacSetup.log "Installing services..." FileUtils.mkdir_p(LAUNCH_AGENTS_PATH) tap_services get_running_services services.each { |service| install_service(service) } end |