class Swat::UI::RspecSetup::StatsCollector
Public Class Methods
create()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 17 def self.create if collection_available? new else Stub.new end end
new()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 7 def initialize @revision = Revision.add( current_namespace.merge(threads_count: current_threads_count, name: current_revision_name) ) @logger = TarvitHelpers::ConditionalLogger.new do !!ENV['SWAT_DEBUG'] end @logger.puts 'Results Transferring in ON.' end
Private Class Methods
branch_valid?()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 69 def self.branch_valid? Swat::UI.config.options[:collect] && (Swat::UI.config.options[:collect_branch].nil? || Swat::UI.config.options[:collect_branch] == current_branch) end
collection_available?()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 65 def self.collection_available? branch_valid? end
Public Instance Methods
collect_case(notification)
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 25 def collect_case(notification) @logger.print "test '#{notification.location}' #{ notification.metadata[:execution_result].status } -->.." TestCase.collect(current_namespace, notification, thread_id: current_thread_id, time: @revision.time) @logger.print "..!" end
collect_ended_thread(notification)
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 40 def collect_ended_thread(notification) @logger.print "thread ended -->.." @revision.collect_ended_thread(notification, thread_id: current_thread_id, thread_name: current_thread_name, ) @logger.print "..!" end
collect_started_thread(notification)
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 31 def collect_started_thread(notification) @logger.print "thread started -->.." @revision.collect_started_thread(notification, thread_id: current_thread_id, thread_name: current_thread_name ) @logger.print "..!" end
collection_available?()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 59 def collection_available? self.class.collection_available? end
current_namespace()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 49 def current_namespace { branch: current_branch, user: user, time: current_revision_time, name: name, threads_count: current_threads_count, } end
Private Instance Methods
current_branch()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 75 def current_branch @cb ||= RSpecCommands::CommandsBuilder.current_branch rescue nil end
current_revision_name()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 93 def current_revision_name RSpecCommands::CommandsBuilder.current_revision_name end
current_revision_time()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 89 def current_revision_time RSpecCommands::CommandsBuilder.current_revision_time end
current_thread_id()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 101 def current_thread_id RSpecCommands::CommandsBuilder.current_thread_id end
current_thread_name()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 105 def current_thread_name RSpecCommands::CommandsBuilder.current_thread_name end
current_threads_count()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 97 def current_threads_count RSpecCommands::CommandsBuilder.current_threads_count end
name()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 85 def name @name ||= RSpecCommands::CommandsBuilder.current_revision_name end
user()
click to toggle source
# File lib/swat/ui/stats_collector.rb, line 81 def user @u ||= RSpecCommands::CommandsBuilder.current_user end