Class: BlueprintAgreement::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/blueprint_agreement/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_service:, config:) ⇒ Server

Returns a new instance of Server.



4
5
6
7
# File 'lib/blueprint_agreement/server.rb', line 4

def initialize(api_service:, config:)
  @api_service = api_service
  @config = config
end

Instance Method Details

#hostObject



27
28
29
# File 'lib/blueprint_agreement/server.rb', line 27

def host
  @api_service.host
end

#restart(path) ⇒ Object



19
20
21
# File 'lib/blueprint_agreement/server.rb', line 19

def restart(path)
  stop && @api_service.start(path)
end

#start(path = @config.default_format) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/blueprint_agreement/server.rb', line 9

def start(path=@config.default_format)
  @api_service.install unless @api_service.installed?

  if @config.active_service
    restart(path) if @config.active_service[:path] != path
  else
    @api_service.start(path)
  end
end

#stopObject



23
24
25
# File 'lib/blueprint_agreement/server.rb', line 23

def stop
  @api_service.stop
end