forked from stripe/stripe-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
37 lines (29 loc) · 768 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
require "rake/testtask"
require "rubocop/rake_task"
task default: %i[test rubocop]
Rake::TestTask.new do |t|
t.pattern = "./test/**/*_test.rb"
end
RuboCop::RakeTask.new
desc "Update bundled certs"
task :update_certs do
require "net/http"
require "uri"
fetch_file "https://curl.haxx.se/ca/cacert.pem",
::File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
end
#
# helpers
#
def fetch_file(uri, dest)
::File.open(dest, "w") do |file|
resp = Net::HTTP.get_response(URI.parse(uri))
unless resp.code.to_i == 200
abort("bad response when fetching: #{uri}\n" \
"Status #{resp.code}: #{resp.body}")
end
file.write(resp.body)
puts "Successfully fetched: #{uri}"
end
end