Rake文件:
require "bundler/gem_tasks"
require "workers/access_token_worker"
require 'dotenv'
Dotenv.load
task :default => 'access_token:refresh'
namespace :access_token do
task :refresh do
AccessTokenWorker.work(ENV['WECHAT_APP_ID'], ENV['WECHAT_APP_SECRET'])
end
end
rake -T:
rake build # Build wechat-0.1.0.gem into the pkg directory
rake install # Build and install wechat-0.1.0.gem into system gems
rake install:local # Build and install wechat-0.1.0.gem into system gems without network access
rake release # Create tag v0.1.0 and build and push wechat-0.1.0.gem to Rubygems
答案 0 :(得分:1)
嗯,它没有出现,因为你没有使用任何描述。使用desc
添加说明,如下所示:
$ cat Rakefile
namespace :access_token do
desc "some tasks"
task :refresh do
end
end
$ rake -T
rake access_token:refresh # some tasks
现在,如果我删除desc
,它就不会来了。再看一遍:
$ cat Rakefile
namespace :access_token do
task :refresh do
end
end
$ rake -T
$ rake -P
rake access_token:refresh
但即使您没有添加rake -P
,desc
也会列出。
-P
,--prereqs
- >显示任务和依赖关系,然后退出。
-T
,--task
s [PATTERN]
- >显示任务(匹配可选PATTERN
)和描述,然后退出。