lib/rspeed/splitter.rb in rspeed-0.5.0 vs lib/rspeed/splitter.rb in rspeed-0.5.1

- old
+ new

@@ -23,10 +23,14 @@ stream(:actual_examples, examples) end end end + def append? + RSpeed::Redis.result? || first_pipe? + end + def append(files = CSV.read(RSpeed::Variable::CSV)) files.each do |time, file| redis.lpush(RSpeed::Env.tmp_key, { file: file, time: time.to_f }.to_json) end end @@ -50,20 +54,20 @@ RSpeed::Redis.keys(pattern).map { |key| ::JSON.parse(redis.get(key)) } end end + def need_warm? + first_pipe? && !RSpeed::Redis.result? + end + def pipe_files return unless RSpeed::Redis.result? split[RSpeed::Variable.key(RSpeed::Env.pipe)][:files].map { |item| item[:file] }.join(' ') end - def redundant_run? - !first_pipe? && !exists?(RSpeed::Env.result_key) - end - def rename redis.rename(RSpeed::Env.tmp_key, RSpeed::Env.result_key) end def split(data = diff) @@ -94,15 +98,10 @@ @added_examples ||= begin (actual_examples - rspeed_examples).tap { |examples| stream(:added_examples, examples) } end end - # TODO: exists? does not work: undefined method `>' for false:FalseClass - def exists?(key) - redis.keys.include?(key) - end - def redis @redis ||= ::RSpeed::Redis.client end def removed_examples @@ -122,9 +121,9 @@ def rspeed_examples rspeed_data.map { |item| item[:file] } end def stream(type, data) - puts "PIPE: #{RSpeed::Env.pipe} with #{type}: #{data}" + RSpeed::Logger.log("PIPE: #{RSpeed::Env.pipe} with #{type}: #{data}") end end end