I’m translating my usual sysadmining shellscripts into ruby for fun and practice. One thing I hate from Ruby (maybe the only or the most important one) is its documentation. It is zero browseable and friendly, and makes you waste half of your time trying to find on google which module/class does what you need.
One thing I’ve been trying to find is how to copy a file (OMG!).
Can it be so difficult?? … please, try to find it on File class reference.
You have to figure out that exists a module called FileUtils or its old bro (ruby 1.8.6) ftools. Using them you can easily copy, move, rename and make basic file management.
What I find more surprising is that the File class reference does not mention any of them (Uh!?).
Once I found it the job was easy (using ftools as I’m still on Ruby 1.8.7):
require 'ftools' File.copy source_file, target_file