Sha256: 4c66a64591518420db8ee2534d0bb97e2b041b810fd3eb9c64638d850dbd2749

Contents?: true

Size: 618 Bytes

Versions: 20

Compression:

Stored size: 618 Bytes

Contents

Facter.add("staging_http_get") do
  setcode do

    fact = nil

    which = lambda do |cmd|
      result = nil
      exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
      ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
        exts.each do |ext|
          exe = File.join(path, "#{cmd}#{ext}")
          result = exe if File.executable? exe
          break if result
        end
        break if result
      end
      result
    end

    ['powershell', 'curl', 'wget'].each do |cmd|
      available = which.call(cmd)
      fact = available ? cmd : nil
      break if fact
    end

    fact

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-retrospec-1.8.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.7.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.6.1 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.6.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.5.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.4.1 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.4.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.3.2 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.3.1 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.3.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.2.1 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.2.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.1.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-1.0.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-0.12.1 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/staging/lib/facter/staging_http_get.rb