Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Issue: SSHKit::Backend::Netssh binding change in run method breaks lookup in 'normal' block scope

オープン
#149 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
devops

調査の方向性

SSHKit::Backend::Netssh#run から始め、instance_exec がブロックの binding をどのように変更するかを調査します。Nginx#upload_files と tmp_config_file を使って cap-task の例を再現し、そのうえで期待される scope の動作を判断し、サービスオブジェクトのメソッド検索に対するカバレッジを追加します。カプセル化されたアクションで tmp_config_file を解決でき、既存のブロックの動作が維持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

discuss!

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 はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

capistrano/sshkit のほかの issue

capistrano/sshkit の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。