-
Notifications
You must be signed in to change notification settings - Fork 552
Namespaces
chase dougherty edited this page Jun 4, 2019
·
6 revisions
By default, your Thor tasks are invoked using Ruby namespace. This class has no namespace:
class App < Thor
desc 'install', 'Install something'
def install
# task code
end
# other tasks
end
Its tasks are invoked as:
thor app:install
However, you could namespace your class as:
module Sinatra
class App < Thor
desc 'install', 'Install something'
def install
# task code
end
# other tasks
end
end
And then you should invoke your tasks as:
thor sinatra:app:install
If desired, you can change the namespace:
module Sinatra
class App < Thor
namespace :myapp
def install
# task code
end
# other tasks
end
end
And then your tasks should be invoked as:
thor myapp:install
Isn't thor awesome?!