Hey, I''m trying to install ruby on rails on windows xp with cygwin. I installed the rails gem but when I go to create an application I get the following : "No such file or directory - /dev/urandom" the error seems to be coming form secret_key_generator.rb line 22. But I can''t find a file of that name Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Apparently the /dev/urandom file does not ''exist'' in cygwin, but you can do stuff with it, i.e. `cat /dev/urandom'' (although don''t try this, cos it tends to mess things up a bit). In any case, things like File.exists?(''/dev/urandom'') in ''secret_key_generator.rb'' file fail. So I changed all the occurences of ''if File.exists?(''/dev/urandom'')'' to ''if true''. Still it would fail on: ''File.read("/dev/urandom", 64).unpack("H*")[0]'' Now don''t ask me why (it''s only my 3rd day with Ruby, and 1st day with Rails), works for me if I put this line before the File.read() : def generate_secret_with_urandom puts "Before Read" return File.read("/dev/urandom", 64).unpack("H*")[0] end et voila, it works. I don''t know why it works (yet), but it does ;), I now have cygwin + ruby (the cygwin one) + gem + rails working. I even checked if the "secret" returned is different every time, and it is. It''s an oddity, and I''ll have to fix it every time I update to a new version of Rails, but I''m hoping to be more of an expert by the time an update is released ;) -Marcin Jekot jjburka wrote:> Hey, > > I''m trying to install ruby on rails on windows xp with cygwin. I > installed the rails gem but when I go to create an application I get > the following : "No such file or directory - /dev/urandom" the error > seems to be coming form secret_key_generator.rb line 22. But I can''t > find a file of that name > > Thanks-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What Marcin said works - I just wanted to simplify the steps: 1. locate the file secret_key_generator.rb inside cygwin directory (in my case - c:\cygwin\lib\ruby\gems\1.8\gems\rails-2.0.2\lib \rails_generator\) 2. find "def generate_secret_with_urandom" (line #85 in Rails 2.0.2) 3. copy the line just below "def generate_....": puts "Before Read" 4. save the file and it should work Hope it helps --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The files in /dev don''t exist by default under cygwin. Instead cygwin internally handles reading and writing to them specially. See http://www.cygwin.com/cygwin-ug-net/using-specialnames.html for more info. There is also a script to create the dev files. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.