Skip to content

Instantly share code, notes, and snippets.

@haarts
Created June 14, 2019 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haarts/eda0f749c813ba6b78502d3ce10fd74a to your computer and use it in GitHub Desktop.
Save haarts/eda0f749c813ba6b78502d3ce10fd74a to your computer and use it in GitHub Desktop.
Check if the versions defined in a Dart pubspec file are still up to date
require 'yaml'
require 'net/http'
require 'json'
url = 'https://pub.dev/api/packages/'
local_spec = YAML.load_file('pubspec.yaml')
local_spec["dependencies"].each do |lib, version|
if !version.is_a? String
next
end
response = Net::HTTP.get(URI(url+lib))
puts([lib, version, "->", JSON.parse(response)["latest"]["version"]].join(" "))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment