Sha256: 2654a2217b241d4ce25cbc429a6013d041651eebb442e7d3d949af4c1ad57f69

Contents?: true

Size: 552 Bytes

Versions: 4

Compression:

Stored size: 552 Bytes

Contents

#!/usr/bin/ruby

require "json"
require "net/http"
require "pp"

Net::HTTP.start("rubygems.org", use_ssl: true) do |client|
  case resp = client.get("/api/v1/versions/couchbase.json")
  when Net::HTTPSuccess
    versions = JSON.parse(resp.body)
    stats = Hash.new(0)
    versions.each { |version| stats[version["number"]] += version["downloads_count"] }
    puts JSON.pretty_generate(
      versions: stats,
      total: stats.values.sum,
      total_3: stats.filter_map { |version, downloads| downloads if version =~ /^3.0.0/ }.sum,
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
couchbase-3.0.0.alpha.5-x86_64-linux bin/fetch-stats
couchbase-3.0.0.alpha.5-universal-darwin-19 bin/fetch-stats
couchbase-3.0.0.alpha.5-x86_64-darwin-19 bin/fetch-stats
couchbase-3.0.0.alpha.5 bin/fetch-stats