Class: Bundler::Stats::CLI

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

Instance Method Summary collapse

Instance Method Details

#show(target) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/bundler/stats/cli.rb', line 32

def show(target)
  calculator = build_calculator(options)
  stats = calculator.summarize(target)

  if options[:format] =~ /json/i
    say JSON.pretty_generate(stats)
  else
    draw_show(stats, target)
  end
end

#statsObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/bundler/stats/cli.rb', line 17

def stats
  calculator = build_calculator(options)
  stats = calculator.stats

  if options[:format] =~ /json/i
    say JSON.pretty_generate(stats)
  else
    draw_stats(stats[:gems], stats[:summary])
  end
end

#versionObject



59
60
61
# File 'lib/bundler/stats/cli.rb', line 59

def version
  say "bundler-stats #{VERSION}"
end

#versions(target) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/bundler/stats/cli.rb', line 47

def versions(target)
  calculator = build_calculator(options)
  stats = calculator.versions(target)

  if options[:format] =~ /json/i
    say JSON.pretty_generate(stats)
  else
    draw_versions(stats, target)
  end
end