Sha256: 34bd2f93320f14c9c950509cd60b993d94d402f064c331d6bca7993e1b3463ec

Contents?: true

Size: 866 Bytes

Versions: 14

Compression:

Stored size: 866 Bytes

Contents

module SpecInfra
  module Helper
    ['Exec', 'Ssh', 'Cmd', 'WinRM', 'ShellScript', 'Dockerfile'].each do |type|
      eval <<-EOF
        module #{type}
          def backend(commands_object=nil)
            if ! respond_to?(:commands)
              commands_object = SpecInfra::Command::Base.new
            end
            instance = SpecInfra::Backend::#{type}.instance
            instance.set_commands(commands_object || commands)
            instance
          end
        end
      EOF
    end

    module Backend
      def backend_for(type)
        instance = self.class.const_get('SpecInfra').const_get('Backend').const_get(type.to_s.capitalize).instance
        commands = self.class.const_get('SpecInfra').const_get('Command').const_get(instance.check_os[:family]).new
        instance.set_commands(commands)
        instance
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
specinfra-0.3.2 lib/specinfra/helper/backend.rb
specinfra-0.3.1 lib/specinfra/helper/backend.rb
specinfra-0.3.0 lib/specinfra/helper/backend.rb
specinfra-0.2.1 lib/specinfra/helper/backend.rb
specinfra-0.2.0 lib/specinfra/helper/backend.rb
specinfra-0.1.1 lib/specinfra/helper/backend.rb
specinfra-0.1.0 lib/specinfra/helper/backend.rb
specinfra-0.0.17 lib/specinfra/helper/backend.rb
specinfra-0.0.16 lib/specinfra/helper/backend.rb
specinfra-0.0.15 lib/specinfra/helper/backend.rb
specinfra-0.0.14 lib/specinfra/helper/backend.rb
specinfra-0.0.13 lib/specinfra/helper/backend.rb
specinfra-0.0.12 lib/specinfra/helper/backend.rb
specinfra-0.0.11 lib/specinfra/helper/backend.rb