Sha256: cc9827f40e3c7dcfa2947debaccb46c775d1e0c54af5f8376267da3c88eb5097

Contents?: true

Size: 1.24 KB

Versions: 34

Compression:

Stored size: 1.24 KB

Contents

module Specinfra
  module Configuration
    class << self
      VALID_OPTIONS_KEYS = [
        :backend,
        :env,
        :path,
        :shell,
        :pre_command,
        :stdout,
        :stderr,
        :sudo_path,
        :disable_sudo,
        :sudo_options,
        :docker_image,
        :docker_url,
        :lxc,
        :request_pty,
        :ssh_options,
      ].freeze

      def defaults
        VALID_OPTIONS_KEYS.inject({}) { |o, k| o.merge!(k => send(k)) }
      end

      # Define os method explicitly to avoid stack level
      # too deep caused by Helpet::DetectOS#os
      def os(value=nil)
        @os = value if value
        if @os.nil? && defined?(RSpec) && RSpec.configuration.respond_to?(:os)
          @os = RSpec.configuration.os
        end
        @os
      end

      def method_missing(meth, val=nil)
        key = meth.to_s
        key.gsub!(/=$/, '')
        if ! val.nil?
          instance_variable_set("@#{key}", val)
          RSpec.configuration.send(:"#{key}=", val) if defined?(RSpec)
        end

        ret = instance_variable_get("@#{key}")
        if ret.nil? && defined?(RSpec) && RSpec.configuration.respond_to?(key)
          ret = RSpec.configuration.send(key)
        end
        ret
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
specinfra-2.5.0 lib/specinfra/configuration.rb
specinfra-2.4.5 lib/specinfra/configuration.rb
specinfra-2.4.4 lib/specinfra/configuration.rb
specinfra-2.4.3 lib/specinfra/configuration.rb
specinfra-2.4.2 lib/specinfra/configuration.rb
specinfra-2.4.1 lib/specinfra/configuration.rb
specinfra-2.4.0 lib/specinfra/configuration.rb
specinfra-2.3.2 lib/specinfra/configuration.rb
specinfra-2.3.1 lib/specinfra/configuration.rb
specinfra-2.3.0 lib/specinfra/configuration.rb
specinfra-2.2.4 lib/specinfra/configuration.rb
specinfra-2.2.3 lib/specinfra/configuration.rb
specinfra-2.2.2 lib/specinfra/configuration.rb
specinfra-2.2.1 lib/specinfra/configuration.rb
specinfra-2.2.0 lib/specinfra/configuration.rb
specinfra-2.1.1 lib/specinfra/configuration.rb
specinfra-2.1.0 lib/specinfra/configuration.rb
specinfra-2.0.4 lib/specinfra/configuration.rb
specinfra-2.0.3 lib/specinfra/configuration.rb
specinfra-2.0.2 lib/specinfra/configuration.rb