class RubocopChallenger::Bundler::Command
To execute bundler command
Public Class Methods
new(verbose: false)
click to toggle source
# File lib/rubocop_challenger/bundler/command.rb, line 9 def initialize(verbose: false) @verbose = verbose end
Public Instance Methods
installed?(gem_name)
click to toggle source
Checks the gem is installed
@return [Boolean] Returns true if installed
# File lib/rubocop_challenger/bundler/command.rb, line 23 def installed?(gem_name) !run('list', '|', 'grep', "' #{gem_name} '").empty? end
update(*gem_names)
click to toggle source
Executes `$ bundle update` which excludes not installed gems
@param gem_names [Array<String>] The target gem names
# File lib/rubocop_challenger/bundler/command.rb, line 16 def update(*gem_names) run('update', *gem_names.select { |gem_name| installed?(gem_name) }) end
Private Instance Methods
run(*subcommands)
click to toggle source
# File lib/rubocop_challenger/bundler/command.rb, line 29 def run(*subcommands) command = "bundle #{subcommands.join(' ')}" execute(command) end