Sha256: 653983451d48dc0fc46227d16b9e1c92581cbce1d850940cbeec23214b6a6c41

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

require 'specinfra'
 
# TODO: move to specinfra
 
module Itamae
  def self.backend=(backend)
    @backend = backend
  end

  def self.backend
    @backend
  end

  def self.create_local_backend
    create_backend(:exec)
  end

  def self.create_ssh_backend(options)
    Specinfra.configuration.request_pty = true

    Specinfra.configuration.host = options.delete(:host)
    Specinfra.configuration.ssh_options = options
    create_backend(:ssh)
  end

  private
  def self.create_backend(type)
    Specinfra.configuration.backend = type
    Itamae.backend = Specinfra::Runner
  end

  module SpecinfraHelpers
    module RunCommand
      def backend
        Itamae.backend
      end

      def run_command(cmd)
        backend.run_command(cmd)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itamae-1.0.0.beta3 lib/itamae/specinfra.rb
itamae-1.0.0.beta2 lib/itamae/specinfra.rb