Top Level Namespace

Defined Under Namespace

Modules: Kernel, MockIt, RSCM Classes: Class, File, Object, Time

Constant Summary collapse

HOMEDIR =
ENV['HOME']
WIN32 =
RUBY_PLATFORM == "i386-mswin32"
CYGWIN =
RUBY_PLATFORM == "i386-cygwin"
WINDOWS =
WIN32 || CYGWIN

Instance Method Summary collapse

Instance Method Details

#with_working_dir(dir) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rscm/path_converter.rb', line 7

def with_working_dir(dir)
  # Can't use Dir.chdir{ block } - will fail with multithreaded code.
  # http://www.ruby-doc.org/core/classes/Dir.html#M000790
  #
  prev = Dir.pwd
  begin
    dir = File.expand_path(dir)
    FileUtils.mkdir_p(dir)
    Dir.chdir(dir)
    yield
  ensure
    Dir.chdir(prev)
  end
end