Class: AutoGemUpdater::Outdated

Inherits:
Object
  • Object
show all
Defined in:
lib/auto_gem_updater/outdated.rb

Constant Summary collapse

GEM_LINE_REGEX =
/(?<gem>[\w-]+)\s{1}\(newest\s{1}(?<newest>[\d\.]+)\,\s{1}installed\s{1}(?<installed>[\d\.]+)\)/

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOutdated

Returns a new instance of Outdated.



8
9
10
11
# File 'lib/auto_gem_updater/outdated.rb', line 8

def initialize
  @bundle_outdated_command =
    "bundle outdated --parseable #{AutoGemUpdater.outdated_options}"
end

Class Method Details

.performObject



13
14
15
# File 'lib/auto_gem_updater/outdated.rb', line 13

def self.perform
  new.perform
end

Instance Method Details

#performObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/auto_gem_updater/outdated.rb', line 19

def perform
  outdated_gems = []

  Open3
    .popen3(bundle_outdated_command) do |_stdin, stdout, _stderr, _wait_thr|
      while (line = stdout.gets)
        parsed_data = parse_line(line)
        next if parsed_data.nil? || AutoGemUpdater.ignore_gems.include?(parsed_data[:name])

        outdated_gems.push(parsed_data)
      end
    end

  outdated_gems
end