Class: Fhcap::Tasks::Chef::ChefZeroServer

Inherits:
Object
  • Object
show all
Defined in:
lib/fhcap/tasks/chef/chef_zero_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ChefZeroServer

Returns a new instance of ChefZeroServer.



11
12
13
14
15
16
# File 'lib/fhcap/tasks/chef/chef_zero_server.rb', line 11

def initialize(options={})
  host = options[:host] || '127.0.0.1'
  port = options[:port] || 7799
  log_level = options[:'log-level'] || 'info'
  @zero_server = ChefZero::Server.new(port: port, host: host, log_level: log_level)
end

Instance Attribute Details

#threadObject

Returns the value of attribute thread.



9
10
11
# File 'lib/fhcap/tasks/chef/chef_zero_server.rb', line 9

def thread
  @thread
end

#zero_serverObject

Returns the value of attribute zero_server.



9
10
11
# File 'lib/fhcap/tasks/chef/chef_zero_server.rb', line 9

def zero_server
  @zero_server
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/fhcap/tasks/chef/chef_zero_server.rb', line 25

def running?
  @zero_server.running?
end

#start_chef_zero_serverObject



18
19
20
21
22
23
# File 'lib/fhcap/tasks/chef/chef_zero_server.rb', line 18

def start_chef_zero_server
  unless @thread
    @thread = @zero_server.start_background
  end
  @thread
end

#urlObject



29
30
31
# File 'lib/fhcap/tasks/chef/chef_zero_server.rb', line 29

def url
  @zero_server.url
end