Module: BundleUpdateInteractive::BundlerCommands

Defined in:
lib/bundle_update_interactive/bundler_commands.rb

Class Method Summary collapse

Class Method Details

.lockObject



13
14
15
16
17
18
# File 'lib/bundle_update_interactive/bundler_commands.rb', line 13

def lock
  success = system "#{bundle_bin.shellescape} lock"
  raise "bundle lock command failed" unless success

  true
end

.parse_outdated(*gems) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/bundle_update_interactive/bundler_commands.rb', line 29

def parse_outdated(*gems)
  command = ["#{bundle_bin.shellescape} outdated --parseable", *gems.flatten.map(&:shellescape)]
  output = `#{command.join(" ")}`
  raise "bundle outdated command failed" if output.empty? && !Process.last_status.success?

  output.scan(/^(\S+) \(newest (\S+),/).to_h
end

.read_updated_lockfile(*gems) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/bundle_update_interactive/bundler_commands.rb', line 20

def read_updated_lockfile(*gems)
  command = ["#{bundle_bin.shellescape} lock --print"]
  command << "--conservative" if gems.any?
  command << "--update"
  command.push(*gems.flatten.map(&:shellescape))

  `#{command.join(" ")}`.tap { raise "bundle lock command failed" unless Process.last_status.success? }
end

.update_gems_conservatively(*gems) ⇒ Object



9
10
11
# File 'lib/bundle_update_interactive/bundler_commands.rb', line 9

def update_gems_conservatively(*gems)
  system "#{bundle_bin.shellescape} update --conservative #{gems.flatten.map(&:shellescape).join(' ')}"
end