class Ikaros::Runner
Public Class Methods
new(config)
click to toggle source
# File lib/ikaros/runner.rb, line 5 def initialize(config) @config = config @containers = [] end
Public Instance Methods
run()
click to toggle source
# File lib/ikaros/runner.rb, line 10 def run start_services run_test stop_services end
Private Instance Methods
bundle_path()
click to toggle source
# File lib/ikaros/runner.rb, line 66 def bundle_path "#{ENV['CACHE_BUNDLE_PATH']}/#{@config.project_name}" end
options_for_main_container()
click to toggle source
# File lib/ikaros/runner.rb, line 37 def options_for_main_container env = {} link = {} @containers.each do |container| case container.basename when 'redis' env['REDISTOGO_URL'] = 'redis://redis' env['REDIS_URL'] = 'redis://redis' when 'elasticsearch' env['ELASTICSEARCH_URL'] = 'http://elasticsearch:9200' end link[container.basename] = container.name end mount = { '/code' => @config.project_path, '/scripts' => File.expand_path("../scripts", __FILE__), '/bundle' => bundle_path } { link: link, env: env, mount: mount, output: true } end
run_test()
click to toggle source
# File lib/ikaros/runner.rb, line 25 def run_test app = Container.new(@config.app_type, options_for_main_container) app.start end
start_services()
click to toggle source
# File lib/ikaros/runner.rb, line 17 def start_services @config.services.each do |service| container = Container.new(service, daemon: true) container.start @containers << container end end
stop_services()
click to toggle source
# File lib/ikaros/runner.rb, line 30 def stop_services @containers.each do |container| container.stop end end