goofansu
goofansu

Reputation: 2277

rake -T cannot show my tasks

Rakefile:

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

Upvotes: 0

Views: 154

Answers (1)

Arup Rakshit
Arup Rakshit

Reputation: 118261

Well, it is not coming as you didn't use any descriptions. Add a description using desc like below :

$ cat Rakefile
namespace :access_token do
  desc "some tasks"
  task :refresh do
  end
end
$ rake -T
rake access_token:refresh  # some tasks

Now, if I remove the desc, it wouldn't come. See again :

$ cat Rakefile
namespace :access_token do
  task :refresh do
  end
end
$ rake -T
$ rake -P
rake access_token:refresh

But, rake -P will list even if you don't have desc added.

-P, --prereqs -> Display the tasks and dependencies, then exit.

-T, --tasks [PATTERN] -> Display the tasks (matching optional PATTERN) with descriptions, then exit.

Upvotes: 1

Related Questions