Topic: Run Rake from Controller/View?!
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.
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