Sha256: af9d053e1c1cfa57649f869076a8b5f21d95a704d80e1f08271be2c39173d9ee

Contents?: true

Size: 1.13 KB

Versions: 37

Compression:

Stored size: 1.13 KB

Contents

module SpecInfra
  module Configuration
    class << self
      VALID_OPTIONS_KEYS = [
        :path,
        :pre_command,
        :stdout,
        :stderr,
        :sudo_path,
        :disable_sudo,
        :pass_prompt,
        :sudo_options,
        :docker_image,
        :lxc,
        :request_pty,
      ].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
        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
          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

37 entries across 37 versions & 1 rubygems

Version Path
specinfra-1.27.5 lib/specinfra/configuration.rb
specinfra-1.27.4 lib/specinfra/configuration.rb
specinfra-1.27.3 lib/specinfra/configuration.rb
specinfra-1.27.2 lib/specinfra/configuration.rb
specinfra-1.27.1 lib/specinfra/configuration.rb
specinfra-1.27.0 lib/specinfra/configuration.rb
specinfra-1.26.0 lib/specinfra/configuration.rb
specinfra-1.25.8 lib/specinfra/configuration.rb
specinfra-1.25.7 lib/specinfra/configuration.rb
specinfra-1.25.6 lib/specinfra/configuration.rb
specinfra-1.25.5 lib/specinfra/configuration.rb
specinfra-1.25.4 lib/specinfra/configuration.rb
specinfra-1.25.3 lib/specinfra/configuration.rb
specinfra-1.25.2 lib/specinfra/configuration.rb
specinfra-1.25.1 lib/specinfra/configuration.rb
specinfra-1.25.0 lib/specinfra/configuration.rb
specinfra-1.24.0 lib/specinfra/configuration.rb
specinfra-1.23.1 lib/specinfra/configuration.rb
specinfra-1.23.0 lib/specinfra/configuration.rb
specinfra-1.22.1 lib/specinfra/configuration.rb