class Ra10ke::Deprecation::Validation
Attributes
puppetfile[R]
Public Class Methods
new(file)
click to toggle 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
bad_mods?()
click to toggle source
@return [Boolean] - true if there are any bad mods
# File lib/ra10ke/deprecation.rb, line 63 def bad_mods? deprecated_modules.any? end
deprecated_modules()
click to toggle source
@return [Array] array of module information and git status
# 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
sorted_mods()
click to toggle source
@return [Hash] - sorts the mods based on good/bad
# File lib/ra10ke/deprecation.rb, line 68 def sorted_mods deprecated_modules.sort_by { |a| a[:name] } end