CafeHey
CafeHey

Reputation: 5820

Rails Rake Tasks, output a message during and at the end

I've made a rails rake task that uploads/crops/re-sizes (with paperclip) silly amounts of images.

I wanted to know how to output a message to the terminal when it was running (e.g. chipolata.jpg processed) and at the end, it takes a good few minutes to run and a little feedback would be good.

Thanks.

Upvotes: 6

Views: 9189

Answers (2)

tsdbrown
tsdbrown

Reputation: 5058

In your loop simply call:

puts "chipolata.jpg processed"

Upvotes: 0

John Topley
John Topley

Reputation: 115372

Just use the standard Ruby puts command:

puts "Hello from Rake!"

You can use string interpolation to output the individual file names within the loop:

puts "#{image_filename} processed"

Upvotes: 16

Related Questions