module Gem::Comparator::Utils

Constants

DEFAULT_INDENT
DEPENDENCY_PARAMS
FILTER_WHEN_BRIEF

Duplicates or obvious changes

GEMFILE_PARAMS
NOT_IN_MARSHAL

Not present in marshal file containing the specs

OPERATORS
SPACE
SPEC_FILES_PARAMS
SPEC_PARAMS
VERSION_REGEX

Private Instance Methods

error(msg) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 128
def error(msg)
  say Rainbow("ERROR: #{msg}").red
  exit 1
end
filter_for_brief_mode(params) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 97
def filter_for_brief_mode(params)
  params.delete_if{ |p| FILTER_WHEN_BRIEF.include?(p) }
end
filter_params(params, param, brief_mode = false) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 82
def filter_params(params, param, brief_mode = false)
  if param
    if params.include? param
      return [param]
    else
      return []
    end
  end
  if brief_mode
    filter_for_brief_mode(params)
  else
    params
  end
end
info(msg) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 120
def info(msg)
  say msg if Gem.configuration.really_verbose
end
param_available_in_marshal?(param) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 78
def param_available_in_marshal?(param)
  param_exists?(param) && !NOT_IN_MARSHAL.include?(param)
end
param_exists?(param) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 71
def param_exists?(param)
  (SPEC_PARAMS.include? param) ||
  (SPEC_FILES_PARAMS.include? param) ||
  (DEPENDENCY_PARAMS.include? param) ||
  (GEMFILE_PARAMS.include? param)
end
value_from_spec(param, spec) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 110
def value_from_spec(param, spec)
  if spec.respond_to? :"#{param}"
    spec.send(:"#{param}")
  else
    warn "#{spec.full_name} does not respond to " +
         "#{param}, skipping check"
    nil
  end
end
values_from_specs(param, specs) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 101
def values_from_specs(param, specs)
  values = []
  specs.each do |s|
   val = value_from_spec(param, s)
   values << val if val
  end
  values
end
warn(msg) click to toggle source
# File lib/rubygems/comparator/utils.rb, line 124
def warn(msg)
  say Rainbow("WARNING: #{msg}").red
end