ruby on rails - Is it possible to call Git or other command line tools from inside a Thor script? -
i find i'm running sequence of routine 'cleanup' tasks before , after make git commit rails 3 app.
i thinking putting these things thor script, 1 thing haven't been able figure out how use thor (or rake) call other tools on system.
is possible call command git log
thor or rake script, , if like?
thanks!
just shell out:
result = %x(git log) puts result
or
system('git log')
if want pass output terminal.
there grit gem abstracts git tools ruby library:
require 'grit' repo = grit::repo.new("/path/to/repo") repo.commits.each |commit| puts "#{commit.id}: #{commit.message}" end
Comments
Post a Comment