I''m trying to get Merb running on Windows XP SP2 and am experiencing some difficulties. I load http://localhost:4000/posts/new in my browser expecting to see the contents of new.herb rendered. However the following error is reported: Request: PATH_INFO: /posts/new Params: {"action"=>"new", "id"=>nil, "controller"=>"posts"} Routing to controller: Posts action: new Parsing HTTP Input took: 0.016 seconds undefined local variable or method `session'' for #<Posts:0x2da56a4> - (NameError) E:/Dev/Ruby/merb-0.0.7/examples/sample_app/dist/app/controllers/posts.rb:5:in `new'' After a bit of grepping I see that merb.yml has commented out ":session: true". So I uncomment that line and restart merb. This leads to the following error on the console: C:/Ruby/lib/ruby/gems/1.8/gems/merb-0.0.7/bin/merb:139:in `fork'': the fork() function is unimplemented on this machine (NotImplementedError) from C:/Ruby/lib/ruby/gems/1.8/gems/merb-0.0.7/bin/merb:139:in `start'' from C:/Ruby/lib/ruby/gems/1.8/gems/merb-0.0.7/bin/merb:114:in `run'' from C:/Ruby/lib/ruby/gems/1.8/gems/merb-0.0.7/bin/merb:193 from C:/Ruby/bin/merb:18:in `load'' from C:/Ruby/bin/merb:18 I tried to resolve this by adding the following to the end of the "require ..." lines in merb.rb: require ''daemons'' require ''win32-pr'' require ''win32-process'' require ''win32-dir'' require ''win32-file'' require ''win32-file-stat'' This did not solve the problem. Anyone familiar with how to get merb working on a win32 platform? Ruby newbie here, probably asking silly questions; please be patient :) Thanks, Ed
On Dec 4, 2006, at 9:10 AM, merb-devel at rubyforge.org wrote:> I''m trying to get Merb running on Windows XP SP2 and am experiencing > some difficulties. I load http://localhost:4000/posts/new in my > browser expecting to see the contents of new.herb rendered. However > the following error is reported: > > Request: PATH_INFO: /posts/new > Params: {"action"=>"new", "id"=>nil, "controller"=>"posts"} > Routing to controller: Posts action: new > Parsing HTTP Input took: 0.016 seconds > undefined local variable or method `session'' for #<Posts:0x2da56a4> - > (NameError) > E:/Dev/Ruby/merb-0.0.7/examples/sample_app/dist/app/controllers/ > posts.rb:5:in > `new'' > > <snip> > > I tried to resolve this by adding the following to the end of the > "require ..." lines in merb.rb: > require ''daemons'' > require ''win32-pr'' > require ''win32-process'' > require ''win32-dir'' > require ''win32-file'' > require ''win32-file-stat'' > > This did not solve the problem. Anyone familiar with how to get merb > working on a win32 platform? Ruby newbie here, probably asking silly > questions; please be patient :) > > Thanks, > > EdHey Ed- Sorry I should put some docs about the session container. You have to start merb with the -s option to start the session drb server. So to use sessions you must either set the :session: config option to the port number to run the drb session container on or start merb the following way: $ merb -s 33333 That will start the merb drb server on port 33333 and link it into merb. If you don''t need sessions then don''t turn on this option and remove the session stuff from the posts controller. The sample app is really just kind of a playground. its not reallyt an app yet ;) As far as the win32 process stuff please let me know if the drb server works for you with the win32process stuff. If the sessions container doesn''t work on win let me know and I will show you how to use ActiveRecords for the merb sessions instead of a drb server. Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
On 12/4/06, merb-devel at rubyforge.org <merb-devel at rubyforge.org> wrote:> > On Dec 4, 2006, at 9:10 AM, merb-devel at rubyforge.org wrote: > > > I''m trying to get Merb running on Windows XP SP2 and am experiencing > > some difficulties. I load http://localhost:4000/posts/new in my > > browser expecting to see the contents of new.herb rendered. However > > the following error is reported: > > > > Request: PATH_INFO: /posts/new > > Params: {"action"=>"new", "id"=>nil, "controller"=>"posts"} > > Routing to controller: Posts action: new > > Parsing HTTP Input took: 0.016 seconds > > undefined local variable or method `session'' for #<Posts:0x2da56a4> - > > (NameError) > > E:/Dev/Ruby/merb-0.0.7/examples/sample_app/dist/app/controllers/ > > posts.rb:5:in > > `new'' > > > > <snip> > > > > I tried to resolve this by adding the following to the end of the > > "require ..." lines in merb.rb: > > require ''daemons'' > > require ''win32-pr'' > > require ''win32-process'' > > require ''win32-dir'' > > require ''win32-file'' > > require ''win32-file-stat'' > > > > This did not solve the problem. Anyone familiar with how to get merb > > working on a win32 platform? Ruby newbie here, probably asking silly > > questions; please be patient :) > > > > Thanks, > > > > Ed > > > Hey Ed- > > Sorry I should put some docs about the session container. You have > to start merb with the -s option to start the session drb server. So > to use sessions you must either set the :session: config option to > the port number to run the drb session container on or start merb the > following way: > > $ merb -s 33333 > > That will start the merb drb server on port 33333 and link it into > merb. If you don''t need sessions then don''t turn on this option and > remove the session stuff from the posts controller. The sample app is > really just kind of a playground. its not reallyt an app yet ;) > > As far as the win32 process stuff please let me know if the drb > server works for you with the win32process stuff. If the sessions > container doesn''t work on win let me know and I will show you how to > use ActiveRecords for the merb sessions instead of a drb server. > > Cheers- > -- Ezra Zygmuntowicz > -- Lead Rails Evangelist > -- ez at engineyard.com > -- Engine Yard, Serious Rails Hosting > -- (866) 518-YARD (9273) > > > _______________________________________________It turns out I used the wrong names for the required gems. Instead of... require ''daemons'' require ''win32-pr'' require ''win32-process'' require ''win32-dir'' require ''win32-file'' require ''win32-file-stat'' I should have done... require ''win32/process'' require ''win32/file'' require ''win32/file/stat'' Using merb -s 33333 then seems to starts drb. The console shows that it has started and is bound to 0.0.0.0 and listening on port 33333. However, mongrel appears to start twice and fails due to bind error. This is b/c mongrel is unable to stop and start and tries to bind to the same listening port the second time mongrel_start is called? Ruby reports that Process.setsid is not supported on the win32 platform. I expect there will be many more api related issues while learning ruby and trying to get merb to run on windows. My goal is to create a simple ruby application that will be used by a small office to create, read, update, and delete HTML newsletters. Maybe merb is the right tool for the job. Anyway, I digress... I''d appreciate it if you would show me how to use ActiveRecords for the merb sessions instead of a drb server. Thanks, Ed