On Mon, Sep 28, 2009 at 4:29 PM, Iggy Whydoucare <rails-mailing-l...@andreas-s.net> wrote: > > > > Hi - I have a simple problem, maybe you guys can help me come up with a > solution: > > I'm looking for a way to let a user of my rails app execute a rake-task > by clicking on a link in a view. > > Szenario: > I'm writing a rails-App that takes a given directory and analyzes any > ruby files in that directory. Since there already are quite a few tools > that gather information from ruby-sourcecode i don't feel like > re-inventing the wheel and i'd like to integrate some of those tools > into my app. > > The "Metric-Fu"-Suite for example comes with all kinds of > Metric-Calculation tools that can be started with different rake-tasks > I.e. "rake metrics:reek" will start collecting info about "bad smells" > using the roodi-Toolset. It's also possible to pass parameters (or > define them in the rakefile) to tell reek which directories to parse for > sourcefiles. > > For my project I would like to create a view where a user can add local > directories where sourcefiles are located, and select the metric tools > he wants to use to check his code (like reek, roodi, flog etc). > > Is there any way to implement this? > I'd basically need to create a rake task with the given parameters and > than run it from my controller... > > Any thoughts? > Thanks in advance
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) Hope it helps. -- Leonardo Mateo. There's no place like ~ --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---