有沒有人知道所有內置的Capistrano變量的列表,如current_path等?建在capistrano變量
16
A
回答
23
您可以找到所有的人:
https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/recipes/deploy.rb
更新:v3可不再具有相同的配置選項爲V2。我掛了v2的配置選項以上,但V3有以下幾點:
這裏有傳統的,保存在這個帖子:
# =========================================================================
# These variables MUST be set in the client capfiles. If they are not set,
# the deploy will fail with an error.
# =========================================================================
_cset(:application) { abort "Please specify the name of your application, set :application, 'foo'" }
_cset(:repository) { abort "Please specify the repository that houses your application's code, set :repository, 'foo'" }
# =========================================================================
# These variables may be set in the client capfile if their default values
# are not sufficient.
# =========================================================================
_cset(:scm) { scm_default }
_cset :deploy_via, :checkout
_cset(:deploy_to) { "/u/apps/#{application}" }
_cset(:revision) { source.head }
_cset :rails_env, "production"
_cset :rake, "rake"
# =========================================================================
# These variables should NOT be changed unless you are very confident in
# what you are doing. Make sure you understand all the implications of your
# changes if you do decide to muck with these!
# =========================================================================
_cset(:source) { Capistrano::Deploy::SCM.new(scm, self) }
_cset(:real_revision) { source.local.query_revision(revision) { |cmd| with_env("LC_ALL", "C") { run_locally(cmd) } } }
_cset(:strategy) { Capistrano::Deploy::Strategy.new(deploy_via, self) }
# If overriding release name, please also select an appropriate setting for :releases below.
_cset(:release_name) { set :deploy_timestamped, true; Time.now.utc.strftime("%Y%m%d%H%M%S") }
_cset :version_dir, "releases"
_cset :shared_dir, "shared"
_cset :shared_children, %w(public/system log tmp/pids)
_cset :current_dir, "current"
_cset(:releases_path) { File.join(deploy_to, version_dir) }
_cset(:shared_path) { File.join(deploy_to, shared_dir) }
_cset(:current_path) { File.join(deploy_to, current_dir) }
_cset(:release_path) { File.join(releases_path, release_name) }
_cset(:releases) { capture("#{try_sudo} ls -x #{releases_path}", :except => { :no_release => true }).split.sort }
_cset(:current_release) { releases.length > 0 ? File.join(releases_path, releases.last) : nil }
_cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
_cset(:current_revision) { capture("#{try_sudo} cat #{current_path}/REVISION", :except => { :no_release => true }).chomp }
_cset(:latest_revision) { capture("#{try_sudo} cat #{current_release}/REVISION", :except => { :no_release => true }).chomp }
_cset(:previous_revision) { capture("#{try_sudo} cat #{previous_release}/REVISION", :except => { :no_release => true }).chomp if previous_release }
_cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run }
# some tasks, like symlink, need to always point at the latest release, but
# they can also (occassionally) be called standalone. In the standalone case,
# the timestamped release_path will be inaccurate, since the directory won't
# actually exist. This variable lets tasks like symlink work either in the
# standalone case, or during deployment.
_cset(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_release }
_cset :maintenance_basename, "maintenance"
_cset(:maintenance_template_path) { File.join(File.dirname(__FILE__), "templates", "maintenance.rhtml") }
4
看來,第3章已蔓延默認出現在多個文件中。這是一個基於搜索的上限從張貼鏈接2個默認值在第3章主分支我重建:
- https://github.com/capistrano/capistrano/blob/ee96c2e77a57c8facf52854eb14d6b57b2b0e5e7/lib/capistrano/defaults.rb
- https://github.com/capistrano/capistrano/blob/aeab6b6a1e5c5e654f35321dcd7438a0659864d0/lib/capistrano/dsl/paths.rb
從第二個鏈接,你可以看到,一些變量V2現在轉換爲閱讀器方式(這意味着你不需要fetch
他們):
- deploy_to
- deploy_path
- 的current_path
- releases_path
- release_path
- stage_config_path
- deploy_config_path
- repo_url
- repo_path
- shared_path
- revision_log
- 現在
- asset_timestamp
相關問題
- 1. Capistrano多級變量
- 2. 環境變量與capistrano 3
- 3. Capistrano的環境變量
- 4. Capistrano的:覆蓋shared_dir變量
- 5. Capistrano的+ sidekiq /無法挑環境變量
- 6. My Capistrano未設置RAILS_ENV變量
- 7. Capistrano和每當階段變量
- 8. 如何從類訪問「全局」(常量?)capistrano變量? (紅寶石)
- 9. Capistrano在任務中檢查未定義的變量
- 10. Capistrano 3:在任務中使用服務器自定義變量
- 11. 如何在capistrano上部署環境變量?
- 12. capistrano環境變量沒有在rails代碼中使用
- 13. 如何在Capistrano和Rails之間發送變量?
- 14. Capistrano/Ruby執行在變量後添加分號
- 15. 使用Capistrano在羣集中設置環境變量
- 16. capistrano-git配置正在改變主機
- 17. 在Java中創建變量
- 18. 變量在創建後
- 19. 創建變量在python3
- 20. 在Oracle中創建變量
- 21. 建立在變量MSbuild
- 22. Capistrano不會創建版本
- 23. 建築及從Capistrano的
- 24. 在變量變化上創建通知
- 25. ruby變量bash shell命令輸出分配capistrano
- 26. 如何防止由Capistrano的sudo操作設置default_environment變量?
- 27. Capistrano錯誤deploy.rb:警告:未能設置環境變量
- 28. 瘦服務器不加載與Capistrano的環境變量
- 29. Capistrano:如何設置全局環境變量?
- 30. 使用dotenv Capistrano的3個自定義任務內變量
博肯鏈接 - 這就是爲什麼它是一個好主意,不只是拋出一個鏈接作爲回答 – fotanus 2013-10-24 20:17:38