Class: BleedingEdge
- Inherits:
-
Object
- Object
- BleedingEdge
- Defined in:
- lib/bleeding_edge.rb
Instance Method Summary collapse
- #find_future_versions_for(gem) ⇒ Object
- #find_futures_for_gems ⇒ Object
- #find_installed_gems ⇒ Object
-
#initialize ⇒ BleedingEdge
constructor
A new instance of BleedingEdge.
- #output_as_html ⇒ Object
Constructor Details
#initialize ⇒ BleedingEdge
Returns a new instance of BleedingEdge.
7 8 9 10 |
# File 'lib/bleeding_edge.rb', line 7 def initialize @installed_gems = Array.new @fetcher = Gem::SpecFetcher.new end |
Instance Method Details
#find_future_versions_for(gem) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/bleeding_edge.rb', line 19 def find_future_versions_for(gem) version_filter = Gem::Requirement.create("> " + gem.installed_version) dep = Gem::Dependency.new gem.name, version_filter matching_specs = @fetcher.find_matching dep, true, true, false matching_specs.each do |spec| gem.add_future_version spec[0][1].version end puts "Found #{gem.count} versions for #{dep}" end |
#find_futures_for_gems ⇒ Object
12 13 14 15 16 17 |
# File 'lib/bleeding_edge.rb', line 12 def find_futures_for_gems puts "Looking for most recent versions of installed gems for platform #{Gem.platforms.to_a}..." @installed_gems.each do |gem| find_future_versions_for(gem) end end |
#find_installed_gems ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/bleeding_edge.rb', line 29 def find_installed_gems Gem.searcher.find_all("*").each do |gem| @installed_gems << InstalledGemFuture.new(gem) end puts "Found #{@installed_gems.size.to_s} installed gems in scope" end |
#output_as_html ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/bleeding_edge.rb', line 37 def output_as_html File.open("bleeding-edge-report.html", "w") do |f| @installed_gems.sort! { |a,b| b.count <=> a.count} f.write File.open("report-header.html", "r").readlines @installed_gems.each do |future| f.write future.to_html end f.write File.open("report-footer.html", "r").readlines end end |