Sha256: 7524d40da92099cb7467ae828a2f1f37662a7b180945ba8551cd618b5218c714
Contents?: true
Size: 974 Bytes
Versions: 7
Compression:
Stored size: 974 Bytes
Contents
module Koine class TestRunner class Adapters class LastCommand < BaseAdapter def initialize(storage: Storage.new) @storage = storage end def test_command(config) command = next_adapter.test_command(config) unless command return @storage.retrieve end @storage.store(command) command end class Storage def initialize(file_path: '.cache/koine/last-test-command.cache') @file_path = file_path end def retrieve if File.exist?(@file_path) File.read(@file_path).strip end end def store(value) folder = File.dirname(@file_path) unless File.exist?(folder) FileUtils.mkdir_p(folder) end File.open(@file_path, 'w') { |f| f.puts(value) } end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems