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.
A049c3597983fdaaa2af2b0010c49abc?d=identicon&s=25 Tim Perrett (timperrett)
on 2007-03-19 15:47
Can rake tasks take paramaters?

Thanks

Tim
7db798c17fea871c27402138b4497912?d=identicon&s=25 Shawn Roske (Guest)
on 2007-03-19 18:19
(Received via mailing list)
Yes,

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

rake my_task MESSAGE=Testing

-Shawn
A049c3597983fdaaa2af2b0010c49abc?d=identicon&s=25 Tim Perrett (timperrett)
on 2007-03-19 19:02
Ahhh brilliant

Thanks shawn

Tim

Shawn Roske wrote:
> Yes,
>
> task :my_task do
>   puts ENV['MESSAGE']
> end
>
> rake my_task MESSAGE=Testing
>
> -Shawn
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-09-25 23: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.