Capistrano 3 pulling command line arguments

前端 未结 3 1826
醉话见心
醉话见心 2020-12-24 08:29

I\'m in the process of upgrading from Capistrano 2 to Capistrano 3. In Cap 2 I was using the following to take a command line argument as the branch name (otherwise default

3条回答
  •  生来不讨喜
    2020-12-24 09:07

    Rake tasks (which cap is using) are supporting arguments.

    namespace :test do
      desc "Test task"
      task :test, :arg1 do |t, args|
        arg1 = args[:arg1]
        puts arg1
      end
    end
    

    cap -T outputs:

    cap yiic:test[arg1] # Test task

    Example of invocation:

    cap production yiic:test[test1]

    Also, here is a helpful post

    P.S.: you should use env vars for "global" settings. Like common values for multiple tasks.

提交回复
热议问题