aspose file tools*
The moose likes Other Languages and the fly likes Ruby as multi purpose scripting language? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Ruby as multi purpose scripting language?" Watch "Ruby as multi purpose scripting language?" New topic
Author

Ruby as multi purpose scripting language?

Lars Behnke
Ranch Hand

Joined: May 09, 2006
Posts: 76
Hi all,

Obviously most people use Ruby for developing Rails web applications. So I'd like to hear your opinion/experience on Ruby as multi purpose scripting language. How suitable is Ruby for performing the following tasks as compared to other scripting languages such as Perl, JavaScript or Groovy:

(1) Running Ruby scripts as part of an ANT/Maven build procedure.

(2) Executing Ruby scripts from a shell/batch script in order to perform
file system tasks (lets say traverse directories and rename files)

(3) Executing Ruby scripts within an java application in order to perform customizable data validations.

What do you think?

Lars
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Originally posted by Lars Behnke:
Hi all,

Obviously most people use Ruby for developing Rails web applications. So I'd like to hear your opinion/experience on Ruby as multi purpose scripting language.


I don't know whether most people use Ruby as Ruby on Rails or not. I played around with RoR a bit and decided it would be more fun to spend some time learning Ruby than continuing to learn Ruby on Rails.

I don't really feel like addressing your specific task questions, but thought I'd point out some Ruby-specific books that are available.

This one seemed particularly pertinent to your query:
Everyday Scripting with Ruby - for Teams, Testers, and You

Enterprise Integration with Ruby

Before the Scripting with Ruby book came out I got Data Crunching - Solve Everyday Problems using Java, Python, and more and I did ruby versions of the examples instead of just typing in the example in python or whatever they were using. I had to do a bit of research to find the ruby equivalent for some of the coding, but it was pretty easy (especially since the 1st edition of programming ruby is available on the web free).
Lars Behnke
Ranch Hand

Joined: May 09, 2006
Posts: 76
Thanks for your reply, Carol. I think I'll spend a weekend to get into Ruby.
Lars
Justin Gehtland
author
Ranch Hand

Joined: Jan 30, 2007
Posts: 31
You can also check out the PLEAC-Ruby site, which is a rewrite of the Perl cookbook in Ruby. Walks through most of the major scripting tasks you would normally perform, and you can compare them directly against their Perl counterparts for a direct comparison.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Lars Behnke:
How suitable is Ruby for performing the following tasks as compared to other scripting languages such as Perl, JavaScript or Groovy:

(1) Running Ruby scripts as part of an ANT/Maven build procedure.

(2) Executing Ruby scripts from a shell/batch script in order to perform
file system tasks (lets say traverse directories and rename files)

(3) Executing Ruby scripts within an java application in order to perform customizable data validations.


Regarding (1), I wrote an article back in 2003, titled Scripting Ant for the journal, which shows how to embed Python code into an Ant script but the same stuff can be done with Ruby, too. And, of course, running a Ruby script with the <exec/> task is just the same as running a Python or Perl script.

Regarding (2), the same functionality exists in Ruby's standard libraries as can be found in Python or Perl, for example.

Regarding (3), Ruby beats Perl 12-0. With JRuby, you can embed Ruby code into your Java application or vice versa. The same is not possible with Perl, as far as I know. For Python, however, there's Jython.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ruby as multi purpose scripting language?