Forum: Ruby on Rails Can rake tasks take paramaters?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tim P. (Guest)
on 2007-03-19 16:47
Can rake tasks take paramaters?

Thanks

Tim
Shawn Roske (Guest)
on 2007-03-19 19:19
(Received via mailing list)
Yes,

task :my_task do
  puts ENV['MESSAGE']
end

rake my_task MESSAGE=Testing

-Shawn
Tim P. (Guest)
on 2007-03-19 20:02
Ahhh brilliant

Thanks shawn

Tim

Shawn Roske wrote:
> Yes,
>
> task :my_task do
>   puts ENV['MESSAGE']
> end
>
> rake my_task MESSAGE=Testing
>
> -Shawn
Phlip (Guest)
on 2007-09-26 01:10
(Received via mailing list)
Shawn Roske wrote:

> task :my_task do
>   puts ENV['MESSAGE']
> end
>
> rake my_task MESSAGE=Testing

One might even shortcut that, for svn commits:

 task :ci => [:test] do
   system("svn ci -m=#{ENV['m']}")
 end

 rake ci m='what we did'

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
This topic is locked and can not be replied to.