典型的な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/ –