-
Notifications
You must be signed in to change notification settings - Fork 553
Actions
coderifous edited this page Apr 22, 2011
·
8 revisions
Thor comes with several actions which helps with script and generator tasks. You might be familiar with them since some came from Rails Templates. They are: say, ask, yes?, no?, add_file, remove_file, copy_file, template, directory, inside, run, inject_into_file and a couple more.
To use them, you just need to include Thor::Actions in your Thor classes:
class App < Thor
include Thor::Actions
# tasks
end
Some actions like copy file requires that a class method called source_root is defined in your class. This is the directory where your templates should be placed. Be sure to check the documentation on Thor::Actions.