Module: Berkshelf::API::RSpec::Server

Extended by:
Mixin::Services
Defined in:
lib/berkshelf/api/rspec/server.rb

Class Method Summary collapse

Methods included from Mixin::Services

extended, included

Class Method Details

.clear_cacheObject



6
7
8
# File 'lib/berkshelf/api/rspec/server.rb', line 6

def clear_cache
  cache_manager.clear
end

.instanceObject



10
11
12
# File 'lib/berkshelf/api/rspec/server.rb', line 10

def instance
  Berkshelf::API::Application.instance
end

.running?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/berkshelf/api/rspec/server.rb', line 14

def running?
  Berkshelf::API::Application.running?
end

.start(options = {}) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/berkshelf/api/rspec/server.rb', line 18

def start(options = {})
  options = options.reverse_merge(port: 26210, log_location: "/dev/null", endpoints: [])
  Berkshelf::API::Application.config.endpoints = options[:endpoints]
  unless running?
    Berkshelf::API::Application.run!(options)
    cache_builder.build
  end
end

.stopObject



27
28
29
# File 'lib/berkshelf/api/rspec/server.rb', line 27

def stop
  Berkshelf::API::Application.shutdown
end