class Danger::DangerLockDependencyVersions

Attributes

lock_list_file[RW]

Public Instance Methods

check(config = nil) click to toggle source
# File lib/lock_dependency_versions/plugin.rb, line 12
def check(config = nil)
  config = config.is_a?(Hash) ? config : { }
  warning_mode = config[:warning] || false
  files = git.modified_files
  lock_list.keys.each do |file|
    if files.include?(file) && !(files.include?(lock_list[file]))
      comment(warning_mode, file)
    end
  end
end

Private Instance Methods

comment(warning_mode, file) click to toggle source
# File lib/lock_dependency_versions/plugin.rb, line 25
def comment(warning_mode, file)
  if warning_mode
    warn(error_message(file))
  else
    fail(error_message(file))
  end
end
error_message(file) click to toggle source
# File lib/lock_dependency_versions/plugin.rb, line 33
def error_message(file)
  "`#{file}` has changed. `#{lock_list[file]}` should be committed."
end
lock_list() click to toggle source
# File lib/lock_dependency_versions/plugin.rb, line 37
def lock_list
  YAML.load_file(lock_list_file)
end