3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Capistrano でタスクを超えて変数を保持する方法

Last updated at Posted at 2012-02-27
deploy.rb
self[:variable:] = variable

カピストラノさん難しいよカピストラノさん

ちなみに
current_path shared_path release_path deploy_to を遅延評価しパスを作成しているので

deploy.rb
self[:is_development] = false

set user, "eccyan"
set application, "ikemen"

set deploy_to, do
  if self[:is_development]
    "/var/www/http/#{user}/#{application}"
  else
    "/var/www/http/#{application}"
  end
end

task :development do
  self[:is_development] = true
  puts current_path #=> "/var/www/http/eccyan/ikemen"
end

task :production do
  self[:is_development] = false
  puts current_path #=> "/var/www/http/ikemen"
end

みたいな事が出来る。

3
3
0

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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?