Class: Boxen::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/boxen/service.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Service

Returns a new instance of Service.



13
14
15
# File 'lib/boxen/service.rb', line 13

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/boxen/service.rb', line 5

def name
  @name
end

Class Method Details

.listObject



7
8
9
10
11
# File 'lib/boxen/service.rb', line 7

def self.list
  files.collect do |service|
    new(human_name(service))
  end
end

Instance Method Details

#disableObject



25
26
27
# File 'lib/boxen/service.rb', line 25

def disable
  Boxen::Util.sudo('/bin/launchctl', 'unload', '-w', location)
end

#enableObject



21
22
23
# File 'lib/boxen/service.rb', line 21

def enable
  Boxen::Util.sudo('/bin/launchctl', 'load', '-w', location)
end

#to_sObject



17
18
19
# File 'lib/boxen/service.rb', line 17

def to_s
  name
end