典型rake任務的定義是這樣的:如何在定義之後向rake任務添加描述?
desc "Set the environment value for the database"
task "environment:set" => [:environment, :load_config] do
ActiveRecord::InternalMetadata.create_table
ActiveRecord::InternalMetadata[:environment] = ActiveRecord::Migrator.current_environment
end
但是,如果不具備desc
它,我想以後增加它在運行時,與任務定義文件後,已執行。類似desc "this is the documentation", task: :taskname
。這可能嗎?
看起來這裏的方法實現了覆蓋desc和行爲:http://metaskills.net/2010/05/26/the-alias-method-chain-of-rake-override-rake-task/ –