Class: Picobox::Service
- Inherits:
-
Object
- Object
- Picobox::Service
- Includes:
- Utils::Output, Utils::Visitable
- Defined in:
- lib/picobox/service.rb
Instance Attribute Summary collapse
-
#os ⇒ Object
readonly
Returns the value of attribute os.
Instance Method Summary collapse
- #add(services) ⇒ Object
- #build(service = nil) ⇒ Object
-
#initialize(os) ⇒ Service
constructor
A new instance of Service.
- #list ⇒ Object
- #remove(type = nil) ⇒ Object
Methods included from Utils::Output
#display_error, #display_info, #display_line, #display_status
Methods included from Utils::Visitable
Constructor Details
#initialize(os) ⇒ Service
Returns a new instance of Service.
8 9 10 |
# File 'lib/picobox/service.rb', line 8 def initialize(os) @os = os end |
Instance Attribute Details
#os ⇒ Object (readonly)
Returns the value of attribute os.
6 7 8 |
# File 'lib/picobox/service.rb', line 6 def os @os end |
Instance Method Details
#add(services) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/picobox/service.rb', line 19 def add(services) services.each { |service| accept(Commands::AddService.new(service)) } accept(Commands::Restart.new) rescue StandardError => e display_error e exit 1 end |
#build(service = nil) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/picobox/service.rb', line 12 def build(service=nil) accept(Commands::BuildService.new(service)) rescue StandardError => e display_error e exit 1 end |
#list ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/picobox/service.rb', line 42 def list() accept(Commands::UpdatePackages.new) accept(Commands::ListServices.new) rescue StandardError => e display_error e exit 1 end |
#remove(type = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/picobox/service.rb', line 28 def remove(type = nil) return if type.nil? accept(Commands::RemoveService.new(type)) accept(Commands::Restart.new) rescue Errors::ServiceNotInstalled display_service_not_installed type rescue Errors::ServiceNotImplemented display_service_not_available type rescue StandardError => e display_error e exit 1 end |