Sha256: a560c8ab706ce2ecb40b1a769202e586187d07d3e46fcdc7975e8280c8ed823f
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module NeetoCompliance class GemsVerifierBase < Base def gems [] end def latest_versions @_latest_versions ||= _latest_versions end def _latest_versions JSON.parse(Net::HTTP.get_response(URI("https://neeto-library-stable-versions.herokuapp.com/versions")).body) end def valid? @failed_gems = [] load_current_versions gems.map do |gem| gv = GemVersionVerifier.new(@current_versions[gem[:name]], find_latest_version(gem[:name]), gem[:name]) unless gv.valid? @failed_gems << gem[:name] end end @failed_gems.empty? end def autofix_command "bundle update #{@failed_gems.join(' ')}" end def load_current_versions @current_versions = {} Bundler.load.specs.each { |gem| @current_versions[gem.name] = gem.version.to_s } end def find_latest_version(gem_name) gem = latest_versions.find { |gem| gem["name"] == gem_name } || {} gem["released_version"] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
neeto-compliance-1.0.58 | lib/neeto_compliance/verifiers/gems_verifier_base.rb |