5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/dependency_bumper/bundler/cli/outdated.rb', line 5
def run
check_for_deployment_mode!
Bundler.definition.validate_runtime!
current_specs = Bundler.ui.silence { Bundler.definition.resolve }
current_dependencies = Bundler.ui.silence do
Bundler.load.dependencies.map { |dep| [dep.name, dep] }.to_h
end
definition = gems.empty? && sources.empty? ? Bundler.definition(true) : Bunder.definition(gems: gems, sources: sources)
Bundler::CLI::Common.configure_gem_version_promoter(
Bundler.definition,
options
)
options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely!
gemfile_specs, dependency_specs = current_specs.partition do |spec|
current_dependencies.key? spec.name
end
specs = gemfile_specs + dependency_specs
specs.sort_by(&:name).each do |current_spec|
next unless gems.empty? || gems.include?(current_spec.name)
active_spec = retrieve_active_spec(definition, current_spec)
next unless active_spec
unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)
next
end
gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
unless gem_outdated || (current_spec.git_version != active_spec.git_version)
next
end
dependency = current_dependencies[current_spec.name]
outdated_gems_list << {
active_spec: active_spec,
current_spec: current_spec,
dependency: dependency
}
end
return [] if outdated_gems_list.empty?
print_gems(outdated_gems_list)
outdated_gems_list
end
|