Class: Gemdiff::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/gemdiff/cli.rb

Instance Method Summary collapse

Instance Method Details

#compare(gem_name) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/gemdiff/cli.rb', line 37

def compare(gem_name)
  gem = find(gem_name)
  return unless gem.repo?
  gem.set_versions options
  if gem.missing_versions?
    puts "Checking for outdated gems in your bundle..."
    unless gem.load_bundle_versions
      puts "#{gem_name} is not outdated in your bundle. Specify versions."
      return
    end
  end
  puts gem.compare_message
  gem.compare
end

#find(gem_name) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/gemdiff/cli.rb', line 8

def find(gem_name)
  gem = OutdatedGem.new(gem_name)
  if gem.repo?
    puts gem.repo
  else
    puts "Could not find github repository for #{gem_name}."
  end
  gem
end

#open(gem_name) ⇒ Object



19
20
21
22
# File 'lib/gemdiff/cli.rb', line 19

def open(gem_name)
  gem = find(gem_name)
  gem.open
end

#outdatedObject



53
54
55
56
57
58
59
60
61
# File 'lib/gemdiff/cli.rb', line 53

def outdated
  puts "Checking for outdated gems in your bundle..."
  inspector = BundleInspector.new
  inspector.list.each do |gem|
    puts gem.compare_message
    response = ask("Open? (y to open, else skip)")
    gem.compare if response == 'y'
  end
end

#releases(gem_name) ⇒ Object



25
26
27
28
# File 'lib/gemdiff/cli.rb', line 25

def releases(gem_name)
  gem = find(gem_name)
  gem.releases
end