Class: Legendary::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/legendary/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Runner

Returns a new instance of Runner.



3
4
5
# File 'lib/legendary/runner.rb', line 3

def initialize(path=nil)
  Legendary.repository = Repository.new(path)
end

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/legendary/runner.rb', line 7

def run
  Legendary.logger.info("Updating Repository")
  Legendary.repository.clone_or_update

  Legendary.logger.info("Loading Gems")

  success = true

  Gems.new.each do |gem|
    if gem.outdated?
      Legendary.logger.info("#{gem.name} is outdated. #{gem.version} -> #{gem.latest_version} (it is #{gem.gemfile ? 'in your gemfile' : 'a dependency'})")
    end

    if gem.vulnerable?
      Legendary.logger.info("#{gem.name} is vulnerable.")
      success false
    end
  end

  exit 1 unless success
end