Leonardo Mateo wrote:

> Just a guess, since I haven't ever had this situation but, rake files
> are ruby files, you should be able to include them from any other ruby
> file and execute the methods it has defined inside.
> As I said, I haven't tried this, is just a guess.

> 
> Otherwise, you can always use a system call to execute system commands
> (such as rake)
> 

Hi Leonardo

I think you're spot on with your answers. It's exactly what I tried to 
do (in that order, too ;-)

The problem is that the task simply doesnt get executed when I try 
running it from the controller:

If I do s.th. like this in my controller:

require 'rake'
Rake::Task["doc:app"]

--> the app runs without error but the rake task doesn't get executed

however if I use a random 'task' name:
require 'rake'
Rake::Task["foo:bar"]
-->Error: Don't know how to build task 'foo:bar'

So it does seem like my code gets evaluated but the rake task is just 
not executed. Am I missing something like an explicit "run task" 
command?!



The "system call" approach produces similar behavior:

If I add this line in my controller:
system('dir > test.txt')
--> works fine and places the test.txt file in my rails base directory

however if I add:
system('rake doc:app')
--> my app executes but nothing happens (no docs are generated)

If I run "rake doc:app" from the command line it works as expected ...

What is my problem here?!
I'm confused...
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to