kentaro/webistrano — pull request #8 by f-kubotar (2012-09-27 19:52:51+00:00)
Title: captureメソッドがバッティングしてしまう問題の対応

新規プロジェクトを作成してdeploy:cleanupを実行しようとすると以下のエラーにみまわれました。

```
* executing `deploy:cleanup'
*** (eval):1: syntax error, unexpected tREGEXP_BEG, expecting keyword_do or '{' or '('
*** $ls -xt /Users/usr0600211/tmp/test/rel...
*** ^
*** (eval):1: unknown regexp option - r
*** (eval):1: syntax error, unexpected tINTEGER, expecting $end
*** $ls -xt /Users/usr0600211/tmp/test/releases = LS -XT /...
*** ^
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/core_ext/kernel/reporting.rb:75:in `eval'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/core_ext/kernel/reporting.rb:75:in `ensure in capture'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/core_ext/kernel/reporting.rb:75:in `capture'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy.rb:425:in `block (2 levels) in load'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:45:in `each'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
*** /Users/usr0600211/dev/webistrano/lib/webistrano/deployer.rb:70:in `block in execute!'
*** /Users/usr0600211/dev/webistrano/lib/webistrano/deployer.rb:60:in `catch'
*** /Users/usr0600211/dev/webistrano/lib/webistrano/deployer.rb:60:in `execute!'
*** /Users/usr0600211/dev/webistrano/lib/webistrano/deployer.rb:44:in `invoke_task!'
*** (eval):1:in `'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/runner.rb:53:in `eval'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/runner.rb:53:in `'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:64:in `require'
*** /Users/usr0600211/dev/webistrano/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:64:in `'
*** script/rails:6:in `require'
*** script/rails:6:in `

'
```

Capistranoの、Capistrano::Configration::Namescapes::NamespaceにMixinされているcaptureメソッドよりも、ActiveSupportのcore_extで定義されているKernel#captureが優先されてしまっているために起こる問題のようでした。

1. Capistrano側の、この問題に対処するコードが新しくなっていたので、Gemfileを更新しました。
(参考：https://github.com/capistrano/capistrano/pull/242)
2. 'capistrano/configuration' を先にrequireするコードを追加しました。