Class: Kitchen::Binding::PryRemote

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/binding/pry_remote.rb

Overview

pry-remote binding

Author:

Instance Attribute Summary

Attributes inherited from Base

#instance, #state

Instance Method Summary collapse

Methods inherited from Base

#initialize, #name, #sudo, #test_connection

Constructor Details

This class inherits a constructor from Kitchen::Binding::Base

Instance Method Details

#connect_commandObject

Returns the command that will log into a remote interactive ruby shell.

Raises:

  • (ActionFailed)

    if the action could not be completed



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/kitchen/binding/pry_remote.rb', line 41

def connect_command
  info("Connecting to remote binding")
  require 'pry-remote'
  ::Pry.config.input = STDIN
  ::Pry.config.output = STDOUT

  argv = ['--server', hostname, '--port', port.to_s]

  client = ::PryRemote::CLI.new argv
  client.run
end

#install_commandString

Returns the command that will install the remote interactive ruby shell.

Returns:

  • (String)

    the command to install the remote ruby shell

Raises:

  • (ActionFailed)

    if the action could not be completed



29
30
31
32
33
34
35
36
37
38
# File 'lib/kitchen/binding/pry_remote.rb', line 29

def install_command
  "    if [[ $(/opt/chef/embedded/bin/gem list | grep -c pry-remote) -eq 0 ]]; then\n      echo \"-----> Installing Binding (pry-remote)\"\n      \#{sudo(install_string)}\n    else\n      echo \"-----> Binding (pry-remote) installation detected\"\n    fi\n  INSTALL\nend\n".gsub(/^ {10}/, "")