首页 > 其他 > 详细

rake 任务参数传递问题解决

时间:2015-09-11 15:55:16      阅读:264      评论:0      收藏:0      [点我收藏+]

原文 :  https://robots.thoughtbot.com/how-to-use-arguments-in-a-rake-task

 

namespace :tweets do
  desc ‘Send some tweets to a user‘
  task :send, [:username] => [:environment] do |t, args|
    Tweet.send(args[:username])
  end
end

  注意,当你安装了zsh时候,执行下面命令会报错

 

rake tweets:seed[100,200]
zsh: no matches found: tweets:seed[100,200]

  因为zsh不能正确解析,所以需要这样操作

rake tweets:send\[cpytel\]

或者
rake ‘tweets:send[cpytel]‘

也可以在zsh的配置文件中添加 unsetopt nomatch 解决,在执行时使用

rake tweets:send[cpytel]

  

  

 

rake 任务参数传递问题解决

原文:http://www.cnblogs.com/or2-/p/4800976.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!