bundled cacert.pem with --ssl-ca-file PATH option (#480)

* Add a bundled cacert.pem from curl's website
* Using the --ssl-ca-file PATH option overrides ENV var SSL_CA_PATH
* Having none of those allow you to use the default, the bundled cacert.pem
* Octokit's SSL config uses this new setting
* Rake task to update_ssl_ca_file
* Rubocop target 2.2
This commit is contained in:
Olle Jonsson
2017-05-24 23:43:31 +02:00
committed by GitHub
parent 4798a8a3d8
commit 26b124a67c
7 changed files with 4071 additions and 29 deletions
+6 -26
View File
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require "bundler"
require "bundler/gem_tasks"
require "rubocop/rake_task"
@@ -10,31 +11,10 @@ require "overcommit"
RuboCop::RakeTask.new
RSpec::Core::RakeTask.new(:rspec)
task :copy_man_page_to_manpath do |_t|
known_manpath_paths = %w(/etc/manpath.config /etc/manpaths)
manpath = known_manpath_paths.find do |f|
path = Pathname(f)
path.file? && path.readable?
end
next unless manpath
writable_man_path = Pathname(manpath).each_line.find do |line|
path = Pathname(line.chomp)
path.directory? && path.writable?
end
next unless writable_man_path
man_prefix = Pathname("#{writable_man_path.chomp}/man1")
man_pages = "man/git-*.1"
Pathname.glob(man_pages) do |path|
if path.exist? && man_prefix.exist? && man_prefix.writable?
FileUtils.cp(path, man_prefix + path.basename)
end
end
desc "When releasing the gem, re-fetch latest cacert.pem from curl.haxx.se. Developer task."
task :update_ssl_ca_file do
`pushd lib/github_changelog_generator/ssl_certs && curl --remote-name --time-cond cacert.pem https://curl.haxx.se/ca/cacert.pem && popd`
end
task checks: [:rubocop, :rspec]
task default: [:rubocop, :rspec]
task checks: %i[rubocop rspec]
task default: %i[rubocop rspec]