Module: Dependabot::Bundler::Helpers
- Defined in:
- lib/dependabot/bundler/helpers.rb
Constant Summary collapse
- V1 =
"1"
- V2 =
"2"
- DEFAULT =
If we are updating a project with no Gemfile.lock, we default to the newest version we support
V2
- FAILOVER =
If we are updating a project with a Gemfile.lock that does not specify the version it was bundled with, we failover to V1 on the assumption it was created with an old version that didn’t add this information
V1
- BUNDLER_MAJOR_VERSION_REGEX =
/BUNDLED WITH\s+(?<version>\d+)\./m
Class Method Summary collapse
Class Method Details
.bundler_version(lockfile) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/dependabot/bundler/helpers.rb', line 19 def self.bundler_version(lockfile) return DEFAULT unless lockfile if (matches = lockfile.content.match(BUNDLER_MAJOR_VERSION_REGEX)) matches[:version].to_i >= 2 ? V2 : V1 else FAILOVER end end |
.detected_bundler_version(lockfile) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/dependabot/bundler/helpers.rb', line 29 def self.detected_bundler_version(lockfile) return "unknown" unless lockfile if (matches = lockfile.content.match(BUNDLER_MAJOR_VERSION_REGEX)) matches[:version].to_i.to_s else "unspecified" end end |