Module: RackCheck::Helpers

Included in:
ServerManager
Defined in:
lib/rack_check/helpers.rb

Instance Method Summary collapse

Instance Method Details

#with_environment(ru_file) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rack_check/helpers.rb', line 5

def with_environment(ru_file)
  dir_name = "/tmp/rack-check/environment-#{$environments_count += 1}"
  previous_wd = FileUtils.getwd

  FileUtils.mkdir_p dir_name
  File.write(dir_name + '/config.ru', ru_file)

  yield(dir_name)

ensure
  FileUtils.rm_rf dir_name
end