class Ra10ke::Deprecation::Validation
Attributes
Public Class Methods
Source
# File lib/ra10ke/deprecation.rb, line 34 def initialize(file) file ||= './Puppetfile' @puppetfile = File.expand_path(file) abort("Puppetfile does not exist at #{puppetfile}") unless File.readable?(puppetfile) end
Public Instance Methods
Source
# File lib/ra10ke/deprecation.rb, line 63 def bad_mods? deprecated_modules.any? end
@return [Boolean] - true if there are any bad mods
Source
# File lib/ra10ke/deprecation.rb, line 41 def deprecated_modules @deprecated_modules ||= begin deprecated = forge_modules(puppetfile).map do |mod| # For Ruby 2.4 support begin # rubocop:disable Style/RedundantBegin module_name = "#{mod[:namespace] || mod[:name]}-#{mod[:name]}" forge_data = PuppetForge::Module.find(module_name) next forge_data if forge_data.deprecated_at nil rescue Faraday::ResourceNotFound nil end end deprecated.compact.map do |mod| { name: mod.slug, deprecated_at: Time.parse(mod.deprecated_at) } end end end
@return [Array] array of module information and git status
Source
# File lib/ra10ke/deprecation.rb, line 68 def sorted_mods deprecated_modules.sort_by { |a| a[:name] } end
@return [Hash] - sorts the mods based on good/bad