This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Ruby as multi purpose scripting language?

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, Carol. I think I'll spend a weekend to get into Ruby.
Lars
 
author
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
You can't have everything. Where would you put it?
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!