Class: Degem::Cli

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

Constant Summary collapse

GEMFILE =
"Gemfile"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stderr) ⇒ Cli



11
12
13
# File 'lib/degem/cli.rb', line 11

def initialize(stderr)
  Degem.stderr = stderr
end

Class Method Details

.callObject



7
8
9
# File 'lib/degem/cli.rb', line 7

def self.call
  exit new($stderr).call
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/degem/cli.rb', line 15

def call
  unless gemfile_exists?
    Degem.stderr.puts "Gemfile not found in the current directory"
    return 1
  end

  unused = find_unused.call
  decorated = decorate_rubygems.call(unused)
  Report.new.call(decorated)
  0
end