stripe-ruby/Rakefile
David Brownman 08020d3207
add justfile (#1513)
* add justfile

* add just to ci and split out commands

* Fix justfile

* update readme and CI

* update justfile

* update CI

* update justfile import

* remove unused block
2025-01-16 14:54:59 -08:00

35 lines
713 B
Ruby

# frozen_string_literal: true
require "rake/testtask"
task default: %i[test rubocop]
Rake::TestTask.new do |t|
t.pattern = "./test/**/*_test.rb"
end
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", __dir__)
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