Sha256: 9f109e713e629df529ba91cd9feaccd4241946569af3e062116c0fed5606d7dc
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'specinfra/helper/detect_os' module Specinfra::Helper::Os def os property[:os_by_host] = {} if ! property[:os_by_host] host_port = current_host_and_port if property[:os_by_host][host_port] os_by_host = property[:os_by_host][host_port] else # Set command object explicitly to avoid `stack too deep` os_by_host = detect_os property[:os_by_host][host_port] = os_by_host end os_by_host end private # put this in a module for better reuse def current_host_and_port if Specinfra.configuration.ssh "#{Specinfra.configuration.ssh.host}:#{Specinfra.configuration.ssh.options[:port]}" elsif Specinfra.configuration.ssh_options "#{Specinfra.configuration.host}:#{Specinfra.configuration.ssh_options[:port]}" else "#{Specinfra.configuration.host}:0" end end def run_command(cmd) backend.run_command(cmd) end def detect_os return Specinfra.configuration.os if Specinfra.configuration.os Specinfra::Helper::DetectOs.subclasses.each do |c| res = c.detect if res res[:arch] ||= run_command('uname -m').stdout.strip return res end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
specinfra-2.0.0.beta14 | lib/specinfra/helper/os.rb |
specinfra-2.0.0.beta13 | lib/specinfra/helper/os.rb |