Sha256: 3d9a242aa50436047eb5868b3eae36438c741121c23ea81e1b6f87d2f40250c1

Contents?: true

Size: 984 Bytes

Versions: 3

Compression:

Stored size: 984 Bytes

Contents

require 'rake/testtask'

task :default => [:test]

Rake::TestTask.new do |t|
  t.pattern = './test/**/*_test.rb'
end

desc "Update bundled certs"
task :update_certs do
  require "faraday"

  fetch_file "https://curl.haxx.se/ca/cacert.pem",
    File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
end

desc "Update OpenAPI specification"
task :update_openapi do
  require "faraday"

  ["fixtures.json", "fixtures.yaml", "spec.json", "spec.yaml"].map { |file|
    Thread.new do
      fetch_file "https://raw.githubusercontent.com/stripe/openapi/master/spec/#{file}",
        File.expand_path("../openapi/#{file}", __FILE__)
    end
  }.map { |t| t.join }
end

#
# helpers
#

def fetch_file(url, dest)
  File.open(dest, 'w') do |file|
    resp = Faraday.get(url)
    unless resp.status == 200
      abort("bad response when fetching: #{url}\n" \
        "Status #{resp.status}: #{resp.body}")
    end
    file.write(resp.body)
    puts "Successfully fetched: #{url}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stripe-2.1.0 Rakefile
stripe-2.0.3 Rakefile
stripe-2.0.2 Rakefile