Class: GemMaintainer::BundleUpdater
- Inherits:
-
Object
- Object
- GemMaintainer::BundleUpdater
- Defined in:
- lib/gem_maintainer/bundle_updater.rb
Overview
Runs ‘bundle update` for the approved set of gems.
Instance Method Summary collapse
-
#initialize(approved_gems) ⇒ BundleUpdater
constructor
A new instance of BundleUpdater.
-
#run ⇒ Object
Returns an array of gem names that Bundler attempted to update but whose version stayed the same.
Constructor Details
#initialize(approved_gems) ⇒ BundleUpdater
Returns a new instance of BundleUpdater.
8 9 10 |
# File 'lib/gem_maintainer/bundle_updater.rb', line 8 def initialize(approved_gems) @gems = approved_gems end |
Instance Method Details
#run ⇒ Object
Returns an array of gem names that Bundler attempted to update but whose version stayed the same.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gem_maintainer/bundle_updater.rb', line 14 def run names = @gems.map { |g| g[:name] }.join(" ") puts "Running: bundle update #{names}" puts unchanged = [] Open3.popen2e("bundle update #{names}") do |_stdin, stdout_err, wait_thr| stdout_err.each_line do |line| print line match = line.match(/Bundler attempted to update (\S+) but its version stayed the same/) unchanged << match[1] if match end wait_thr.value end unchanged end |