Executing from the command line

Hello,

I will have to write some code that can be triggered from the command line

$ myapp do something

.

Is ruby the way to go? Is Python better?

:slight_smile:

Regards,

-jj. :slight_smile:

Hi there,
What does your code have to do?
If you ask me, Ruby is definitely the way to go, but I am biased :slight_smile:

Upload/Download files + connect to an API :slight_smile:

Sounds like Ruby wil do the trick.

Indeed.

Uploading can be done with Net::FTP

Downloading like this:

#!/usr/bin/env ruby
`wget http://yourdomain.com/flv/sample/sample.flv`

or with Net::HTTP

Connecting to an API would depend on the API in question.

Ruby’s a great command-line language, especially if you’re already familiar with it. You can use all of the gems the ruby community has already written for talking to all sorts of APIs. HTTParty and [URL=“https://github.com/lostisland/faraday”]Faraday are both great http client gems that make it super easy to work with remote APIs.

You can just write any old ruby script and execute it from the command file. You can also do the same with several other languages. Nothing new really.

ruby name_o_file.rb