Hi,
I am trying to use ruby int an embedded web server. The environment
does not have the luxury of CGI or WebBrick. I find limited
documentation on how to get this to work. As a test program on windows,
I tried the code in the section below.
I have the issues.
1. Is public/dispatch.rb the right script to invoke a rails app? If
so, what is the right way to invoke dispatch.rb?
2. How can we clean up after the invocation, assuming multiple rails
app are running on the same server?
3. I understand ruby is unsafe for multithreaded invocation. Is
there a distribution that can handle multiple ruby VMs?
TIA.
SS
==SAMPLE CODE==
int main(int argc, char* argv[])
{
#if defined(NT)
NtInitialize(&argc, &argv);
#endif
ruby_init();
ruby_init_loadpath();
//chdir( "" );
::SetEnvironmentVariable( "SCRIPT_NAME", "/MyTest" );
::SetEnvironmentVariable( "REQUEST_URI",
“http://localhost:3000/MyTest#index” );
::SetEnvironmentVariable( “QUERY_STRING”, “” );
::SetEnvironmentVariable( “REQUEST_METHOD”, “GET” );
::SetEnvironmentVariable( “CONTENT_LENGTH”, “0” );
//ruby_script("embed" );
//rb_load_file( "public\\dispatch.rb" );
rb_load_file( "public\\dispatch.rb" );
//ruby_exec();
ruby_run();
ruby_finalize();
return 0;
}
==OUTPUT==
./public/…/config/boot.rb:15:in `require’: no such file to load –
rubygems (Lo
adError)
from ./public/…/config/boot.rb:15
from ./public/…/config/environment.rb:8
from public\dispatch.rb:3
Press any key to continue