Class: Bumpit::Managers::Bundler
- Defined in:
- lib/bumpit/managers/bundler.rb
Constant Summary collapse
- BUNDLE_VERSION_COMMAND =
"bundle info bundler --version"- BUNDLER_UPDATE_COMMAND =
"bundle update --bundler"- DEPENDENCY_MATCHER =
/^\s*gem\s+['"]([^'"]+)['"].*$/- FILENAMES =
%w(Gemfile Gemfile.lock).freeze
- GEM_INFO_COMMAND =
"gem info --exact --remote --no-prerelease --no-verbose bundler"- INFO_MATCHER =
/bundler \(([^)]+)\)/- OUTDATED_COMMAND =
"bundle outdated --only-explicit --parseable 2>/dev/null"- OUTDATED_MATCHER =
/\A(.+) \(newest (.+), installed (.+), requested = (.+)\)\z/
Class Method Summary collapse
-
.valid? ⇒ Boolean
Determine if the manager is valid.
Instance Method Summary collapse
-
#bump ⇒ void
Bump the dependencies, if there are any.
-
#message ⇒ String
Return a message for which dependencies were bumped.
Methods inherited from Base
Class Method Details
.valid? ⇒ Boolean
Determine if the manager is valid.
21 22 23 24 25 26 |
# File 'lib/bumpit/managers/bundler.rb', line 21 def self.valid? executable?("bundle") && FILENAMES.all? do |filename| File.exist?(Pathname.new(Dir.pwd).join(filename)) end end |
Instance Method Details
#bump ⇒ void
This method returns an undefined value.
Bump the dependencies, if there are any.
31 32 33 34 35 36 37 38 |
# File 'lib/bumpit/managers/bundler.rb', line 31 def bump if outdated.any? write_contents bundle_update end update_bundler end |
#message ⇒ String
Return a message for which dependencies were bumped.
43 44 45 46 47 48 49 50 |
# File 'lib/bumpit/managers/bundler.rb', line 43 def dependencies = outdated.keys dependencies << "bundler" if update_bundler? if dependencies.any? "Updates #{to_sentence(dependencies.sort)} in Ruby." end end |