Permalink
Browse files

Fix the CA certs to actually work with standalone

  • Loading branch information...
1 parent 56e9749 commit 170c4249d0beed73e825b92eaa9f704288058388 @indirect indirect committed Apr 28, 2011
Showing with 22 additions and 12 deletions.
  1. +11 −6 gist
  2. +11 −6 lib/gist.rb
View
@@ -288,16 +288,21 @@ private
end
def ca_cert
- cert_file = File.join(File.dirname(__FILE__), "cacert.pem")
- if File.exist?(cert_file)
+ cert_file = [
+ File.expand_path("../gist/cacert.pem", __FILE__),
+ "/tmp/gist_cacert.pem"
+ ].find{|l| File.exist?(l) }
+
+ if cert_file
cert_file
else
- require 'tempfile'
- t = Tempfile.new("ca_cert")
- t << DATA.read.split("__CACERT__").last
- t.path
+ File.open("/tmp/gist_cacert.pem", "w") do |f|
+ f.write(DATA.read.split("__CACERT__").last)
+ end
+ "/tmp/gist_cacert.pem"
end
end
+
end
Gist.execute(*ARGV)
__END__
View
@@ -248,14 +248,19 @@ def str_to_bool(str)
end
def ca_cert
- cert_file = File.join(File.dirname(__FILE__), "cacert.pem")
- if File.exist?(cert_file)
+ cert_file = [
+ File.expand_path("../gist/cacert.pem", __FILE__),
+ "/tmp/gist_cacert.pem"
+ ].find{|l| File.exist?(l) }
+
+ if cert_file
cert_file
else
- require 'tempfile'
- t = Tempfile.new("ca_cert")
- t << DATA.read.split("__CACERT__").last
- t.path
+ File.open("/tmp/gist_cacert.pem", "w") do |f|
+ f.write(DATA.read.split("__CACERT__").last)
+ end
+ "/tmp/gist_cacert.pem"
end
end
+
end

0 comments on commit 170c424

Please sign in to comment.