Skip to content

Instantly share code, notes, and snippets.

@bradleyd
Created July 3, 2017 01:56
Show Gist options
  • Save bradleyd/9a300b38fdecc123680eac524a60c545 to your computer and use it in GitHub Desktop.
Save bradleyd/9a300b38fdecc123680eac524a60c545 to your computer and use it in GitHub Desktop.
software up to date
PATH
remote: .
specs:
et (1.1.0)
rest-client (~> 1.7)
sinatra (~> 1.4)
sinatra-contrib (~> 1.4)
GEM
remote: https://rubygems.org/
specs:
backports (3.6.4)
docile (1.1.5)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
et-plugin (0.2.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
metaclass (0.0.4)
mime-types (2.5)
minitest (5.4.2)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
netrc (0.10.3)
rack (1.5.2)
rack-protection (1.5.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rake (10.3.2)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
simplecov (0.9.1)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sinatra-contrib (1.4.2)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (~> 1.3)
tilt (1.4.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.5)
et!
et-plugin (~> 0.2)
minitest
mocha
rack (~> 1.5)
rack-test (~> 0.6)
rake
simplecov
require 'bundler'
require 'net/http'
require 'json'
require 'uri'
# read Gemfile.lock
gemfile = File.read("./Gemfile.lock")
specs = Bundler::LockfileParser.new(gemfile).specs
data = specs.map.each do |spec|
base = "https://rubygems.org/api/v1/gems/" #backports.json
gem = "#{spec.name}.json"
uri = URI(base + gem)
response = Net::HTTP.get(uri)
begin
current_gem = JSON.parse(response)
rescue => e
next
end
latest_version = current_gem["version"]
lock_version = spec.version.to_s
# compare versions
upgrade_available = Gem::Version.new(lock_version) < Gem::Version.new(latest_version)
{spec.name => {lock_version: lock_version, latest_version: latest_version, upgrade_available: upgrade_available}}
end
p data
[{"backports"=>{:lock_version=>"3.6.4", :latest_version=>"3.8.0", :upgrade_available=>true}}, {"docile"=>{:lock_version=>"1.1.5", :latest_version=>"1.1.5", :upgrade_available=>false}}, {"domain_name"=>{:lock_version=>"0.5.24", :latest_version=>"0.5.20170404", :upgrade_available=>true}}, {"et"=>{:lock_version=>"1.1.0", :latest_version=>"0.6.2", :upgrade_available=>false}}, nil, {"http-cookie"=>{:lock_version=>"1.0.2", :latest_version=>"1.0.3", :upgrade_available=>true}}, {"metaclass"=>{:lock_version=>"0.0.4", :latest_version=>"0.0.4", :upgrade_available=>false}}, {"mime-types"=>{:lock_version=>"2.5", :latest_version=>"3.1", :upgrade_available=>true}}, {"minitest"=>{:lock_version=>"5.4.2", :latest_version=>"5.10.2", :upgrade_available=>true}}, {"mocha"=>{:lock_version=>"1.1.0", :latest_version=>"1.2.1", :upgrade_available=>true}}, {"multi_json"=>{:lock_version=>"1.10.1", :latest_version=>"1.12.1", :upgrade_available=>true}}, {"netrc"=>{:lock_version=>"0.10.3", :latest_version=>"0.11.0", :upgrade_available=>true}}, {"rack"=>{:lock_version=>"1.5.2", :latest_version=>"2.0.3", :upgrade_available=>true}}, {"rack-protection"=>{:lock_version=>"1.5.3", :latest_version=>"2.0.0", :upgrade_available=>true}}, {"rack-test"=>{:lock_version=>"0.6.2", :latest_version=>"0.6.3", :upgrade_available=>true}}, {"rake"=>{:lock_version=>"10.3.2", :latest_version=>"12.0.0", :upgrade_available=>true}}, {"rest-client"=>{:lock_version=>"1.8.0", :latest_version=>"2.0.2", :upgrade_available=>true}}, {"simplecov"=>{:lock_version=>"0.9.1", :latest_version=>"0.14.1", :upgrade_available=>true}}, {"simplecov-html"=>{:lock_version=>"0.8.0", :latest_version=>"0.10.1", :upgrade_available=>true}}, {"sinatra"=>{:lock_version=>"1.4.6", :latest_version=>"2.0.0", :upgrade_available=>true}}, {"sinatra-contrib"=>{:lock_version=>"1.4.2", :latest_version=>"2.0.0", :upgrade_available=>true}}, {"tilt"=>{:lock_version=>"1.4.1", :latest_version=>"2.0.7", :upgrade_available=>true}}, {"unf"=>{:lock_version=>"0.1.4", :latest_version=>"0.1.4", :upgrade_available=>false}}, {"unf_ext"=>{:lock_version=>"0.0.7.1", :latest_version=>"0.0.7.4", :upgrade_available=>true}}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment