Oh, yes, it does have to do something with Thor.
Do not let yourself get confused by the warning. You know that Rails::Generators uses Thor, so walk over to the Thor Wiki and check out how Thor tasks work.
The rails generator execution will call any method in your generator. So make sure that you organize your stuff into methods:
module MyNamespace
class ScaffoldGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def install_my_gem
if yes? "Install MyGem?"
gem 'my_gem'
end
end
def bundle
run 'bundle install'
end
end
end
Be sure to put your generator into the right folder structure, e.g. lib/generators/my_namespace/scaffold_generator.rb
.
Thanks for asking your question, dude!