Issue: SSHKit::Backend::Netssh binding change in run method breaks lookup in 'normal' block scope
まだ誰も着手していません。
評価
調査の方向性
SSHKit::Backend::Netssh#run から始め、instance_exec がブロックの binding をどのように変更するかを調査します。Nginx#upload_files と tmp_config_file を使って cap-task の例を再現し、そのうえで期待される scope の動作を判断し、サービスオブジェクトのメソッド検索に対するカバレッジを追加します。カプセル化されたアクションで tmp_config_file を解決でき、既存のブロックの動作が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi,
in SSHKit::Backend::Netssh#run instance_exec is used to change the binding of the given block. With this binding change it is difficult to encapsulate an action in a service object for instance you have a cap-task:
desc 'Setup nginx configuration'
task :setup do
Nginx.new(self).setup
end
class Nginx < SimpleDelegator
...
def upload_files
on roles nginx_roles do |host|
set :host_server_name, host.properties.fetch(:host_server_name)
template 'assets.host.site', tmp_config_file
end
end
def tmp_config_file
'remote_file_name'
end
...
end
This does not work because the block is executed in the context of the SSHKit::Backend::Netssh object context and does not know the method tmp_config_file.
Why do I want to do such things? Testing! Rake and Cap tasks are difficult to test.
When I encapsulate the actions I can test the a little.
regards
dieter
- 主要言語
- Ruby
- スター
- 1.2k
- フォーク
- 257
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
capistrano/sshkit のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
capistrano/sshkit#563 · リアクション 6 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
capistrano/sshkit#562 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
capistrano/sshkit#554 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
capistrano/sshkit#543 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
capistrano/sshkit#518 · コメント 1 件 ·
capistrano/sshkit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
TheOdinProject/curriculum#31417 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
glossarist/glossarist-ruby#238 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
palladius/rails8-app-on-gcp#145 ·