Sha256: d1fb705f80f967e6b5ef7c7f53a3f50d0e1cc323445485221e01e24b7f7c7c1a

Contents?: true

Size: 571 Bytes

Versions: 4

Compression:

Stored size: 571 Bytes

Contents

# frozen_string_literal: true

module Meroku
  # Mix in to objects that can be sshed in to
  module Sshable
    attr_reader :connection

    def execute(command)
      @connection.exec(command) { |_ch, _stream, data| puts data }
      @connection.loop
    end

    def sshopts
      { verify_host_key: false, key_data: Meroku::Shared.secrets.private_key, \
        timeout: 60 }
    end

    def close_ssh
      @connection.close
    end

    def execute_script(script)
      script.each_line do |line|
        puts line
        execute(line)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
meroku-2.0.31 lib/meroku/sshable.rb
meroku-2.0.30 lib/meroku/sshable.rb
meroku-2.0.29 lib/meroku/sshable.rb
meroku-2.0.28 lib/meroku/sshable.rb