博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
capistrano 的几个参数( logger, set-before)
阅读量:4045 次
发布时间:2019-05-25

本文共 791 字,大约阅读时间需要 2 分钟。

Capistrano 灰常好用。 不过有几个常用的用法还是要留意一下:
1. 总览:
$ cap --help
2. 使用logger,特别是在其他语言调用CAP时,非常有用(例如被fabric 调用):
$ cap setup --logger STDOUT
3. 使用变量, 要记得: 使用@. . 例如,我们要设置 "deploy_type" 这个变量:
$ cap say_hi --set-before deploy_type=staging
然后在 config/deploy.rb 中这样使用:
DEFAULT_TYPE = "stable" # deploy_type 仅仅在 begin 这个区域中生效, 在rescue, ensure中都不行。 begin   deploy_type   puts "deploy_type was set successfully"   @deploy_type = deploy_type rescue Exception => e   puts "deploy_type not set, use default: #{DEFAULT_TYPE}"   deploy_type = DEFAULT_TYPE   @deploy_type = deploy_type end task :say_hi do   puts "hihihi, var_deploy_type: #{@deploy_type}" end
输出:
deploy_type was set successfully ============= DEPLOY_PATH: /rails_apps/babble_portal/cutting_edge   * executing `say_hi' hihihi, var_deploy_type: 444

转载地址:http://twuci.baihongyu.com/

你可能感兴趣的文章
CCF 分蛋糕
查看>>
解决python2.7中UnicodeEncodeError
查看>>
小谈python 输出
查看>>
Django objects.all()、objects.get()与objects.filter()之间的区别介绍
查看>>
python:如何将excel文件转化成CSV格式
查看>>
机器学习实战之决策树(一)
查看>>
机器学习实战之决策树二
查看>>
[LeetCode By Python]7 Reverse Integer
查看>>
[leetCode By Python] 14. Longest Common Prefix
查看>>
[LeetCode By Python]121. Best Time to Buy and Sell Stock
查看>>
[LeetCode By Python]122. Best Time to Buy and Sell Stock II
查看>>
[LeetCode By Python]125. Valid Palindrome
查看>>
[LeetCode By Python]136. Single Number
查看>>
Android/Linux 内存监视
查看>>
Android2.1消息应用(Messaging)源码学习笔记
查看>>
android raw读取超过1M文件的方法
查看>>
MPMoviePlayerViewController和MPMoviePlayerController的使用
查看>>
CocoaPods实践之制作篇
查看>>
[Mac]Mac 操作系统 常见技巧
查看>>
苹果Swift编程语言入门教程【中文版】
查看>>