Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benefits of using Ruby FileUtils instead of Bash commands?

Tags:

bash

ruby

What are the benefits of using FileUtils methods http://ruby-doc.org/core/classes/FileUtils.html than the equivalent Bash commands?

like image 574
never_had_a_name Avatar asked Sep 11 '10 02:09

never_had_a_name


2 Answers

Over and above the fact that you don't have to worry about ensuring your target platform has the specific tools you're using installed, and over and above the problem of doing proper quoting of shell oddities (especially problematical if you target both Windows and Unix-alikes -- Cygwin, GNUWin32, etc. notwithstanding), if you use Ruby's FileUtils you have the moderately-sized overhead of a Ruby function call while if you use external utilities you have the rather sizable overhead of firing up an external process each and every "call".

like image 187
JUST MY correct OPINION Avatar answered Oct 05 '22 05:10

JUST MY correct OPINION


The FileUtils methods work on Windows.

like image 27
sepp2k Avatar answered Oct 05 '22 05:10

sepp2k