Class: Lapidarist::BundleCommand
- Inherits:
-
Object
- Object
- Lapidarist::BundleCommand
- Defined in:
- lib/lapidarist/bundle_command.rb
Instance Method Summary collapse
-
#initialize ⇒ BundleCommand
constructor
A new instance of BundleCommand.
- #outdated ⇒ Object
- #update(gem, level: MAJOR) ⇒ Object
- #version(gem) ⇒ Object
Constructor Details
#initialize ⇒ BundleCommand
Returns a new instance of BundleCommand.
3 4 5 |
# File 'lib/lapidarist/bundle_command.rb', line 3 def initialize @shell = Shell.new end |
Instance Method Details
#outdated ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lapidarist/bundle_command.rb', line 7 def outdated shell.run('cat Gemfile') if Lapidarist.config.debug Enumerator.new do |y| shell.run('bundle outdated --strict') do |std_out_err| while line = std_out_err.gets Lapidarist.logger.std_out_err(line, 'bundle outdated') gem = parse_gem_from(line) y.yield(gem) if gem end end end end |
#update(gem, level: MAJOR) ⇒ Object
21 22 23 |
# File 'lib/lapidarist/bundle_command.rb', line 21 def update(gem, level: MAJOR) shell.run("bundle update #{gem.name} --strict --#{level.to_s}") end |
#version(gem) ⇒ Object
25 26 27 28 29 |
# File 'lib/lapidarist/bundle_command.rb', line 25 def version(gem) stdout = shell.run('bundle list', "grep \" #{gem.name} \"") result = stdout.match(/\((?<version>[0-9\.]+)(?<sha> \w{7})?\)/) Lapidarist::GemVersion.new(version: result[:version], sha: result[:sha]&.strip) if result end |