lib/buildmaster/cotta/in_memory_system.rb in BuildMaster-1.1.9 vs lib/buildmaster/cotta/in_memory_system.rb in BuildMaster-1.1.12
- old
+ new
@@ -1,14 +1,11 @@
-$:.unshift File.dirname(__FILE__)
-
require 'stringio'
-require 'file_not_found_error'
module BuildMaster
class InMemorySystem
- attr_reader :executed_commands
+ attr_reader :executed_commands, :pwd
def initialize
@executed_commands = []
@content = ""
@file_system = Hash.new
@@ -117,9 +114,23 @@
delete_entry(pathname)
end
def to_s
return 'InMemorySystem'
+ end
+
+ def chdir(path)
+ last_pwd = @pwd
+ @pwd = path.to_s
+ result = 0
+ if (block_given?)
+ begin
+ result = yield
+ ensure
+ @pwd = last_pwd
+ end
+ end
+ result
end
private
def gather_paths_to_create(pathname)
paths = Array.new
\ No newline at end of file