History of rails script/generate commands

2019-04-02 18:17发布

问题:

Is there a plugin/gem to log/record the history of rails script/generate commands?

回答1:

I added code to script/generate and that does the trick.

CMD = "#{$0} #{ARGV.join(' ')}\n"
File.open(File.expand_path('../../log/generate.log',
         __FILE__), 'a') {|f| f.write(CMD) }