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, with 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.freeze
Class Method Summary collapse
Class Method Details
.bundler_version(lockfile) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/dependabot/bundler/helpers.rb', line 18 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
28 29 30 31 32 33 34 35 36 |
# File 'lib/dependabot/bundler/helpers.rb', line 28 def self.detected_bundler_version(lockfile) return "unknown" unless lockfile if (matches = lockfile.content.match(BUNDLER_MAJOR_VERSION_REGEX)) matches[:version] else FAILOVER end end |