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
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
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.