Sha256: bc27c5a16efacb18c229962ea7ef0dfd3162c4c63252ac24109946d53d57ddb6

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 Bytes

Contents

require 'sshkit/backends/ssh_command'
require 'sshkit/runners/abstract'

#Patch to support backend option
# Sent PR https://github.com/capistrano/sshkit/pull/117, except constantinize
module SSHKit

  module Runner

    class Abstract

      attr_reader :hosts, :options, :block

      def initialize(hosts, options = nil, &block)
        @hosts   = Array(hosts)
        @options = options || {}
        @block   = block
      end

      private

      def backend(host, &block)
        backend_factory.new(host, &block)
      end

      def backend_factory
        case @options[:backend]
        when Symbol
          SSHKit::Backend.const_get(@options[:backend].to_s.split('_').collect(&:capitalize).join)
        when String
          Kernel.const_get(@options[:backend])
        when nil
          SSHKit.config.backend
        else
          @options[:backend]
        end

      end
    end

  end

end

load File.expand_path('../tasks/rails.rake', __FILE__)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
j-cap-recipes-0.0.15 lib/j-cap-recipes/rails.rb