Class: RubocopChallenger::Bundler::Command
- Inherits:
-
Object
- Object
- RubocopChallenger::Bundler::Command
- Includes:
- PrComet::CommandLine
- Defined in:
- lib/rubocop_challenger/bundler/command.rb
Overview
To execute bundler command
Instance Method Summary collapse
-
#initialize(verbose: false) ⇒ Command
constructor
A new instance of Command.
-
#installed?(gem_name) ⇒ Boolean
Checks the gem is installed.
-
#update(*gem_names) ⇒ Object
Executes ‘$ bundle update` which excludes not installed gems.
Constructor Details
#initialize(verbose: false) ⇒ Command
Returns a new instance of Command.
9 10 11 |
# File 'lib/rubocop_challenger/bundler/command.rb', line 9 def initialize(verbose: false) @verbose = verbose end |
Instance Method Details
#installed?(gem_name) ⇒ Boolean
Checks the gem is installed
26 27 28 |
# File 'lib/rubocop_challenger/bundler/command.rb', line 26 def installed?(gem_name) !run('list', '|', 'grep', "' #{gem_name} '").empty? end |
#update(*gem_names) ⇒ Object
Executes ‘$ bundle update` which excludes not installed gems
16 17 18 19 20 21 |
# File 'lib/rubocop_challenger/bundler/command.rb', line 16 def update(*gem_names) target_gems = gem_names.select { |gem_name| installed?(gem_name) } return if target_gems.empty? run('update', *target_gems, '--conservative') end |