Sha256: 2cccd77f81fa10a9c9a3453e90461f89020ef80d317fe98c38db5aee92fee3bc

Contents?: true

Size: 1.32 KB

Versions: 250

Compression:

Stored size: 1.32 KB

Contents

require 'specinfra/core'

include Specinfra
include Specinfra::Helper::Os
include Specinfra::Helper::Properties
include Specinfra::Helper::HostInventory

module Specinfra
  class << self
    def command
      Specinfra::CommandFactory.instance
    end

    def backend
      type = Specinfra.configuration.backend
      if type.nil?
        if Specinfra.configuration.error_on_missing_backend_type
          raise "No backend type is specified."
        end

        warn "No backend type is specified. Fall back to :exec type."
        type = :exec
      end
      eval "Specinfra::Backend::#{type.to_s.to_camel_case}.instance"
    end
  end
end

if defined?(RSpec)
  RSpec.configure do |c|
    c.include(Specinfra::Helper::Configuration)
    c.add_setting :os,            :default => nil
    c.add_setting :host,          :default => nil
    c.add_setting :ssh,           :default => nil
    c.add_setting :scp,           :default => nil
    c.add_setting :sudo_password, :default => nil
    c.add_setting :winrm,         :default => nil
    c.add_setting :architecture,  :default => :x86_64
    Specinfra.configuration.defaults.each { |k, v| c.add_setting k, :default => v }
    c.before :each do
      example = RSpec.respond_to?(:current_example) ? RSpec.current_example : self.example
      Specinfra.backend.set_example(example)
    end
  end
end

Version data entries

250 entries across 250 versions & 3 rubygems

Version Path
specinfra-2.88.2 lib/specinfra.rb
specinfra-2.88.1 lib/specinfra.rb
specinfra-2.88.0 lib/specinfra.rb
specinfra-2.87.2 lib/specinfra.rb
specinfra-2.87.1 lib/specinfra.rb
specinfra-2.87.0 lib/specinfra.rb
specinfra-2.86.0 lib/specinfra.rb
specinfra-2.85.1 lib/specinfra.rb
specinfra-2.85.0 lib/specinfra.rb
specinfra-2.84.1 lib/specinfra.rb
specinfra-2.84.0 lib/specinfra.rb
specinfra-2.83.4 lib/specinfra.rb
specinfra-2.83.3 lib/specinfra.rb
specinfra-2.83.2 lib/specinfra.rb
specinfra-2.83.1 lib/specinfra.rb
specinfra-2.83.0 lib/specinfra.rb
specinfra-2.82.25 lib/specinfra.rb
specinfra-2.82.24 lib/specinfra.rb
specinfra-2.82.23 lib/specinfra.rb
specinfra-2.82.22 lib/specinfra.rb