class Rspec::Bash::BashWrapper
Public Class Methods
new(port)
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 4 def initialize(port) @port = port @override_list = [] at_exit { cleanup } end
Public Instance Methods
add_override(override)
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 41 def add_override(override) @override_list << override end
cleanup()
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 32 def cleanup remove_file_system_path wrapper_output_path remove_file_system_path stderr_output_path end
remove_file_system_path(path)
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 37 def remove_file_system_path(path) FileUtils.remove_entry_secure(path) if Pathname.new(path).exist? end
stderr_output_path()
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 28 def stderr_output_path File.join(Dir.tmpdir, "stderr-#{@port}.tmp") end
wrap_script(script)
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 10 def wrap_script(script) wrapper_template = ERB.new(File.new(wrapper_input_path).read, nil, '%') File.open(wrapper_output_path, 'w') do |file| file.write(wrapper_template.result(binding)) end File.chmod(0755, wrapper_output_path) wrapper_output_path end
wrapper_input_path()
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 20 def wrapper_input_path File.join(project_root, 'bin', 'bash_wrapper.sh.erb') end
wrapper_output_path()
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 24 def wrapper_output_path File.join(Dir.tmpdir, "wrapper-#{@port}.sh") end
Private Instance Methods
project_root()
click to toggle source
# File lib/rspec/bash/wrapper/bash_wrapper.rb, line 47 def project_root File.expand_path( File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', '..') ) end