Sha256: 0bbd86fb36907e60d318bc7e4b58bb528dd6c15e0f81c3db7e564f39c183cb0a

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

# This is required on Windows to get around an issue where SSL certificates
# are not loaded properly on default
#
# originally from https://raw.github.com/gist/867550/win_fetch_cacerts.rb, from
# https://gist.github.com/867550

require 'net/http'

module Railsthemes
  class WinCacerts
    def self.fetch
      # create a path to the file "C:\RailsInstaller\cacert.pem"
      cacert_file = File.join(%w{c: RailsInstaller cacert.pem})

      Net::HTTP.start("curl.haxx.se") do |http|
        resp = http.get("/ca/cacert.pem")
        if resp.code == "200"
          open(cacert_file, "wb") { |file| file.write(resp.body) }
          ENV['SSL_CERT_FILE']  = 'C:\RailsInstaller\cacert.pem'
        else
          Railsthemes::Safe.log_and_abort "A cacert.pem bundle could not be downloaded."
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
railsthemes-1.1.pre lib/railsthemes/win_cacerts.rb