bar_1

contents_map

2018年12月21日金曜日

Thor 名前空間 Namespaces

名前空間 Namespaces

デフォルトでは, あなたのThorタスクはRubyの名前空間を使って実行される. このクラスは名前空間を持たない:
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

0 件のコメント:

コメントを投稿

何かありましたら、どうぞ: