LoginSignup
0
0

More than 5 years have passed since last update.

Capistrano で namespace のデフォルト task を設定する

Last updated at Posted at 2016-05-13

そういう機能はなさそうだが、愚直に書けばよさそう。

やりたいこと

Capfile に以下のような namespace を定義したとしよう。

namespace :foo do
  task :aaa do
  end
  task :bbb do
  end
end

cap foo と打ったら foo:aaa を実行してほしい。

やり方

いずれも実際に task :foo を定義する。

1. Rake の alias 機能を使う

task :foo => 'foo:aaa'

2. invoke を使う

task :foo do
  invoke 'foo:aaa'
end

task :foo の中で複数の task を実行したいような場合は、この書き方になるだろう。

capistrano の lib/capistrano/tasks/framework.rake を覗いてみたところ、task :deploy はそのような書き方になっていた。

参考

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0