Sha256: 0ccd2e51f417bef45f0caa94283093149358b00066c37c0385740c12f1d88144
Contents?: true
Size: 1.94 KB
Versions: 3
Compression:
Stored size: 1.94 KB
Contents
module Gurke class Runner attr_reader :config, :options def initialize(config, options = {}) @config = config @options = options end def reporter @reporter ||= begin r = (options[:formatter] + '_reporter').split('_').map(&:capitalize).join Reporters.const_get(r).new end end def builder @builder ||= Builder.new end def run(files, reporter = self.reporter) files.map! do |file| split = file.split(':') [split[0], split[1..-1].map{|i| Integer(i) }] end features = builder.load files.map{|file, _| file } features.filter(options, files).run self, reporter end def hook(scope, world, context, &block) config.hooks[scope].run world, context, &block end def with_filtered_backtrace yield rescue => e unless options[:backtrace] base = File.expand_path(Gurke.root.dirname) e.backtrace.select!{|l| File.expand_path(l)[0...base.size] == base } end raise end class LocalRunner < Runner def run(*) hook :system, nil, nil do super end end end class DRbServer < Runner URI = 'druby://localhost:8789' def run(files) require 'drb' hook :system, nil, nil do DRb.start_service URI, self $stdout.puts 'DRb Server running...' begin DRb.thread.join rescue Interrupt $stdout.puts $stdout.puts 'Exiting...' end 0 end end def run_remote(options, files, reporter) Runner.new(config, options).run files, reporter end end class DRbClient < Runner def run(files) require 'drb' DRb.start_service $stdout.puts 'Connect to DRb server...' srv = DRbObject.new_with_uri DRbServer::URI srv.run_remote options, files, reporter end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gurke-2.4.2 | lib/gurke/runner.rb |
gurke-2.4.1 | lib/gurke/runner.rb |
gurke-2.4.0 | lib/gurke/runner.rb |