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
23 24 25 |
# File 'lib/rubocop_challenger/bundler/command.rb', line 23 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 |
# File 'lib/rubocop_challenger/bundler/command.rb', line 16 def update(*gem_names) run('update', *gem_names.select { |gem_name| installed?(gem_name) }, '--conservative') end |