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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/bundle_lock/searcher.rb', line 5
def search!(version='all',type='all')
puts "Finding current and outdated gems.."
unless version == 'new'
puts "#"*80
puts "# To Lock Current gem versions in Gemfile: "
puts "#"*80
current_gems.each do |gem|
puts " gem '#{gem.name}', '#{gem.version}'"
end
puts "#"*80
puts
unless type == 'gemfile'
puts "#"*80
puts "# To Lock Current gem versions for Maven by putting the following in your pom.xml: "
puts "#"*80
puts "The following assumes you already use Maven for Gem Dependencies *"
puts
xml = Builder::XmlMarkup.new(:target => $stdout, :indent => 2)
current_gems.each do |gem|
xml.dependency {
xml.groupId "rubygems"
xml.artifactId "#{gem.name}"
xml.version "#{gem.version}"
xml.type "gem"
}
end
puts
puts "*: JRuby Maven Info: https://github.com/mkristian/jruby-maven-plugins/"
puts "#"*80
end
puts
end
unless outdated_gems.empty? or version == 'current'
puts "#"*80
puts "# To Update and Lock New Gems: "
puts "#"*80
puts "\nNewer versions found for:"
outdated_gems.each do |gem|
puts " #{gem.name} (#{gem.latest_version} > #{gem.version})"
end
puts "\nLock bundle to NEW gem versions by putting the following in your Gemfile:"
outdated_gems.each do |gem|
puts " gem '#{gem.name}', '#{gem.latest_version}'"
end
puts "#"*80
unless type == 'gemfile'
puts "#"*80
puts "# To Lock NEW gems versions for Maven by putting the following in your pom.xml: "
puts "#"*80
puts "The following assumes you already use Maven for Gem Dependencies *"
puts
xml = Builder::XmlMarkup.new(:target => $stdout, :indent => 2)
outdated_gems.each do |gem|
xml.dependency {
xml.groupId "rubygems"
xml.artifactId "#{gem.name}"
xml.version "#{gem.version}"
xml.type "gem"
}
end
puts
puts "*: JRuby Maven Info: https://github.com/mkristian/jruby-maven-plugins/"
puts "#"*80
end
end
unless handwaving_gems.empty?
puts "\nYou may try to update non-specific dependencies via:"
puts " $ bundle update #{handwaving_gems.collect(&:name).join(' ')}"
puts "\nHandwaving specifications:"
handwaving_gems.collect do |g|
puts " #{g.name}: #{ [ g.handwaving, g.version ].join(' ') }"
end
end
end
|